I got a model called Run which contains this method:
public function getNameAttribute($name){
if($name == 'Eendaags')
return $this->race_edition->race->name;
return $this->race_edition->race->name.' '.$name;
}
I need this setup for laravel administrator, since alot of runs will have the same name and the only difference is the race name. But in 1 place in the website i need to get the name only, without mutating. Is this possbile?
getNameRaceAttribute
function, intended to only be used by administrator, and set administrator to use the->name_race
field, then ->name would be as it normally is. There is no "Get Raw Attribute" function in eloquent. relevant code: github.com/laravel/framework/blob/master/src/Illuminate/…