I would like to add a prefix in username column which is directly coming from HTTP request. My controller function is like below:
public function myFunc(Request $request){
$prefix = $request->get("prefix");
$users = User::all(); //need to change
}
My User Model :
public function getFullNameAttribute()
{
$full_name = $this->name . ' (' . $this->company_name . ')';
return $full_name;
}
How can I pass the $prefix in my accessor?
public function getFullNameAttribute()
{
$full_name = $prefix."- ".$this->name . ' (' . $this->company_name . ')';
return $full_name;
}