dev-think-one /
laravel-myriad-data-store
| 1 | <?php |
||
| 2 | |||
| 3 | namespace MyriadDataStore\Models; |
||
| 4 | |||
| 5 | use Illuminate\Database\Eloquent\Model; |
||
| 6 | use Illuminate\Database\Eloquent\Relations\BelongsTo; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * @property \JsonFieldCast\Json\SimpleJsonField $details |
||
| 10 | */ |
||
| 11 | class MyriadOrderPackage extends Model |
||
| 12 | { |
||
| 13 | protected $guarded = []; |
||
| 14 | |||
| 15 | protected $casts = [ |
||
| 16 | 'details' => \JsonFieldCast\Casts\SimpleJsonField::class, |
||
| 17 | ]; |
||
| 18 | |||
| 19 | 3 | public function getTable(): string |
|
| 20 | { |
||
| 21 | 3 | return config('myriad-data-store.tables.order_packages'); |
|
| 22 | } |
||
| 23 | |||
| 24 | public function getNameAttribute(): string |
||
| 25 | { |
||
| 26 | return "Package for order {$this->order_id}"; |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 27 | } |
||
| 28 | |||
| 29 | public function order(): BelongsTo |
||
| 30 | { |
||
| 31 | return $this->belongsTo(MyriadOrder::class, 'order_id', 'id'); |
||
| 32 | } |
||
| 33 | |||
| 34 | public function title(): BelongsTo |
||
| 35 | { |
||
| 36 | return $this->belongsTo(MyriadTitle::class, 'title_id', 'id'); |
||
| 37 | } |
||
| 38 | |||
| 39 | public function type(): BelongsTo |
||
| 40 | { |
||
| 41 | return $this->belongsTo(MyriadOrderPackageType::class, 'order_package_type_id', 'id'); |
||
| 42 | } |
||
| 43 | } |
||
| 44 |