first change
This commit is contained in:
90
Modules/User/app/Http/Controllers/PermissionController.php
Normal file
90
Modules/User/app/Http/Controllers/PermissionController.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\User\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\User\Services\PermissionService;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
|
||||
class PermissionController extends Controller
|
||||
{
|
||||
|
||||
private $permissionService;
|
||||
public function __construct(PermissionService $permissionService)
|
||||
{
|
||||
$this->permissionService = $permissionService;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
if (request()->ajax()) {
|
||||
$model = Permission::query()->latest();
|
||||
|
||||
return DataTables::eloquent($model)
|
||||
->addIndexColumn()
|
||||
->setRowClass('tableRow')
|
||||
->addColumn('action', 'user::permission.datatable.action')
|
||||
->rawColumns(['action'])
|
||||
->toJson();
|
||||
}
|
||||
|
||||
return view('user::permission.index', [
|
||||
'title' => 'Permission Lists',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(string $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit(Permission $permission)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, Permission $permission)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->permissionService->deletePermission($id);
|
||||
flash()->success("Permission has been deleted.");
|
||||
return response()->json(['status' => 200, 'message' => 'Permission has been deleted!'], 200);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user