'date', 'accepted_at' => 'datetime', 'meta' => 'array', 'views_count' => 'integer', 'total_price' => 'decimal:2', ]; protected static function boot() { parent::boot(); static::creating(function ($proposal) { if (empty($proposal->uuid)) { $proposal->uuid = (string) Str::uuid(); } if (empty($proposal->created_by) && auth()->check()) { $proposal->created_by = auth()->id(); } }); } /** * Get the user who created the proposal. */ public function creator() { return $this->belongsTo(User::class, 'created_by'); } /** * Get the public url for the proposal. */ public function getUrlAttribute() { return route('proposals.show', $this->slug); } }