laravel 8
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
namespace App\Models\Auth;
|
||||
|
||||
use App\Traits\Tenants;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Laratrust\Models\LaratrustPermission;
|
||||
use Laratrust\Traits\LaratrustPermissionTrait;
|
||||
use Kyslik\ColumnSortable\Sortable;
|
||||
@ -10,7 +11,7 @@ use Lorisleiva\LaravelSearchString\Concerns\SearchString;
|
||||
|
||||
class Permission extends LaratrustPermission
|
||||
{
|
||||
use LaratrustPermissionTrait, SearchString, Sortable, Tenants;
|
||||
use HasFactory, LaratrustPermissionTrait, SearchString, Sortable, Tenants;
|
||||
|
||||
protected $table = 'permissions';
|
||||
|
||||
@ -80,4 +81,14 @@ class Permission extends LaratrustPermission
|
||||
|
||||
return $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new factory instance for the model.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Factories\Factory
|
||||
*/
|
||||
protected static function newFactory()
|
||||
{
|
||||
return \Database\Factories\Permission::new();
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace App\Models\Auth;
|
||||
|
||||
use App\Traits\Tenants;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Laratrust\Models\LaratrustRole;
|
||||
use Laratrust\Traits\LaratrustRoleTrait;
|
||||
use Kyslik\ColumnSortable\Sortable;
|
||||
@ -10,7 +11,7 @@ use Lorisleiva\LaravelSearchString\Concerns\SearchString;
|
||||
|
||||
class Role extends LaratrustRole
|
||||
{
|
||||
use LaratrustRoleTrait, SearchString, Sortable, Tenants;
|
||||
use HasFactory, LaratrustRoleTrait, SearchString, Sortable, Tenants;
|
||||
|
||||
protected $table = 'roles';
|
||||
|
||||
@ -40,4 +41,14 @@ class Role extends LaratrustRole
|
||||
|
||||
return $query->usingSearchString($search)->sortable($sort)->paginate($limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new factory instance for the model.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Factories\Factory
|
||||
*/
|
||||
protected static function newFactory()
|
||||
{
|
||||
return \Database\Factories\Role::new();
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ use App\Traits\Tenants;
|
||||
use App\Notifications\Auth\Reset;
|
||||
use App\Traits\Media;
|
||||
use Date;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
@ -15,7 +16,7 @@ use Lorisleiva\LaravelSearchString\Concerns\SearchString;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use LaratrustUserTrait, Notifiable, SearchString, SoftDeletes, Sortable, Media, Tenants;
|
||||
use HasFactory, LaratrustUserTrait, Notifiable, SearchString, SoftDeletes, Sortable, Media, Tenants;
|
||||
|
||||
protected $table = 'users';
|
||||
|
||||
@ -205,4 +206,14 @@ class User extends Authenticatable
|
||||
{
|
||||
$this->offsetUnset('company_ids');
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new factory instance for the model.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Factories\Factory
|
||||
*/
|
||||
protected static function newFactory()
|
||||
{
|
||||
return \Database\Factories\User::new();
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,11 @@ namespace App\Models\Banking;
|
||||
|
||||
use App\Abstracts\Model;
|
||||
use App\Traits\Transactions;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Account extends Model
|
||||
{
|
||||
use Transactions;
|
||||
use HasFactory, Transactions;
|
||||
|
||||
protected $table = 'accounts';
|
||||
|
||||
@ -91,4 +92,14 @@ class Account extends Model
|
||||
|
||||
return $total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new factory instance for the model.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Factories\Factory
|
||||
*/
|
||||
protected static function newFactory()
|
||||
{
|
||||
return \Database\Factories\Account::new();
|
||||
}
|
||||
}
|
||||
|
@ -10,11 +10,12 @@ use App\Traits\Media;
|
||||
use App\Traits\Recurring;
|
||||
use App\Traits\Transactions;
|
||||
use Bkwld\Cloner\Cloneable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class Transaction extends Model
|
||||
{
|
||||
use Cloneable, Currencies, DateTime, Media, Recurring, Transactions;
|
||||
use Cloneable, Currencies, DateTime, HasFactory, Media, Recurring, Transactions;
|
||||
|
||||
protected $table = 'transactions';
|
||||
|
||||
@ -323,4 +324,14 @@ class Transaction extends Model
|
||||
{
|
||||
return $value ?? $this->document_id ?? $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new factory instance for the model.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Factories\Factory
|
||||
*/
|
||||
protected static function newFactory()
|
||||
{
|
||||
return \Database\Factories\Transaction::new();
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,11 @@ namespace App\Models\Banking;
|
||||
|
||||
use App\Abstracts\Model;
|
||||
use App\Traits\Currencies;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Transfer extends Model
|
||||
{
|
||||
use Currencies;
|
||||
use HasFactory, Currencies;
|
||||
|
||||
protected $table = 'transfers';
|
||||
|
||||
@ -44,4 +45,14 @@ class Transfer extends Model
|
||||
{
|
||||
return $this->belongsTo('App\Models\Banking\Account', 'income_transaction.account_id', 'id')->withDefault(['name' => trans('general.na')]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new factory instance for the model.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Factories\Factory
|
||||
*/
|
||||
protected static function newFactory()
|
||||
{
|
||||
return \Database\Factories\Transfer::new();
|
||||
}
|
||||
}
|
||||
|
@ -8,11 +8,12 @@ use App\Traits\Contacts;
|
||||
use App\Traits\Currencies;
|
||||
use App\Traits\Media;
|
||||
use App\Traits\Transactions;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
class Contact extends Model
|
||||
{
|
||||
use Cloneable, Contacts, Currencies, Media, Notifiable, Transactions;
|
||||
use Cloneable, Contacts, Currencies, HasFactory, Media, Notifiable, Transactions;
|
||||
|
||||
protected $table = 'contacts';
|
||||
|
||||
@ -144,4 +145,14 @@ class Contact extends Model
|
||||
|
||||
return $amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new factory instance for the model.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Factories\Factory
|
||||
*/
|
||||
protected static function newFactory()
|
||||
{
|
||||
return \Database\Factories\Contact::new();
|
||||
}
|
||||
}
|
||||
|
@ -6,10 +6,11 @@ use App\Abstracts\Model;
|
||||
use App\Traits\Currencies;
|
||||
use App\Traits\Media;
|
||||
use Bkwld\Cloner\Cloneable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Item extends Model
|
||||
{
|
||||
use Cloneable, Currencies, Media;
|
||||
use Cloneable, Currencies, HasFactory, Media;
|
||||
|
||||
protected $table = 'items';
|
||||
|
||||
@ -137,4 +138,14 @@ class Item extends Model
|
||||
|
||||
return $this->getMedia('picture')->last();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new factory instance for the model.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Factories\Factory
|
||||
*/
|
||||
protected static function newFactory()
|
||||
{
|
||||
return \Database\Factories\Item::new();
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,11 @@ namespace App\Models\Purchase;
|
||||
|
||||
use App\Abstracts\DocumentModel;
|
||||
use App\Traits\Purchases;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Bill extends DocumentModel
|
||||
{
|
||||
use Purchases;
|
||||
use HasFactory, Purchases;
|
||||
|
||||
protected $table = 'bills';
|
||||
|
||||
@ -108,4 +109,14 @@ class Bill extends DocumentModel
|
||||
|
||||
return ($received) ? $received->created_at : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new factory instance for the model.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Factories\Factory
|
||||
*/
|
||||
protected static function newFactory()
|
||||
{
|
||||
return \Database\Factories\Bill::new();
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,11 @@ namespace App\Models\Sale;
|
||||
|
||||
use App\Abstracts\DocumentModel;
|
||||
use App\Traits\Sales;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Invoice extends DocumentModel
|
||||
{
|
||||
use Sales;
|
||||
use HasFactory, Sales;
|
||||
|
||||
protected $table = 'invoices';
|
||||
|
||||
@ -115,4 +116,14 @@ class Invoice extends DocumentModel
|
||||
|
||||
return ($sent) ? $sent->created_at : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new factory instance for the model.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Factories\Factory
|
||||
*/
|
||||
protected static function newFactory()
|
||||
{
|
||||
return \Database\Factories\Invoice::new();
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,11 @@ namespace App\Models\Setting;
|
||||
|
||||
use App\Abstracts\Model;
|
||||
use App\Traits\Transactions;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Category extends Model
|
||||
{
|
||||
use Transactions;
|
||||
use HasFactory, Transactions;
|
||||
|
||||
protected $table = 'categories';
|
||||
|
||||
@ -130,4 +131,14 @@ class Category extends Model
|
||||
{
|
||||
return (int) $query->other()->pluck('id')->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new factory instance for the model.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Factories\Factory
|
||||
*/
|
||||
protected static function newFactory()
|
||||
{
|
||||
return \Database\Factories\Category::new();
|
||||
}
|
||||
}
|
||||
|
@ -5,10 +5,11 @@ namespace App\Models\Setting;
|
||||
use App\Abstracts\Model;
|
||||
use App\Traits\Contacts;
|
||||
use App\Traits\Transactions;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Currency extends Model
|
||||
{
|
||||
use Contacts, Transactions;
|
||||
use Contacts, HasFactory, Transactions;
|
||||
|
||||
protected $table = 'currencies';
|
||||
|
||||
@ -163,4 +164,14 @@ class Currency extends Model
|
||||
{
|
||||
return $query->where($this->table . '.code', $code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new factory instance for the model.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Factories\Factory
|
||||
*/
|
||||
protected static function newFactory()
|
||||
{
|
||||
return \Database\Factories\Currency::new();
|
||||
}
|
||||
}
|
||||
|
@ -3,9 +3,12 @@
|
||||
namespace App\Models\Setting;
|
||||
|
||||
use App\Abstracts\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Tax extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'taxes';
|
||||
|
||||
/**
|
||||
@ -127,4 +130,14 @@ class Tax extends Model
|
||||
|
||||
return $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new factory instance for the model.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Factories\Factory
|
||||
*/
|
||||
protected static function newFactory()
|
||||
{
|
||||
return \Database\Factories\Tax::new();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user