Server IP : 66.29.132.124 / Your IP : 18.222.111.44 Web Server : LiteSpeed System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : wavevlvu ( 1524) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/wavevlvu/book24.ng/modules/User/Admin/ |
Upload File : |
<?php namespace Modules\User\Admin; use App\User; use Illuminate\Http\Request; use Modules\AdminController; use Spatie\Permission\Models\Permission; use Spatie\Permission\Models\Role; class PermissionController extends AdminController { public function __construct() { parent::__construct(); } public function index() { $this->checkPermission('permission_view'); $data = [ 'rows' => Permission::paginate(20) ]; return view('User::admin.permission.index', $data); } public function create(Request $request) { if (!empty($request->input())) { $row = new Permission($request->input()); if ($row->save()) { return redirect(route('user.admin.permission.index'))->with('success', __('Permission created')); } } else { $row = new Permission(); $row->fill([ 'status' => 'publish' ]); } $data = [ 'row' => $row ]; return view('User::admin.permission.detail', $data); } public function edit(Request $request, $id) { $this->checkPermission('permission_update'); $row = Permission::find($id); if (empty($row)) { return redirect(route('user.admin.permission.index')); } if (!empty($request->input())) { $row->fill($request->input()); if ($row->save()) { return redirect(route('user.admin.permission.index'))->with('success', __('Permission updated')); } } $data = [ 'row' => $row ]; return view('User::admin.permission.detail', $data); } }