- Added standard Laravel directory structure and configuration. - Included Svelte and Tailwind configuration for the admin interface. - Added core PHPUnit and testing scripts.
24 lines
700 B
PHP
24 lines
700 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin\Roles;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Role;
|
|
use App\Http\Requests\Admin\Roles\UpdateRoleRequest;
|
|
use App\Services\RoleService;
|
|
|
|
class RoleUpdateController extends Controller
|
|
{
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*/
|
|
public function __invoke(UpdateRoleRequest $request, Role $role, RoleService $roleService)
|
|
{
|
|
if ($roleService->update($role, $request->validated())) {
|
|
return redirect()->route('admin.roles.index')->with('status', 'Role updated successfully.');
|
|
}
|
|
|
|
return redirect()->back()->withInput()->withErrors(['The protected role cannot be edited.']);
|
|
}
|
|
}
|