You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.4 KiB
61 lines
1.4 KiB
<?php |
|
|
|
namespace App\Models; |
|
|
|
use App\Models\Peti; |
|
use App\Traits\UUID; |
|
use Illuminate\Database\Eloquent\Model; |
|
use Illuminate\Database\Eloquent\SoftDeletes; |
|
use Illuminate\Database\Eloquent\Factories\HasFactory; |
|
|
|
class Transfer extends Model |
|
{ |
|
use HasFactory, SoftDeletes; |
|
protected $table = 'transfers'; |
|
|
|
protected $fillable = [ |
|
'mobile_id', |
|
'peti_id', |
|
'source_warehouse', |
|
'destination_warehouse', |
|
'name_customer', |
|
'date', |
|
'created_by', |
|
'updated_by', |
|
]; |
|
|
|
public function peti() |
|
{ |
|
return $this->belongsTo(Peti::class, 'peti_id')->select( |
|
'id', |
|
'tipe_peti_id', |
|
'customer_id', |
|
'warehouse_id', |
|
'date_pembuatan', |
|
'kondisipeti_id', |
|
'fix_lot', |
|
'updated_by', |
|
)->withTrashed(); |
|
} |
|
public function customer() |
|
{ |
|
return $this->belongsTo(Customer::class, 'name_customer')->select( |
|
'name', |
|
'code_customer', |
|
)->withTrashed(); |
|
} |
|
public function sourceWarehouse() |
|
{ |
|
return $this->belongsTo(m_warehouse::class, 'source_warehouse')->select( |
|
'name', |
|
'address', |
|
)->withTrashed(); |
|
} |
|
public function destinationWarehouse() |
|
{ |
|
return $this->belongsTo(m_warehouse::class, 'destination_warehouse')->select( |
|
'name', |
|
'address', |
|
)->withTrashed(); |
|
} |
|
}
|
|
|