*/ protected $fillable = [ 'customer_id', 'name', 'project_number', 'description', 'start_date', 'end_date', ]; /** * The attributes that are appended with attribute getters. * * @var string[] */ protected $appends = [ 'start', 'end', ]; /** * Get the end_date attribute in local format. */ public function getStartAttribute(): string { return (is_null($this->start_date)) ? '' : Carbon::createFromFormat('Y-m-d', $this->start_date)->format('d.m.Y'); } /** * Get the end_date attribute in local format. */ public function getEndAttribute(): string { return (is_null($this->end_date)) ? '' : Carbon::createFromFormat('Y-m-d', $this->end_date)->format('d.m.Y'); } /** * Get the customer this project belongs to. */ public function customer(): BelongsTo { return $this->belongsTo(Customer::class); } }