1 | <?php |
||
2 | |||
3 | namespace jeremykenedy\LaravelRoles\App\Http\Controllers; |
||
4 | |||
5 | use App\Http\Controllers\Controller; |
||
6 | use Illuminate\Http\Request; |
||
7 | use jeremykenedy\LaravelRoles\App\Http\Requests\StorePermissionRequest; |
||
8 | use jeremykenedy\LaravelRoles\App\Http\Requests\UpdatePermissionRequest; |
||
9 | use jeremykenedy\LaravelRoles\App\Services\PermissionFormFields; |
||
10 | use jeremykenedy\LaravelRoles\Traits\RolesAndPermissionsHelpersTrait; |
||
11 | use jeremykenedy\LaravelRoles\Traits\RolesUsageAuthTrait; |
||
12 | |||
13 | class LaravelPermissionsController extends Controller |
||
14 | { |
||
15 | use RolesAndPermissionsHelpersTrait; |
||
16 | use RolesUsageAuthTrait; |
||
17 | |||
18 | /** |
||
19 | * Show the roles and Permissions dashboard. |
||
20 | * |
||
21 | * @return \Illuminate\Http\Response |
||
22 | */ |
||
23 | public function index() |
||
24 | { |
||
25 | $data = $this->getDashboardData(); |
||
26 | |||
27 | return view($data['view'], $data['data']); |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * Show the form for creating a new resource. |
||
32 | * |
||
33 | * @return \Illuminate\Http\Response |
||
34 | */ |
||
35 | public function create() |
||
36 | { |
||
37 | $service = new PermissionFormFields(); |
||
38 | $data = $service->handle(); |
||
0 ignored issues
–
show
|
|||
39 | |||
40 | return view('laravelroles::laravelroles.crud.permissions.create', $data); |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * Store a newly created permission in storage. |
||
45 | * |
||
46 | * @param \jeremykenedy\LaravelRoles\App\Http\Requests\StorePermissionRequest $request |
||
47 | * |
||
48 | * @return \Illuminate\Http\Response |
||
49 | */ |
||
50 | public function store(StorePermissionRequest $request) |
||
51 | { |
||
52 | $permissionData = $request->permissionFillData(); |
||
53 | $permission = $this->storeNewPermission($permissionData); |
||
54 | |||
55 | return redirect()->route('laravelroles::roles.index') |
||
56 | ->with('success', trans('laravelroles::laravelroles.flash-messages.permission-create', ['permission' => $permission->name])); |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * Display the specified resource. |
||
61 | * |
||
62 | * @param int $id |
||
63 | * |
||
64 | * @return \Illuminate\Http\Response |
||
65 | */ |
||
66 | public function show($id) |
||
67 | { |
||
68 | $data = $this->getPermissionItemData($id); |
||
69 | |||
70 | return view('laravelroles::laravelroles.crud.permissions.show', $data); |
||
71 | } |
||
72 | |||
73 | /** |
||
74 | * Edit the specified resource. |
||
75 | * |
||
76 | * @param int $id |
||
77 | * |
||
78 | * @return \Illuminate\Http\Response |
||
79 | */ |
||
80 | public function edit(Request $request, $id) |
||
81 | { |
||
82 | $service = new PermissionFormFields($id); |
||
83 | $data = $service->handle(); |
||
0 ignored issues
–
show
Are you sure the assignment to
$data is correct as $service->handle() targeting jeremykenedy\LaravelRole...ionFormFields::handle() seems to always return null.
This check looks for function or method calls that always return null and whose return value is assigned to a variable. class A
{
function getObject()
{
return null;
}
}
$a = new A();
$object = $a->getObject();
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.
Loading history...
|
|||
84 | |||
85 | return view('laravelroles::laravelroles.crud.permissions.edit', $data); |
||
86 | } |
||
87 | |||
88 | /** |
||
89 | * Update the specified resource in storage. |
||
90 | * |
||
91 | * @param \jeremykenedy\LaravelRoles\App\Http\Requests\UpdatePermissionRequest $request |
||
92 | * @param int $id |
||
93 | * |
||
94 | * @return \Illuminate\Http\Response |
||
95 | */ |
||
96 | public function update(UpdatePermissionRequest $request, $id) |
||
97 | { |
||
98 | $permissionData = $request->permissionFillData($id); |
||
99 | $permission = $this->updatePermission($id, $permissionData); |
||
100 | |||
101 | return redirect()->route('laravelroles::roles.index') |
||
102 | ->with('success', trans('laravelroles::laravelroles.flash-messages.permission-updated', ['permission' => $permission->name])); |
||
103 | } |
||
104 | |||
105 | /** |
||
106 | * Remove the specified resource from storage. |
||
107 | * |
||
108 | * @param int $id |
||
109 | * |
||
110 | * @return \Illuminate\Http\Response |
||
111 | */ |
||
112 | public function destroy($id) |
||
113 | { |
||
114 | $permission = $this->deletePermission($id); |
||
115 | |||
116 | return redirect(route('laravelroles::roles.index')) |
||
117 | ->with('success', trans('laravelroles::laravelroles.flash-messages.successDeletedItem', ['type' => 'Permission', 'item' => $permission->name])); |
||
118 | } |
||
119 | } |
||
120 |
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()
can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.