|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
use Carbon\Carbon;
|
|
|
|
|
|
|
|
class RequestMaterial extends Model
|
|
|
|
{
|
|
|
|
protected $table = 'm_req_material', $guarded = ['id'];
|
|
|
|
|
|
|
|
const CREATED_AT = 'created_at';
|
|
|
|
const UPDATED_AT = 'updated_at';
|
|
|
|
|
|
|
|
protected $casts = [
|
|
|
|
'id' => 'integer',
|
|
|
|
'proyek_id' => 'integer',
|
|
|
|
'price' => 'float',
|
|
|
|
'qty' => 'float',
|
|
|
|
'qty_received' => 'float'
|
|
|
|
];
|
|
|
|
|
|
|
|
public function getRequiredDateAttribute($value)
|
|
|
|
{
|
|
|
|
return Carbon::createFromTimestamp(strtotime($value))
|
|
|
|
->timezone(env('APP_TIMEZONE'))
|
|
|
|
->toDateTimeString();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getFomDateAttribute($value)
|
|
|
|
{
|
|
|
|
return Carbon::createFromTimestamp(strtotime($value))
|
|
|
|
->timezone(env('APP_TIMEZONE'))
|
|
|
|
->toDateTimeString();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPrDateAttribute($value)
|
|
|
|
{
|
|
|
|
return Carbon::createFromTimestamp(strtotime($value))
|
|
|
|
->timezone(env('APP_TIMEZONE'))
|
|
|
|
->toDateTimeString();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPoDateAttribute($value)
|
|
|
|
{
|
|
|
|
return Carbon::createFromTimestamp(strtotime($value))
|
|
|
|
->timezone(env('APP_TIMEZONE'))
|
|
|
|
->toDateTimeString();
|
|
|
|
}
|
|
|
|
}
|