Add new version in repository
This commit is contained in:
@@ -3,18 +3,21 @@
|
||||
namespace App\Models\Botanic;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use \Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Wildside\Userstamps\Userstamps;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
|
||||
class Family extends Model
|
||||
{
|
||||
use HasRelationships;
|
||||
use HasRelationships, SoftDeletes, Userstamps;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'botanic_families';
|
||||
|
||||
public function genres()
|
||||
{
|
||||
return $this->hasMany('App\Models\Botanic\Genre');
|
||||
return $this->hasMany('App\Models\Botanic\Genre');
|
||||
}
|
||||
|
||||
public function species()
|
||||
@@ -27,9 +30,8 @@ class Family extends Model
|
||||
return $this->hasManyDeep('App\Models\Botanic\Variety', ['App\Models\Botanic\Genre', 'App\Models\Botanic\Specie']);
|
||||
}
|
||||
|
||||
public function scopeByName($query,$name)
|
||||
public function scopeByName($query, $name)
|
||||
{
|
||||
return $query->where('name', $name);
|
||||
return $query->where('name', $name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,20 +3,24 @@
|
||||
namespace App\Models\Botanic;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Wildside\Userstamps\Userstamps;
|
||||
class Genre extends Model
|
||||
{
|
||||
use SoftDeletes, Userstamps;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'botanic_genres';
|
||||
|
||||
public function family()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Botanic\Family');
|
||||
return $this->belongsTo('App\Models\Botanic\Family');
|
||||
}
|
||||
|
||||
public function species()
|
||||
{
|
||||
return $this->hasMany('App\Models\Botanic\Specie');
|
||||
return $this->hasMany('App\Models\Botanic\Specie');
|
||||
}
|
||||
|
||||
public function varieties()
|
||||
@@ -24,9 +28,8 @@ class Genre extends Model
|
||||
return $this->hasManyThrough('App\Models\Botanic\Variety', 'App\Models\Botanic\Specie');
|
||||
}
|
||||
|
||||
public function scopeByName($query,$name)
|
||||
public function scopeByName($query, $name)
|
||||
{
|
||||
return $query->where('name', $name);
|
||||
return $query->where('name', $name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,25 +3,35 @@
|
||||
namespace App\Models\Botanic;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Wildside\Userstamps\Userstamps;
|
||||
use Rinvex\Tags\Traits\Taggable;
|
||||
|
||||
class Specie extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'botanic_species';
|
||||
use SoftDeletes, Taggable, UserStamps;
|
||||
|
||||
public function Genre()
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'botanic_species';
|
||||
|
||||
public function Genre()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Botanic\Genre');
|
||||
return $this->belongsTo('App\Models\Botanic\Genre');
|
||||
}
|
||||
|
||||
public function Varieties()
|
||||
{
|
||||
return $this->hasMany('App\Models\Botanic\Variety');
|
||||
return $this->hasMany('App\Models\Botanic\Variety');
|
||||
}
|
||||
|
||||
public function scopeByName($query,$name)
|
||||
public function Articles()
|
||||
{
|
||||
return $query->where('name', $name);
|
||||
return $this->morphMany('App\Models\Shop\Article', 'product');
|
||||
}
|
||||
|
||||
}
|
||||
public function scopeByName($query, $name)
|
||||
{
|
||||
return $query->where('name', $name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,38 +3,40 @@
|
||||
namespace App\Models\Botanic;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Spatie\Image\Manipulations;
|
||||
use Spatie\MediaLibrary\Models\Media;
|
||||
use Spatie\MediaLibrary\HasMedia\HasMedia;
|
||||
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;
|
||||
use Spatie\Image\Manipulations;
|
||||
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
|
||||
use Rinvex\Tags\Traits\Taggable;
|
||||
use Fico7489\Laravel\EloquentJoin\Traits\EloquentJoin;
|
||||
|
||||
use Wildside\Userstamps\Userstamps;
|
||||
class Variety extends Model implements HasMedia
|
||||
{
|
||||
use EloquentJoin, HasMediaTrait, Taggable;
|
||||
use EloquentJoin, InteractsWithMedia, Taggable, SoftDeletes, UserStamps;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'botanic_varieties';
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'botanic_varieties';
|
||||
|
||||
public function Specie()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Botanic\Specie');
|
||||
}
|
||||
public function Specie()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Botanic\Specie');
|
||||
}
|
||||
|
||||
public function Articles()
|
||||
{
|
||||
return $this->morphMany('App\Models\Shop\Article','product');
|
||||
}
|
||||
public function Articles()
|
||||
{
|
||||
return $this->morphMany('App\Models\Shop\Article', 'product');
|
||||
}
|
||||
|
||||
public function registerMediaConversions(Media $media = null)
|
||||
{
|
||||
$this->addMediaConversion('thumb')->fit(Manipulations::FIT_CROP, 32, 32);
|
||||
$this->addMediaConversion('mini')->fit(Manipulations::FIT_CROP, 96, 96);
|
||||
$this->addMediaConversion('preview')->fit(Manipulations::FIT_CROP, 160, 160);
|
||||
$this->addMediaConversion('normal')->fit(Manipulations::FIT_CROP, 480, 480);
|
||||
$this->addMediaConversion('zoom')->fit(Manipulations::FIT_CROP, 1200, 1200)->withResponsiveImages();
|
||||
}
|
||||
}
|
||||
public function registerMediaConversions(Media $media = null) : void
|
||||
{
|
||||
$this->addMediaConversion('thumb')->fit(Manipulations::FIT_CROP, 32, 32);
|
||||
$this->addMediaConversion('mini')->fit(Manipulations::FIT_CROP, 96, 96);
|
||||
$this->addMediaConversion('preview')->fit(Manipulations::FIT_CROP, 160, 160);
|
||||
$this->addMediaConversion('normal')->fit(Manipulations::FIT_CROP, 480, 480);
|
||||
// $this->addMediaConversion('zoom')->fit(Manipulations::FIT_CROP, 1200, 1200)->withResponsiveImages();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Core\App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@@ -7,17 +6,18 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Application extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
protected $connection = 'system';
|
||||
protected $guarded = ['id'];
|
||||
public $timestamps = false;
|
||||
|
||||
public function pages()
|
||||
{
|
||||
return $this->hasMany('App\Models\Core\App\ApplicationPage');
|
||||
return $this->hasMany(\App\Models\Core\App\ApplicationPage::class);
|
||||
}
|
||||
|
||||
public function modules()
|
||||
{
|
||||
return $this->hasMany('App\Models\Core\App\ApplicationModule');
|
||||
return $this->hasMany(\App\Models\Core\App\ApplicationModule::class);
|
||||
}
|
||||
|
||||
public function scopeActive($query)
|
||||
|
||||
47
app/Models/Core/App/ApplicationClient.php
Normal file
47
app/Models/Core/App/ApplicationClient.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
namespace App\Models\Core\App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class ApplicationClient extends Model
|
||||
{
|
||||
protected $connection = 'system';
|
||||
protected $guarded = [];
|
||||
protected $table = 'application_clients';
|
||||
public $timestamps = false;
|
||||
|
||||
public function application()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\Core\App\Application::class);
|
||||
}
|
||||
|
||||
public function client()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Partner\Client');
|
||||
}
|
||||
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->where('active', 1);
|
||||
}
|
||||
|
||||
public function scopeByApplication($query, $id)
|
||||
{
|
||||
return $query->where('application_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByClient($query, $id)
|
||||
{
|
||||
return $query->where('client_id', $id);
|
||||
}
|
||||
|
||||
public function scopeBySlug($query, $slug)
|
||||
{
|
||||
return $query->whereHas(
|
||||
'application', function ($query) use ($slug) {
|
||||
$query->bySlug($slug);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Core\App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@@ -9,16 +8,17 @@ class ApplicationModule extends Model
|
||||
{
|
||||
protected $connection = 'system';
|
||||
protected $table = 'application_modules';
|
||||
protected $guarded = ['id'];
|
||||
public $timestamps = false;
|
||||
|
||||
public function application()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Core\App\Application');
|
||||
return $this->belongsTo(\App\Models\Core\App\Application::class);
|
||||
}
|
||||
|
||||
public function permissions()
|
||||
{
|
||||
return $this->hasMany('App\Auth\Permission');
|
||||
return $this->hasMany(\App\Models\Core\Auth\Permission::class);
|
||||
}
|
||||
|
||||
public function scopeActive($query)
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Application;
|
||||
namespace App\Models\Core\App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class ApplicationPage extends Model
|
||||
{
|
||||
protected $connection = 'system';
|
||||
protected $table = 'application_pages';
|
||||
public $timestamps = false;
|
||||
|
||||
public function application()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Core\App');
|
||||
return $this->belongsTo(\App\Models\Core\App\Application::class);
|
||||
}
|
||||
|
||||
public function scopeActive($query)
|
||||
|
||||
20
app/Models/Core/Auth/PasswordReset.php
Normal file
20
app/Models/Core/Auth/PasswordReset.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Core\Auth;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PasswordReset extends Model
|
||||
{
|
||||
protected $table = 'password_resets';
|
||||
|
||||
public function scopeByToken($query, $token)
|
||||
{
|
||||
return $query->where('token', $token);
|
||||
}
|
||||
|
||||
public function scopeByEmail($query, $email)
|
||||
{
|
||||
return $query->where('email', $email);
|
||||
}
|
||||
}
|
||||
23
app/Models/Core/Auth/PasswordSecurity.php
Normal file
23
app/Models/Core/Auth/PasswordSecurity.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Core\Auth;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PasswordSecurity extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'user_id', 'password_expiry_days', 'password_updated_at'
|
||||
];
|
||||
|
||||
// set relation
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Core\Auth\User');
|
||||
}
|
||||
}
|
||||
@@ -2,48 +2,20 @@
|
||||
|
||||
namespace App\Models\Core\Auth;
|
||||
|
||||
use Laratrust\Models\LaratrustPermission;
|
||||
use Sebastienheyd\Boilerplate\Models\Permission as parentPermission;
|
||||
|
||||
/**
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $display_name
|
||||
* @property string $description
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Role[] $roles
|
||||
*
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\Permission whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\Permission whereDescription($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\Permission whereDisplayName($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\Permission whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\Permission whereName($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\Permission whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
|
||||
class Permission extends LaratrustPermission
|
||||
class Permission extends parentPermission
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
protected $guarded = ['id'];
|
||||
|
||||
public function application()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Core\App\Application');
|
||||
return $this->belongsTo(\App\Models\Core\App\Application::class)->withDefault(['name' => '']);
|
||||
}
|
||||
|
||||
public function application_module()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Core\App\ApplicationModule');
|
||||
}
|
||||
|
||||
public function getDisplayNameAttribute($value)
|
||||
{
|
||||
return __($value);
|
||||
}
|
||||
|
||||
public function getDescriptionAttribute($value)
|
||||
{
|
||||
return __($value);
|
||||
return $this->belongsTo(\App\Models\Core\App\ApplicationModule::class)->withDefault(['name' => '']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,34 +2,8 @@
|
||||
|
||||
namespace App\Models\Core\Auth;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $display_name
|
||||
* @property string $description
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Role[] $roles
|
||||
*
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\Permission whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\Permission whereDescription($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\Permission whereDisplayName($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\Permission whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\Permission whereName($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\Permission whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class PermissionCategory extends Models
|
||||
{
|
||||
public function getDisplayNameAttribute($value)
|
||||
{
|
||||
return __($value);
|
||||
}
|
||||
use Sebastienheyd\Boilerplate\Models\permissionCategory as parentPermissionCategory;
|
||||
|
||||
public function getDescriptionAttribute($value)
|
||||
{
|
||||
return __($value);
|
||||
}
|
||||
class PermissionCategory extends parentPermissionCategory
|
||||
{
|
||||
}
|
||||
|
||||
@@ -10,12 +10,12 @@ class PermissionRole extends Model
|
||||
|
||||
public function permission()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Core\Auth\Permission');
|
||||
return $this->belongsTo(\App\Models\Core\Auth\Permission::class);
|
||||
}
|
||||
|
||||
public function role()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Core\Auth\Role');
|
||||
return $this->belongsTo(\App\Models\Core\Auth\Role::class);
|
||||
}
|
||||
|
||||
public function scopeByPermission($query, $id)
|
||||
|
||||
@@ -10,17 +10,17 @@ class PermissionUser extends Model
|
||||
|
||||
public function permission()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Core\Auth\Permission');
|
||||
return $this->belongsTo(\App\Models\Core\Auth\Permission::class);
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Core\Auth\User');
|
||||
return $this->belongsTo(\App\Models\Core\Auth\User::class);
|
||||
}
|
||||
|
||||
public function team()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Core\Auth\Team');
|
||||
return $this->belongsTo(\App\Models\Core\Auth\Team::class);
|
||||
}
|
||||
|
||||
public function scopeByUser($query, $id)
|
||||
|
||||
@@ -2,44 +2,9 @@
|
||||
|
||||
namespace App\Models\Core\Auth;
|
||||
|
||||
use Laratrust\Models\LaratrustRole;
|
||||
use Sebastienheyd\Boilerplate\Models\Role as parentRole;
|
||||
|
||||
/**
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $display_name
|
||||
* @property string $description
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Permission[] $permissions
|
||||
*
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\Role whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\Role whereDescription($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\Role whereDisplayName($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\Role whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\Role whereName($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\Role whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
|
||||
class Role extends LaratrustRole
|
||||
class Role extends parentRole
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
protected $guarded = ['id'];
|
||||
|
||||
public function getDisplayNameAttribute($value)
|
||||
{
|
||||
return __($value);
|
||||
}
|
||||
|
||||
public function getDescriptionAttribute($value)
|
||||
{
|
||||
return __($value);
|
||||
}
|
||||
|
||||
public function getNbUsers()
|
||||
{
|
||||
return User::whereRoleIs($this->name)->count();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Core\Auth;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@@ -11,12 +10,12 @@ class RoleUser extends Model
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Core\Auth\User');
|
||||
return $this->belongsTo(\App\Models\Core\Auth\User::class);
|
||||
}
|
||||
|
||||
public function team()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Core\Auth\Team');
|
||||
return $this->belongsTo(\App\Models\Core\Auth\Team::class);
|
||||
}
|
||||
|
||||
public function scopeByUser($query, $id)
|
||||
|
||||
@@ -15,12 +15,11 @@ class Team extends LaratrustTeam
|
||||
|
||||
public function users()
|
||||
{
|
||||
return $this->hasMany('App\Models\Core\Auth\User');
|
||||
return $this->hasMany(\App\Models\Core\Auth\User::class);
|
||||
}
|
||||
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->where('active', 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,12 +11,12 @@ class TeamUser extends Model
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Core\Auth\User');
|
||||
return $this->belongsTo(\App\Models\Core\Auth\User::class);
|
||||
}
|
||||
|
||||
public function team()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Core\Auth\Team');
|
||||
return $this->belongsTo(\App\Models\Core\Auth\Team::class);
|
||||
}
|
||||
|
||||
public function scopeByUser($query, $id)
|
||||
|
||||
@@ -5,65 +5,21 @@ namespace App\Models\Core\Auth;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Yadahan\AuthenticationLog\AuthenticationLogable;
|
||||
use Laratrust\Traits\LaratrustUserTrait;
|
||||
use Mpociot\Teamwork\Traits\UserHasTeams;
|
||||
use Sebastienheyd\Boilerplate\Notifications\NewUser as NewUserNotification;
|
||||
use Sebastienheyd\Boilerplate\Notifications\ResetPassword as ResetPasswordNotification;
|
||||
use HighIdeas\UsersOnline\Traits\UsersOnlineTrait;
|
||||
use Sebastienheyd\Boilerplate\Models\User as parentUser;
|
||||
|
||||
/**
|
||||
* Sebastienheyd\Boilerplate\Models\User.
|
||||
*
|
||||
* @property int $id
|
||||
* @property bool $active
|
||||
* @property string $first_name
|
||||
* @property string $last_name
|
||||
* @property string $email
|
||||
* @property string $password
|
||||
* @property string $remember_token
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property string $deleted_at
|
||||
* @property string $last_login
|
||||
* @property-read string|false $avatar_path
|
||||
* @property-read string $avatar_url
|
||||
* @property-read mixed $name
|
||||
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection|\Illuminate\Notifications\DatabaseNotification[] $notifications
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Sebastienheyd\Boilerplate\Models\Permission[] $permissions
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\Sebastienheyd\Boilerplate\Models\Role[] $roles
|
||||
*
|
||||
* @method static \Illuminate\Database\Query\Builder|\Sebastienheyd\Boilerplate\Models\User whereActive($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Sebastienheyd\Boilerplate\Models\User whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Sebastienheyd\Boilerplate\Models\User whereDeletedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Sebastienheyd\Boilerplate\Models\User whereEmail($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Sebastienheyd\Boilerplate\Models\User whereFirstName($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Sebastienheyd\Boilerplate\Models\User whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Sebastienheyd\Boilerplate\Models\User whereLastLogin($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Sebastienheyd\Boilerplate\Models\User whereLastName($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Sebastienheyd\Boilerplate\Models\User wherePassword($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Sebastienheyd\Boilerplate\Models\User whereRememberToken($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Sebastienheyd\Boilerplate\Models\User whereRoleIs($role = '')
|
||||
* @method static \Illuminate\Database\Query\Builder|\Sebastienheyd\Boilerplate\Models\User whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
|
||||
|
||||
class User extends Authenticatable
|
||||
class User extends parentUser
|
||||
{
|
||||
use Notifiable;
|
||||
use LaratrustUserTrait;
|
||||
use SoftDeletes;
|
||||
use UserHasTeams;
|
||||
use AuthenticationLogable;
|
||||
|
||||
// use UserHasTeams;
|
||||
use AuthenticationLogable, SoftDeletes, UsersOnlineTrait;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['active', 'last_name', 'first_name', 'email', 'password', 'remember_token', 'last_login'];
|
||||
protected $fillable = ['active', 'last_name', 'first_name', 'username', 'email', 'password', 'remember_token', 'last_login'];
|
||||
|
||||
protected $hidden = ['password', 'remember_token'];
|
||||
|
||||
@@ -77,16 +33,23 @@ class User extends Authenticatable
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function passwordSecurity()
|
||||
{
|
||||
return $this->hasOne('App\Models\Core\Auth\PasswordSecurity');
|
||||
}
|
||||
|
||||
public function teams()
|
||||
{
|
||||
return $this->hasManyThrough('App\Models\Core\Auth\Team', 'App\Models\Core\Auth\TeamUser', 'user_id', 'id', 'id', 'team_id');
|
||||
return $this->hasManyThrough(\App\Models\Core\Auth\Team::class, \App\Models\Core\Auth\TeamUser::class, 'user_id', 'id', 'id', 'team_id');
|
||||
}
|
||||
|
||||
public function scopeByTeam($query, $id)
|
||||
{
|
||||
return $query->whereHas('teams', function ($query) use ($id) {
|
||||
$query->where('id', $id);
|
||||
});
|
||||
return $query->whereHas(
|
||||
'teams', function ($query) use ($id) {
|
||||
$query->where('id', $id);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public function scopeByUniqueTeam($query)
|
||||
@@ -98,128 +61,4 @@ class User extends Authenticatable
|
||||
{
|
||||
return $query->where('active', 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the password reset notification.
|
||||
*
|
||||
* @param string $token
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function sendPasswordResetNotification($token)
|
||||
{
|
||||
$this->notify(new ResetPasswordNotification($token));
|
||||
}
|
||||
|
||||
/**
|
||||
* Send notification when a new user is created.
|
||||
*
|
||||
* @param string $token
|
||||
*/
|
||||
public function sendNewUserNotification($token)
|
||||
{
|
||||
$this->notify(new NewUserNotification($token, $this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return last name in uppercase by default.
|
||||
*
|
||||
* @param $value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLastNameAttribute($value)
|
||||
{
|
||||
return mb_strtoupper($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return first name with first char of every word in uppercase.
|
||||
*
|
||||
* @param $value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFirstNameAttribute($value)
|
||||
{
|
||||
return mb_convert_case($value, MB_CASE_TITLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a concatenation of first name and last_name if field name does not exists.
|
||||
*
|
||||
* @param $value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNameAttribute($value)
|
||||
{
|
||||
if (!empty($value)) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
return $this->first_name.' '.$this->last_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return last login date formatted.
|
||||
*
|
||||
* @param string $format
|
||||
* @param string $default
|
||||
*
|
||||
* @return mixed|string
|
||||
*/
|
||||
public function getLastLogin($format = 'YYYY-MM-DD HH:mm:ss', $default = '')
|
||||
{
|
||||
if ($this->last_login === null) {
|
||||
return $default;
|
||||
}
|
||||
|
||||
return Carbon::createFromTimeString($this->last_login)->isoFormat($format);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return role list as a string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRolesList()
|
||||
{
|
||||
$res = [];
|
||||
foreach ($this->roles as $role) {
|
||||
$res[] = __($role->display_name);
|
||||
}
|
||||
if (empty($res)) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
return implode(', ', $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if current user has an avatar.
|
||||
*
|
||||
* @return string|false
|
||||
*/
|
||||
public function getAvatarPathAttribute()
|
||||
{
|
||||
return public_path('images/avatars/'.md5($this->id.$this->email).'.jpg');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return current user avatar uri.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAvatarUrlAttribute()
|
||||
{
|
||||
if (is_file($this->avatar_path)) {
|
||||
$ts = filemtime($this->avatar_path);
|
||||
|
||||
return asset('images/avatars/'.md5($this->id.$this->email).'.jpg?t='.$ts);
|
||||
}
|
||||
|
||||
return asset('/assets/vendor/boilerplate/images/default-user.png');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
33
app/Models/Core/Auth/UserClient.php
Normal file
33
app/Models/Core/Auth/UserClient.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Core\Auth;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class UserClient extends Model
|
||||
{
|
||||
protected $connection = 'system';
|
||||
protected $guarded = [];
|
||||
public $timestamps = false;
|
||||
|
||||
public function client()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Partner\Client');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\User');
|
||||
}
|
||||
|
||||
public function scopeByClient($query, $id)
|
||||
{
|
||||
return $query->where('client_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByUser($query, $id)
|
||||
{
|
||||
return $query->where('user_id', $id);
|
||||
}
|
||||
}
|
||||
32
app/Models/Core/Auth/UserStatus.php
Normal file
32
app/Models/Core/Auth/UserStatus.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
namespace App\Models\Core\Auth;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class UserStatus extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
protected $guarded = [];
|
||||
protected $table = "user_statuses";
|
||||
public $timestamps = false;
|
||||
|
||||
public function scopeByName($query, $name)
|
||||
{
|
||||
return $query->where('name', $name);
|
||||
}
|
||||
|
||||
public function scopeByTranslated($query, $translated)
|
||||
{
|
||||
return $query->where('translated', $translated);
|
||||
}
|
||||
|
||||
public function scopeByNegociator($query)
|
||||
{
|
||||
return $query->where('negociator', '>', 0);
|
||||
}
|
||||
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->where('active', 1);
|
||||
}
|
||||
}
|
||||
32
app/Models/Core/Auth/UserStatusTeam.php
Normal file
32
app/Models/Core/Auth/UserStatusTeam.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
namespace App\Models\Core\Auth;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class UserStatusTeam extends Model
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
protected $guarded = [];
|
||||
protected $table = "user_status_teams";
|
||||
public $timestamps = false;
|
||||
|
||||
public function user_status()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\Core\Auth\UserStatus::class);
|
||||
}
|
||||
|
||||
public function team()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\Core\Auth\Team::class);
|
||||
}
|
||||
|
||||
public function scopeByUserStatus($query, $id)
|
||||
{
|
||||
return $query->where('user_status_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByTeam($query, $id)
|
||||
{
|
||||
return $query->where('team_id', $id);
|
||||
}
|
||||
}
|
||||
@@ -8,5 +8,4 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
class Media extends Model
|
||||
{
|
||||
protected $table = 'media';
|
||||
|
||||
}
|
||||
|
||||
@@ -3,80 +3,81 @@
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Spatie\Image\Manipulations;
|
||||
use Spatie\MediaLibrary\Models\Media;
|
||||
use Spatie\MediaLibrary\HasMedia\HasMedia;
|
||||
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;
|
||||
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
|
||||
use Rinvex\Categories\Traits\Categorizable;
|
||||
use Rinvex\Tags\Traits\Taggable;
|
||||
use Fico7489\Laravel\EloquentJoin\Traits\EloquentJoin;
|
||||
use Wildside\Userstamps\Userstamps;
|
||||
|
||||
class Article extends Model implements HasMedia
|
||||
{
|
||||
use Categorizable, EloquentJoin, HasMediaTrait, Taggable;
|
||||
use Categorizable, EloquentJoin, InteractsWithMedia, Taggable, SoftDeletes, UserStamps;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_articles';
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_articles';
|
||||
|
||||
public function article_family()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleFamily');
|
||||
}
|
||||
public function article_nature()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleNature');
|
||||
}
|
||||
|
||||
public function images()
|
||||
{
|
||||
return $this->hasMany('App\Models\Core\Media','model_id')->where('model_type','App\Models\Shop\Article');
|
||||
}
|
||||
public function images()
|
||||
{
|
||||
return $this->hasMany('App\Models\Core\Media', 'model_id')->where('model_type', 'App\Models\Shop\Article');
|
||||
}
|
||||
|
||||
public function image()
|
||||
{
|
||||
return $this->hasOne('App\Models\Core\Media','model_id')->where('model_type','App\Models\Shop\Article');
|
||||
}
|
||||
public function image()
|
||||
{
|
||||
return $this->hasOne('App\Models\Core\Media', 'model_id')->where('model_type', 'App\Models\Shop\Article');
|
||||
}
|
||||
|
||||
public function inventories()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Inventory');
|
||||
}
|
||||
public function inventories()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Inventory');
|
||||
}
|
||||
|
||||
public function invoiceItems()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\InvoiceItem');
|
||||
}
|
||||
public function invoiceItems()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\InvoiceItem');
|
||||
}
|
||||
|
||||
public function prices()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Price');
|
||||
}
|
||||
public function prices()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Price');
|
||||
}
|
||||
|
||||
public function product()
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
public function product()
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
|
||||
public function scopeByArticle($query, $id)
|
||||
{
|
||||
return $query->where('shop_articles.id',$id);
|
||||
}
|
||||
public function scopeByArticle($query, $id)
|
||||
{
|
||||
return $query->where('shop_articles.id', $id);
|
||||
}
|
||||
|
||||
public function scopeByCategory($query, $category_id)
|
||||
{
|
||||
public function scopeByCategory($query, $category_id)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
public function scopeByFamily($query, $id)
|
||||
{
|
||||
return $query->where('shop_articles.article_family_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByFamily($query, $id)
|
||||
{
|
||||
return $query->where('shop_articles.article_family_id',$id);
|
||||
}
|
||||
|
||||
public function registerMediaConversions(Media $media = null)
|
||||
{
|
||||
$this->addMediaConversion('thumb')->fit(Manipulations::FIT_CROP, 32, 32);
|
||||
$this->addMediaConversion('mini')->fit(Manipulations::FIT_CROP, 96, 96);
|
||||
$this->addMediaConversion('preview')->fit(Manipulations::FIT_CROP, 160, 160);
|
||||
$this->addMediaConversion('normal')->fit(Manipulations::FIT_CROP, 480, 480);
|
||||
$this->addMediaConversion('zoom')->fit(Manipulations::FIT_CROP, 1200, 1200)->withResponsiveImages();
|
||||
}
|
||||
|
||||
}
|
||||
public function registerMediaConversions(Media $media = null) : void
|
||||
{
|
||||
$this->addMediaConversion('thumb')->fit(Manipulations::FIT_CROP, 32, 32);
|
||||
$this->addMediaConversion('mini')->fit(Manipulations::FIT_CROP, 96, 96);
|
||||
$this->addMediaConversion('preview')->fit(Manipulations::FIT_CROP, 160, 160);
|
||||
$this->addMediaConversion('normal')->fit(Manipulations::FIT_CROP, 480, 480);
|
||||
$this->addMediaConversion('zoom')->fit(Manipulations::FIT_CROP, 1200, 1200)->withResponsiveImages();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ArticleComponent extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_article_components';
|
||||
|
||||
public function Article()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Article');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
|
||||
class ArticleFamily extends Model
|
||||
{
|
||||
use HasRelationships;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_article_families';
|
||||
|
||||
public function articles()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Article');
|
||||
}
|
||||
|
||||
public function prices()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Price');
|
||||
}
|
||||
|
||||
public function packages()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Package');
|
||||
}
|
||||
}
|
||||
22
app/Models/Shop/ArticleNature.php
Normal file
22
app/Models/Shop/ArticleNature.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Wildside\Userstamps\Userstamps;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
|
||||
class ArticleNature extends Model
|
||||
{
|
||||
use HasRelationships, SoftDeletes, UserStamps;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_article_natures';
|
||||
|
||||
public function articles()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Article');
|
||||
}
|
||||
}
|
||||
@@ -7,28 +7,28 @@ use Znck\Eloquent\Traits\BelongsToThrough;
|
||||
|
||||
class ArticlePrice extends Model
|
||||
{
|
||||
use BelongsToThrough;
|
||||
use BelongsToThrough;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_article_prices';
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_article_prices';
|
||||
|
||||
public function price()
|
||||
{
|
||||
return $this->hasOne('App\Models\Price');
|
||||
}
|
||||
public function price()
|
||||
{
|
||||
return $this->hasOne('App\Models\Price');
|
||||
}
|
||||
|
||||
public function article_family()
|
||||
{
|
||||
return $this->belongsTo('App\Models\ArticleFamily');
|
||||
}
|
||||
public function article_family()
|
||||
{
|
||||
return $this->belongsTo('App\Models\ArticleNature');
|
||||
}
|
||||
|
||||
public function scopeByQuantity($query, $quantity)
|
||||
{
|
||||
return $query->orderBy('quantity', 'desc')->where('quantity', '<', $quantity)->first();
|
||||
}
|
||||
public function scopeByQuantity($query, $quantity)
|
||||
{
|
||||
return $query->orderBy('quantity', 'desc')->where('quantity', '<', $quantity)->first();
|
||||
}
|
||||
|
||||
public function scopeByFamily($query, $id)
|
||||
public function scopeByFamily($query, $id)
|
||||
{
|
||||
return $query->where('article_family_value_id', $id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
24
app/Models/Shop/Basket.php
Normal file
24
app/Models/Shop/Basket.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Spatie\MediaLibrary\HasMedia\HasMedia;
|
||||
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;
|
||||
// use Rinvex\Categories\Traits\Categorizable;
|
||||
use Rinvex\Tags\Traits\Taggable;
|
||||
// use Conner\Tagging\Taggable;
|
||||
use Fico7489\Laravel\EloquentJoin\Traits\EloquentJoin;
|
||||
|
||||
class Category extends Model
|
||||
{
|
||||
use Taggable, HasMediaTrait;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_categories';
|
||||
|
||||
public function Articles()
|
||||
{
|
||||
return $this->morphedByMany('App\Models\Shop\Article', 'categorizable');
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,11 @@
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Spatie\MediaLibrary\HasMedia\HasMedia;
|
||||
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;
|
||||
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
|
||||
// use Rinvex\Categories\Traits\Categorizable;
|
||||
use Rinvex\Tags\Traits\Taggable;
|
||||
// use Conner\Tagging\Taggable;
|
||||
@@ -12,14 +15,13 @@ use Fico7489\Laravel\EloquentJoin\Traits\EloquentJoin;
|
||||
|
||||
class Category extends Model
|
||||
{
|
||||
use Taggable, HasMediaTrait;
|
||||
use InteractsWithMedia, Taggable;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_categories';
|
||||
protected $table = 'shop_categories';
|
||||
|
||||
public function Articles()
|
||||
{
|
||||
return $this->morphedByMany('App\Models\Shop\Article', 'categorizable');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,21 +6,21 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Customer extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_customers';
|
||||
|
||||
public function Invoices()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Invoice');
|
||||
}
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_customers';
|
||||
|
||||
public function Invoices()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Invoice');
|
||||
}
|
||||
|
||||
public function Orders()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Order');
|
||||
}
|
||||
public function Orders()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Order');
|
||||
}
|
||||
|
||||
public function User()
|
||||
{
|
||||
return $this->belongsTo('App\User');
|
||||
}
|
||||
}
|
||||
public function User()
|
||||
{
|
||||
return $this->belongsTo('App\User');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CustomerAddress extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $guarded = ['id'];
|
||||
|
||||
public function Customer()
|
||||
{
|
||||
@@ -17,5 +17,4 @@ class CustomerAddress extends Model
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Order');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
19
app/Models/Shop/DistributionChannel.php
Normal file
19
app/Models/Shop/DistributionChannel.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
|
||||
class DistributionChannel extends Model
|
||||
{
|
||||
use HasRelationships;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_article_families';
|
||||
|
||||
public function tariff_generics()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\TariffGeneric');
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Invoice extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $guarded = ['id'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
@@ -23,4 +23,4 @@ class Invoice extends Model
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Customer');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class InvoiceItem extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $guarded = ['id'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
@@ -23,4 +23,4 @@ class InvoiceItem extends Model
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Invoice');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
20
app/Models/Shop/Merchandise.php
Normal file
20
app/Models/Shop/Merchandise.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use Rinvex\Tags\Traits\Taggable;
|
||||
|
||||
class Merchandise extends Model
|
||||
{
|
||||
use Taggable;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_merchandises';
|
||||
|
||||
public function Articles()
|
||||
{
|
||||
return $this->morphMany('App\Models\Shop\Article', 'product');
|
||||
}
|
||||
}
|
||||
26
app/Models/Shop/Offer.php
Normal file
26
app/Models/Shop/Offer.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Offer extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_offers';
|
||||
|
||||
public function article()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Article');
|
||||
}
|
||||
|
||||
public function variation()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Variation');
|
||||
}
|
||||
|
||||
public function tariff()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Tariff');
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Order extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $guarded = ['id'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
@@ -23,4 +23,4 @@ class Order extends Model
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\OrderPayment');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class OrderPayment extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $guarded = ['id'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
@@ -15,6 +15,4 @@ class OrderPayment extends Model
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Order');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6,21 +6,21 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Package extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_packages';
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_packages';
|
||||
|
||||
public function article_family()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleFamily');
|
||||
}
|
||||
public function article_family()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleNature');
|
||||
}
|
||||
|
||||
public function unities()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Unity');
|
||||
}
|
||||
public function unities()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Unity');
|
||||
}
|
||||
|
||||
public function scopeByArticleFamily($query, $id)
|
||||
{
|
||||
return $query->where('article_family_id', $id);
|
||||
}
|
||||
public function scopeByArticleNature($query, $id)
|
||||
{
|
||||
return $query->where('article_family_id', $id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,54 +2,33 @@
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
|
||||
class Price extends Model
|
||||
{
|
||||
use HasRelationships;
|
||||
use HasRelationships;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_prices';
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_prices';
|
||||
|
||||
public function article()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Article');
|
||||
}
|
||||
public function article()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Article');
|
||||
}
|
||||
|
||||
public function article_family()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleFamily');
|
||||
}
|
||||
public function article_family()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleNature');
|
||||
}
|
||||
|
||||
public function generic()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\PriceGeneric', 'price_generic_id');
|
||||
}
|
||||
public function scopeByArticle($query, $id)
|
||||
{
|
||||
return $query->where('article_id', $id);
|
||||
}
|
||||
|
||||
public function generic_prices()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function scopeByArticle($query, $id)
|
||||
{
|
||||
return $query->where('article_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByArticleFamily($query, $id)
|
||||
{
|
||||
return $query->where('article_family_id', $id);
|
||||
}
|
||||
|
||||
public function scopeGeneric($query)
|
||||
{
|
||||
return $query->whereNotNull('price_generic_id');
|
||||
}
|
||||
|
||||
public function scopeNotGeneric($query)
|
||||
{
|
||||
return $query->whereNull('price_generic_id');
|
||||
}
|
||||
|
||||
}
|
||||
public function scopeByArticleNature($query, $id)
|
||||
{
|
||||
return $query->where('article_family_id', $id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Znck\Eloquent\Traits\BelongsToThrough;
|
||||
|
||||
class PriceGeneric extends Model
|
||||
{
|
||||
use BelongsToThrough;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_price_generics';
|
||||
|
||||
public function category()
|
||||
{
|
||||
return $this->hasOne('App\Models\Shop\PriceGenericCategory','id','category_id');
|
||||
}
|
||||
|
||||
public function prices()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\PriceGenericValue','price_generic_id')->whereNotNull('price_generic_id');
|
||||
}
|
||||
|
||||
public function priceByUnit()
|
||||
{
|
||||
return $this->hasOne('App\Models\Shop\PriceGenericValue')->orderBy('quantity','asc');
|
||||
}
|
||||
|
||||
public function articles()
|
||||
{
|
||||
return $this->hasManyThrough('App\Models\Shop\Article','App\Models\Shop\Price');
|
||||
}
|
||||
|
||||
public function scopeByCategory($query, $id)
|
||||
{
|
||||
return $query->where('category_id', $id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,18 +6,16 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PriceGenericCategory extends Model
|
||||
{
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_price_generic_categories';
|
||||
|
||||
public function article_family()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleFamily');
|
||||
return $this->belongsTo('App\Models\Shop\ArticleNature');
|
||||
}
|
||||
|
||||
public function price_generics()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\PriceGeneric','category_id');
|
||||
return $this->hasMany('App\Models\Shop\PriceGeneric', 'category_id');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Znck\Eloquent\Traits\BelongsToThrough;
|
||||
|
||||
class PriceGenericValue extends Model
|
||||
{
|
||||
use BelongsToThrough;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_price_generic_values';
|
||||
|
||||
public function price_generic()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\PriceGeneric');
|
||||
}
|
||||
|
||||
public function scopeByPriceGeneric($query, $id)
|
||||
{
|
||||
return $query->where('price_generic_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByQuantity($query, $quantity)
|
||||
{
|
||||
return $query->orderBy('quantity', 'desc')->where('quantity', '<', $quantity)->first();
|
||||
}
|
||||
|
||||
}
|
||||
29
app/Models/Shop/PriceList.php
Normal file
29
app/Models/Shop/PriceList.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Znck\Eloquent\Traits\BelongsToThrough;
|
||||
|
||||
class PriceList extends Model
|
||||
{
|
||||
use BelongsToThrough;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_price_lists';
|
||||
|
||||
public function tariff()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Tariff');
|
||||
}
|
||||
|
||||
public function sale_channel()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\SaleChannel');
|
||||
}
|
||||
|
||||
public function price_list_values()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\PriceListValue');
|
||||
}
|
||||
}
|
||||
32
app/Models/Shop/PriceListValue.php
Normal file
32
app/Models/Shop/PriceListValue.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Wildside\Userstamps\Userstamps;
|
||||
use Znck\Eloquent\Traits\BelongsToThrough;
|
||||
|
||||
class PriceListValue extends Model
|
||||
{
|
||||
use BelongsToThrough, SoftDeletes, Userstamps;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_price_list_values';
|
||||
|
||||
public function price_list()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\PriceList');
|
||||
}
|
||||
|
||||
public function scopeByPriceList($query, $id)
|
||||
{
|
||||
return $query->where('price_list_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByQuantity($query, $quantity)
|
||||
{
|
||||
return $query->orderBy('quantity', 'desc')->where('quantity', '<', $quantity)->first();
|
||||
}
|
||||
}
|
||||
11
app/Models/Shop/SaleChannel.php
Normal file
11
app/Models/Shop/SaleChannel.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SaleChannel extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_sale_channels';
|
||||
}
|
||||
29
app/Models/Shop/Shelve.php
Normal file
29
app/Models/Shop/Shelve.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
|
||||
class ArticleNature extends Model
|
||||
{
|
||||
use HasRelationships;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_article_families';
|
||||
|
||||
public function articles()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Article');
|
||||
}
|
||||
|
||||
public function prices()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Price');
|
||||
}
|
||||
|
||||
public function packages()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Package');
|
||||
}
|
||||
}
|
||||
@@ -6,21 +6,20 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Tag extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $guarded = ['id'];
|
||||
|
||||
public function group()
|
||||
{
|
||||
return $this->hasOne('App\Models\Shop\TagGroup','id','tag_group_id');
|
||||
}
|
||||
public function group()
|
||||
{
|
||||
return $this->hasOne('App\Models\Shop\TagGroup', 'id', 'tag_group_id');
|
||||
}
|
||||
|
||||
public function scopeByGroup($query, $id)
|
||||
{
|
||||
return $query->where('tag_group_id', $id);
|
||||
}
|
||||
|
||||
public function getNameAttribute($value)
|
||||
{
|
||||
return json_decode($value)->fr;
|
||||
}
|
||||
public function scopeByGroup($query, $id)
|
||||
{
|
||||
return $query->where('tag_group_id', $id);
|
||||
}
|
||||
|
||||
public function getNameAttribute($value)
|
||||
{
|
||||
return json_decode($value)->fr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,17 +6,17 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TagGroup extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'tag_groups';
|
||||
public $timestamps = false;
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'tag_groups';
|
||||
public $timestamps = false;
|
||||
|
||||
public function tags()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Tag');
|
||||
}
|
||||
public function tags()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Tag');
|
||||
}
|
||||
|
||||
public function article_family()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleFamily');
|
||||
}
|
||||
public function article_family()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleNature');
|
||||
}
|
||||
}
|
||||
|
||||
30
app/Models/Shop/Tariff.php
Normal file
30
app/Models/Shop/Tariff.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
|
||||
class Tariff extends Model
|
||||
{
|
||||
use HasRelationships;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_tariffs';
|
||||
|
||||
public function sale_channel()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\SaleChannel');
|
||||
}
|
||||
|
||||
public function tariff_unity()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\TariffUnity');
|
||||
}
|
||||
|
||||
public function price_lists()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\PriceList');
|
||||
}
|
||||
}
|
||||
16
app/Models/Shop/TariffUnity.php
Normal file
16
app/Models/Shop/TariffUnity.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TariffUnity extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_tariff_unities';
|
||||
|
||||
public function tariffs()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Tariff');
|
||||
}
|
||||
}
|
||||
@@ -6,12 +6,11 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Tax extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_taxes';
|
||||
|
||||
public function price()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\ArticlePrice','id','tax_id');
|
||||
return $this->hasMany('App\Models\Shop\ArticlePrice', 'id', 'tax_id');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,38 +9,41 @@ use Znck\Eloquent\Traits\BelongsToThrough;
|
||||
|
||||
class Unity extends Model
|
||||
{
|
||||
use BelongsToThrough, softDeletes;
|
||||
use BelongsToThrough, softDeletes;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_unities';
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_unities';
|
||||
|
||||
public function package()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Package');
|
||||
}
|
||||
public function package()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Package');
|
||||
}
|
||||
|
||||
public function article_family()
|
||||
{
|
||||
return $this->belongsToThrough('App\Models\Shop\ArticleFamily', 'App\Models\Shop\Package', null, '', ['App\Models\Shop\ArticleFamily' => 'article_family_id', 'App\Models\Shop\Package' => 'package_id']);
|
||||
}
|
||||
public function article_family()
|
||||
{
|
||||
return $this->belongsToThrough('App\Models\Shop\ArticleNature', 'App\Models\Shop\Package', null, '', ['App\Models\Shop\ArticleNature' => 'article_family_id', 'App\Models\Shop\Package' => 'package_id']);
|
||||
}
|
||||
|
||||
public function scopeByPackage($query, $id)
|
||||
{
|
||||
return $query->where('package_id', $id);
|
||||
}
|
||||
public function scopeByPackage($query, $id)
|
||||
{
|
||||
return $query->where('package_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByArticleFamily($query, $id)
|
||||
{
|
||||
return $query->whereHas('package', function ($query) use ($id) {
|
||||
$query->byArticleFamily($id);
|
||||
});
|
||||
}
|
||||
|
||||
public function scopeActive($query, $active = 1)
|
||||
{
|
||||
return $query->whereHas('third_party', function ($query) use ($active) {
|
||||
$query->active($active);
|
||||
});
|
||||
}
|
||||
public function scopeByArticleNature($query, $id)
|
||||
{
|
||||
return $query->whereHas(
|
||||
'package', function ($query) use ($id) {
|
||||
$query->byArticleNature($id);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public function scopeActive($query, $active = 1)
|
||||
{
|
||||
return $query->whereHas(
|
||||
'third_party', function ($query) use ($active) {
|
||||
$query->active($active);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
21
app/Models/Shop/Variation.php
Normal file
21
app/Models/Shop/Variation.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Variation extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_variations';
|
||||
|
||||
public function package()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Package');
|
||||
}
|
||||
|
||||
public function unity()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Unity');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user