59 lines
1.3 KiB
PHP
59 lines
1.3 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace Modules\Asset\Models;
|
||
|
|
||
|
use Illuminate\Database\Eloquent\Model;
|
||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||
|
use Modules\Asset\Database\factories\AssetFactory;
|
||
|
use Modules\Employee\Models\Employee;
|
||
|
|
||
|
class Asset extends Model
|
||
|
{
|
||
|
use HasFactory;
|
||
|
|
||
|
protected $table = 'tbl_assets';
|
||
|
protected $primaryKey = 'asset_id';
|
||
|
/**
|
||
|
* The attributes that are mass assignable.
|
||
|
*/
|
||
|
protected $fillable = [
|
||
|
'asset_category_id',
|
||
|
'name',
|
||
|
'purchased_date',
|
||
|
'purchased_from',
|
||
|
'manufacturer',
|
||
|
'model',
|
||
|
'serial_number',
|
||
|
'supplier',
|
||
|
'condition',
|
||
|
'warranty',
|
||
|
'value',
|
||
|
'asset_user',
|
||
|
'status',
|
||
|
'description',
|
||
|
'remarks',
|
||
|
'is_available',
|
||
|
'approved_date',
|
||
|
'approved_by',
|
||
|
'createdBy',
|
||
|
'updatedBy',
|
||
|
];
|
||
|
|
||
|
protected $casts = [
|
||
|
'is_available' => 'boolean',
|
||
|
];
|
||
|
|
||
|
public function assetCategory(){
|
||
|
return $this->belongsTo(AssetCategory::class,'asset_category_id');
|
||
|
}
|
||
|
|
||
|
public function employee(){
|
||
|
return $this->belongsTo(Employee::class,'asset_user');
|
||
|
}
|
||
|
|
||
|
public function approver(){
|
||
|
return $this->belongsTo(Employee::class,'approved_by');
|
||
|
}
|
||
|
|
||
|
}
|