migrate to gtea from bistbucket
This commit is contained in:
42
public/restaurant/Modules/Restaurant/app/Models/Unit.php
Normal file
42
public/restaurant/Modules/Restaurant/app/Models/Unit.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Unit extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'user_id',
|
||||
'name',
|
||||
'short_name',
|
||||
'type',
|
||||
'base_unit_id',
|
||||
'operator',
|
||||
'operator_value',
|
||||
'priority',
|
||||
'version',
|
||||
'is_default',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'units';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function baseUnit(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Unit::class, 'base_unit_id');
|
||||
}
|
||||
|
||||
public function childUnits(): HasMany
|
||||
{
|
||||
return $this->hasMany(Unit::class, 'base_unit_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user