belongsTo('App\User')->select(['id', 'name']); } public function getDateAttribute() { $carbon = new Carbon($this->attributes['date']); return $carbon; } public function setDateAttribute($value) { $carbon = new Carbon(); $date = substr($value, 0, -3); $date = $carbon->timestamp($date)->timezone('Asia/Tehran')->toDateString(); $this->attributes['date'] = $date; } public function setPropertyAttribute($value){ $this->attributes['property'] = json_encode($value); } public function getPropertyAttribute(){ return json_decode($this->attributes['property']); } public function setUserIdAttribute(){ $this->attributes['user_id'] = auth()->user()->id; } }