Laravel 10 full course for beginner - accessor mutator

  Рет қаралды 14,901

Bitfumes

Bitfumes

Күн бұрын

Пікірлер: 25
@anselmdike2817
@anselmdike2817 Жыл бұрын
Pls continue the tutorial to building project .. thanks so much
@Bitfumes
@Bitfumes Жыл бұрын
Yes we will work on a project
@msi1097
@msi1097 11 ай бұрын
what extension di you use?
@thierryyolepiot9951
@thierryyolepiot9951 Жыл бұрын
When trying the mutator (protected function password from 4:27, i.e protected function password(): Attribute { return Attribute::make( set: fn ($value) => bcrypt($value) ); } it doesn't work. But when I used instead: public function setPasswordAttribute($value) { $this->attributes['password'] = bcrypt($value); } it worked fine. Please, check on this and if you have time, please explain why the protected password function (mutator) did not work and why instead the public function setPasswordAttribute worked
@thierryyolepiot9951
@thierryyolepiot9951 Жыл бұрын
The same problem happens with the accessor... Please help!!! I might have missed something
@mustafahassan9383
@mustafahassan9383 Жыл бұрын
I think its because the version you have . This is new Syntax introduced in Laravel 9 and above
@paulcalebayibaemiotokolo
@paulcalebayibaemiotokolo Жыл бұрын
@@thierryyolepiot9951 ask chatgpt
@MoHaridy98
@MoHaridy98 Жыл бұрын
you should import "use Illuminate\Database\Eloquent\Casts\Attribute;"
@jungkyuuut_tv
@jungkyuuut_tv Жыл бұрын
just import this on your usermodel woahla~! use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Model;
@justinemanalo707
@justinemanalo707 9 ай бұрын
Good day, im using the latest version of laravel, and it seems to be encrypted once you use sa user class. theres this array included protected $casts = [ 'email_verified_at' => 'datetime', 'password' => 'hashed', ]; im just new to laravel development. and your tutorial helped me a lot, thank you so much
@gromhellscream5581
@gromhellscream5581 9 ай бұрын
Very helpful!
@lasithadulshan7357
@lasithadulshan7357 Жыл бұрын
Thank you
@Bitfumes
@Bitfumes Жыл бұрын
You're welcome
@sicelomgobhozi4602
@sicelomgobhozi4602 Жыл бұрын
Thank you for this tutorial.
@aguud
@aguud 11 ай бұрын
you are awesome
@gsm-jw5qf
@gsm-jw5qf Жыл бұрын
my password auto encrypted when I comment this function " protected function password (): Attribute" from the User.php file. but only first two methods raw SQL work when I used this method then password is not encrypted automatically.
@RaefetOuafiqo
@RaefetOuafiqo Жыл бұрын
did you know why this is happening ?
@charbelsawma8519
@charbelsawma8519 Жыл бұрын
I’m not sure if this is because of an update in Laravel, but when you open the User.php model, under protected $casts, there is ‘password’ => ‘hashed’ and this automatically encrypted the password without doing anything
@RaefetOuafiqo
@RaefetOuafiqo Жыл бұрын
@@charbelsawma8519 yep using User class encrypts the password by default, i tried to reverse the operation by making the set method to not hash the pass and it worked
@gsm-jw5qf
@gsm-jw5qf Жыл бұрын
still not found the solution. Maybe laravel change their system. @@RaefetOuafiqo
@jungkyuuut_tv
@jungkyuuut_tv Жыл бұрын
paste this to your User model thanks me later use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Model;
Laravel 10 full course for beginner -  config and cache
8:30
Bitfumes
Рет қаралды 11 М.
Laravel 10 full course for beginner -   user avatar and tinker
12:39
Family Love #funny #sigma
00:16
CRAZY GREAPA
Рет қаралды 38 МЛН
КОГДА К БАТЕ ПРИШЕЛ ДРУГ😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 7 МЛН
小路飞还不知道他把路飞给擦没有了 #路飞#海贼王
00:32
路飞与唐舞桐
Рет қаралды 70 МЛН
The New Way to Define Eloquent Accessors and Mutators
8:38
Laracasts
Рет қаралды 4,5 М.
Laravel 10 full course for beginner -  running raw sql queries
13:08
Laravel 10 full course for beginner -  what is eloquent orm
11:05
Eloquent Accessors: Dates, Casts, and "Wrong Way"
5:56
Laravel Daily
Рет қаралды 9 М.
Laravel 10 full course for beginner -  form request data
17:53
Laravel 10 full course for beginner -  avatar form and routes
10:26
Are we going back to PHP with fullstack JavaScript?
9:57
Maximilian Schwarzmüller
Рет қаралды 150 М.