I have created mutator date function in model to convert the created_at date into human readable time using diffForHumans(). I have done the following
public function setDateAttribute($value){
return \Carbon\Carbon::parse($value)->diffForHumans();
}
It works fine but it affects in all. it is possible to apply this mutator only on the specified function of the controller rather than all function
public function getLeadProductDateAttribute($value){ return \Carbon\Carbon::parse($value)->diffForHumans(); }
this is my mutator function. it is call automatically. but i want to call that function on specific controller function - khandar shailesh