Originally posted @ https://codeanddeploy.com visit and download the sample code: https://codeanddeploy.com/blog/laravel/laravel-8-user-roles-and-permissions-step-by-step-tutorial In this post, I will share how to implement the ACL method Roles & Permissions on Laravel 8 with a step-by-step guide that will help you to understand the flow.
/** * Edit user data * * @param User $user * * @return \Illuminate\Http\Response */ public function edit(User $user) { return view('users.edit', [ 'user' => $user, 'userRole' => $user->roles->pluck('name')->toArray(), 'roles' => Role::latest()->get()]); }