I have a question.
At UsersController class, store() and update() functions don't code to bcrypt password.
Instead, in User class of Model, setPasswordAttribute() function executes bcrypt.
I code bcypt password in store() function of class extends BaseController. The code is like below:
public function store(OriginalRequest $request)
{
try {
$data = $request->except($this->excludedRequestParams);
$class = OriginalClass::create($data);
$class->password = bcrypt($request->password);
flash(trans('Corals::messages.success.created', ['item' => $this->title_singular]))->success();
} catch (Exception $exception) {
log_exception($exception, Instructor::class, 'store');
}
return redirectTo($this->resource_url);
}
But password is stored as raw string into database.
Even if I code bcyrpt password at store() function, is password stored as raw string in Laraship?
Or simply is my above code or my way wrong?
I fixed this problem.
This is why OriginalClass::create($data) is executed, data is stored into table.
But as a tip, please let me ask.
In User class of Model, how and when is setPasswordAttribute() called?