[WIP] Setup of skeleton
This commit is contained in:
49
app/Models/Auth/Permission.php
Normal file
49
app/Models/Auth/Permission.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Auth;
|
||||
|
||||
use Laratrust\Models\LaratrustPermission;
|
||||
|
||||
/**
|
||||
*
|
||||
* @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
|
||||
{
|
||||
protected $connection = 'mysql';
|
||||
|
||||
public function application()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Application');
|
||||
}
|
||||
|
||||
public function application_module()
|
||||
{
|
||||
return $this->belongsTo('App\Models\ApplicationModule');
|
||||
}
|
||||
|
||||
public function getDisplayNameAttribute($value)
|
||||
{
|
||||
return __($value);
|
||||
}
|
||||
|
||||
public function getDescriptionAttribute($value)
|
||||
{
|
||||
return __($value);
|
||||
}
|
||||
}
|
||||
30
app/Models/Auth/PermissionRole.php
Normal file
30
app/Models/Auth/PermissionRole.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Auth;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PermissionRole extends Model
|
||||
{
|
||||
protected $table = 'permission_role';
|
||||
|
||||
public function permission()
|
||||
{
|
||||
return $this->belongsTo('App\Permission');
|
||||
}
|
||||
|
||||
public function role()
|
||||
{
|
||||
return $this->belongsTo('App\Role');
|
||||
}
|
||||
|
||||
public function scopeByPermission($query, $id)
|
||||
{
|
||||
return $query->where('permission_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByRole($query, $id)
|
||||
{
|
||||
return $query->where('role_id', $id);
|
||||
}
|
||||
}
|
||||
45
app/Models/Auth/PermissionUser.php
Normal file
45
app/Models/Auth/PermissionUser.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Auth;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PermissionUser extends Model
|
||||
{
|
||||
protected $table = 'permission_user';
|
||||
|
||||
public function permission()
|
||||
{
|
||||
return $this->belongsTo('App\Permission');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\User');
|
||||
}
|
||||
|
||||
public function team()
|
||||
{
|
||||
return $this->belongsTo('App\Team');
|
||||
}
|
||||
|
||||
public function scopeByUser($query, $id)
|
||||
{
|
||||
return $query->where('user_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByPermission($query, $id)
|
||||
{
|
||||
return $query->where('permission_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByUserType($query, $name)
|
||||
{
|
||||
return $query->where('user_type', $name);
|
||||
}
|
||||
|
||||
public function scopeByTeam($query, $id)
|
||||
{
|
||||
return $query->where('team_id', $id);
|
||||
}
|
||||
}
|
||||
45
app/Models/Auth/Role.php
Normal file
45
app/Models/Auth/Role.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Auth;
|
||||
|
||||
use Laratrust\Models\LaratrustRole;
|
||||
|
||||
/**
|
||||
*
|
||||
* @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
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
41
app/Models/Auth/RoleUser.php
Normal file
41
app/Models/Auth/RoleUser.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Auth;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RoleUser extends Model
|
||||
{
|
||||
protected $table = 'role_user';
|
||||
protected $connection = 'mysql';
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\User');
|
||||
}
|
||||
|
||||
public function team()
|
||||
{
|
||||
return $this->belongsTo('App\Team');
|
||||
}
|
||||
|
||||
public function scopeByUser($query, $id)
|
||||
{
|
||||
return $query->where('user_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByRole($query, $id)
|
||||
{
|
||||
return $query->where('role_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByUserType($query, $name)
|
||||
{
|
||||
return $query->where('user_type', $name);
|
||||
}
|
||||
|
||||
public function scopeByTeam($query, $id)
|
||||
{
|
||||
return $query->where('team_id', $id);
|
||||
}
|
||||
}
|
||||
35
app/Models/Auth/Team.php
Normal file
35
app/Models/Auth/Team.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Auth;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Laratrust\Models\LaratrustTeam;
|
||||
|
||||
class Team extends LaratrustTeam
|
||||
{
|
||||
use SoftDeletes;
|
||||
protected $connection = 'mysql';
|
||||
public $timestamps = false;
|
||||
|
||||
public function users()
|
||||
{
|
||||
return $this->hasMany('App\User');
|
||||
}
|
||||
|
||||
public function society()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Society');
|
||||
}
|
||||
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->where('active', 1);
|
||||
}
|
||||
|
||||
public function scopeBySociety($query, $id)
|
||||
{
|
||||
return $query->where('society_id', $id);
|
||||
}
|
||||
}
|
||||
31
app/Models/Auth/TeamUser.php
Normal file
31
app/Models/Auth/TeamUser.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TeamUser extends Model
|
||||
{
|
||||
protected $table = 'team_user';
|
||||
protected $connection = 'mysql';
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\User');
|
||||
}
|
||||
|
||||
public function team()
|
||||
{
|
||||
return $this->belongsTo('App\Team');
|
||||
}
|
||||
|
||||
public function scopeByUser($query, $id)
|
||||
{
|
||||
return $query->where('user_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByTeam($query, $id)
|
||||
{
|
||||
return $query->where('team_id', $id);
|
||||
}
|
||||
}
|
||||
42
app/Models/Modules/Application.php
Normal file
42
app/Models/Modules/Application.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Application extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
public $timestamps = false;
|
||||
|
||||
public function pages()
|
||||
{
|
||||
return $this->hasMany('App\Models\Modules\ApplicationPage');
|
||||
}
|
||||
|
||||
public function modules()
|
||||
{
|
||||
return $this->hasMany('App\Models\Modules\ApplicationModule');
|
||||
}
|
||||
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->where('active', 1);
|
||||
}
|
||||
|
||||
public function scopeVisible($query)
|
||||
{
|
||||
return $query->where('visible', 1);
|
||||
}
|
||||
|
||||
public function scopeBySlug($query, $slug)
|
||||
{
|
||||
return $query->where('slug', $slug);
|
||||
}
|
||||
|
||||
public function scopeByOrder($query)
|
||||
{
|
||||
return $query->sortBy('order');
|
||||
}
|
||||
}
|
||||
37
app/Models/Modules/ApplicationModule.php
Normal file
37
app/Models/Modules/ApplicationModule.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class ApplicationModule extends Model
|
||||
{
|
||||
protected $connection = 'system';
|
||||
protected $table = 'application_modules';
|
||||
public $timestamps = false;
|
||||
|
||||
public function application()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Modules\Application');
|
||||
}
|
||||
|
||||
public function permissions()
|
||||
{
|
||||
return $this->hasMany('App\Auth\Permission');
|
||||
}
|
||||
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->where('active', 1);
|
||||
}
|
||||
|
||||
public function scopeByApplication($query, $id)
|
||||
{
|
||||
return $query->where('application_id', $id);
|
||||
}
|
||||
|
||||
public function scopeBySlug($query, $slug)
|
||||
{
|
||||
return $query->where('slug', $slug);
|
||||
}
|
||||
}
|
||||
32
app/Models/Modules/ApplicationPage.php
Normal file
32
app/Models/Modules/ApplicationPage.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class ApplicationPage extends Model
|
||||
{
|
||||
protected $table = 'application_pages';
|
||||
public $timestamps = false;
|
||||
|
||||
public function application()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Modules\Application');
|
||||
}
|
||||
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->where('active', 1);
|
||||
}
|
||||
|
||||
public function scopeByApplication($query, $application_id)
|
||||
{
|
||||
return $query->where('application_id', $application_id);
|
||||
}
|
||||
|
||||
public function scopeBySlug($query, $slug)
|
||||
{
|
||||
return $query->where('slug', $slug);
|
||||
}
|
||||
}
|
||||
11
app/Models/Modules/Family.php
Normal file
11
app/Models/Modules/Family.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Modules;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Family extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
}
|
||||
11
app/Models/Modules/Species.php
Normal file
11
app/Models/Modules/Species.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Modules;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Species extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
}
|
||||
36
app/Models/PermissionCategory.php
Normal file
36
app/Models/PermissionCategory.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
|
||||
public function getDescriptionAttribute($value)
|
||||
{
|
||||
return __($value);
|
||||
}
|
||||
}
|
||||
34
app/Models/Shop/Customer.php
Normal file
34
app/Models/Shop/Customer.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Customer extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function Invoices()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Invoice');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function Orders()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Order');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function User()
|
||||
{
|
||||
return $this->belongsTo('App\User');
|
||||
}
|
||||
}
|
||||
18
app/Models/Shop/Inventory.php
Normal file
18
app/Models/Shop/Inventory.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Inventory extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function InventoryPlace()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\InventoryPlace');
|
||||
}
|
||||
}
|
||||
18
app/Models/Shop/InventoryPlace.php
Normal file
18
app/Models/Shop/InventoryPlace.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class InventoryPlace extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function Inventories()
|
||||
{
|
||||
return $this->hasMany('App\Models\Inventory');
|
||||
}
|
||||
}
|
||||
26
app/Models/Shop/Invoice.php
Normal file
26
app/Models/Shop/Invoice.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Invoice extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function InvoiceItems()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\InvoiceItem');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function Customer()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Customer');
|
||||
}
|
||||
}
|
||||
26
app/Models/Shop/InvoiceItem.php
Normal file
26
app/Models/Shop/InvoiceItem.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class InvoiceItem extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function Product()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Product');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function Invoice()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Invoice');
|
||||
}
|
||||
}
|
||||
26
app/Models/Shop/Order.php
Normal file
26
app/Models/Shop/Order.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Order extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function Customer()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Customer');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function Payments()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\OrderPayment');
|
||||
}
|
||||
}
|
||||
20
app/Models/Shop/OrderPayment.php
Normal file
20
app/Models/Shop/OrderPayment.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class OrderPayment extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function Order()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Order');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
50
app/Models/Shop/Product.php
Normal file
50
app/Models/Shop/Product.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Product extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function Inventories()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Inventory');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function Prices()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\ProductPrice');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function ProductAttributes()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\ProductAttribute');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function Categories()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\CategoryProduct');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function InvoiceItems()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\InvoiceItem');
|
||||
}
|
||||
}
|
||||
18
app/Models/Shop/ProductAttribute.php
Normal file
18
app/Models/Shop/ProductAttribute.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProductAttribute extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function Product()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Product');
|
||||
}
|
||||
}
|
||||
26
app/Models/Shop/ProductPrice.php
Normal file
26
app/Models/Shop/ProductPrice.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProductPrice extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function Product()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\Product');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function ProductAttribute()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ProductAttribute');
|
||||
}
|
||||
}
|
||||
19
app/Models/Shop/Section.php
Normal file
19
app/Models/Shop/Section.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Section extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function Products()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Product');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user