10-Apr-2023
.
Admin
Hello Friends,
In this blog, I will show you how to get model attribute without mutator in laravel application. We will talk about laravel model get attribute without mutator example. This tutorial will give you how to get attribute without mutator.
We will show get attribute without mutator in laravel application. In this example I will give you simple and easy way to get attribute without mutator in laravel application.
Here i will give you full example for how to get model attribute without mutator in laravel application. So let's see the bellow example:
In this example, i have a "User" model with following fields :
Define Method in Model
public function getOriginalValueAttribute($field)
{
return $this->attributes[$field];
}
Route::get('user', function (){
$user = \App\Models\User::find(1);
dd($user->getOriginal('name'));
});
It will help you....
#Laravel 8
#Laravel 7
#Laravel
#Laravel 6