'Laravel 8: Before editing a user I first want to check his role if he is an Admin I do a redirect::back otherwise I let him edit
En Laravel 8.
Solution 1:[1]
Use \Auth::user()->role to get role type and then if else
public function edit($id){
// other codes and logics
if(\Auth::user()->role === 'Admin'){
// let him edit
}
else {
// redirect back
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | mohit sah |
