Role management
The Pro theme allows you to add user roles. By default, the theme comes with Admin, Creator and Member roles. To access the role management example click the “Laravel Examples/Role Management” link in the left sidebar or add /laravel-examples/role-management
to the URL. Here you can add/edit new roles. To add a new role, click the “Add role” button. To edit an existing role, click The firs icon in last Actions section for selected row and you will be directed to a form which allows you to modify the name and description of a role.
The store used for role form is found in app/Http/Controllers/RoleController
.
You can find the functions for role form in resources/views/laravel-examples/role
folder.
Role Controller
public function store(Request $request)
{
$request->validate([
'name' => 'required|min:3|max:255',
'description' => 'required|min:3|max:255',
], [
'name.required' => 'Name is required',
'description.required' => 'Description is required',
]);
$role = Role::create([
'name' => $request->name,
'description' => $request->description,
]);
return redirect(route('role-management'))->with('success', 'New role added successfully.');
}