@@ -35,13 +35,13 @@ public function index(Request $request)
35
35
36
36
$ orderColumn = request ('order_column ' , 'created_at ' );
37
37
38
- if (!in_array ($ orderColumn , ['id ' , 'title ' , 'created_at ' ])) {
38
+ if (! in_array ($ orderColumn , ['id ' , 'title ' , 'created_at ' ])) {
39
39
$ orderColumn = 'created_at ' ;
40
40
}
41
41
42
42
$ orderDirection = request ('order_direction ' , 'desc ' );
43
43
44
- if (!in_array ($ orderDirection , ['asc ' , 'desc ' ])) {
44
+ if (! in_array ($ orderDirection , ['asc ' , 'desc ' ])) {
45
45
$ orderDirection = 'desc ' ;
46
46
}
47
47
@@ -72,7 +72,7 @@ public function index(Request $request)
72
72
->orWhere ('content ' , 'like ' , '% ' .request ('search_global ' ).'% ' );
73
73
});
74
74
})
75
- ->when (!auth ()->user ()->hasPermission ('Can Edit Articles ' ), function ($ query ) {
75
+ ->when (! auth ()->user ()->hasPermission ('Can Edit Articles ' ), function ($ query ) {
76
76
return $ query ->where ('user_id ' , auth ()->id ());
77
77
})
78
78
@@ -101,7 +101,7 @@ public function store(StorePostRequest $request)
101
101
102
102
public function show (ShowPostRequest $ request , Post $ post )
103
103
{
104
- if ($ post ->user_id !== auth ()->user ()->id && !auth ()->user ()->hasPermission ('Can View Articles ' )) {
104
+ if ($ post ->user_id !== auth ()->user ()->id && ! auth ()->user ()->hasPermission ('Can View Articles ' )) {
105
105
return response ()->json (['status ' => 405 , 'success ' => false , 'message ' => 'You can only edit your own posts ' ]);
106
106
} else {
107
107
return new PostResource ($ post );
@@ -110,7 +110,7 @@ public function show(ShowPostRequest $request, Post $post)
110
110
111
111
public function update (StorePostRequest $ request , Post $ post )
112
112
{
113
- if ($ post ->user_id !== auth ()->id () && !auth ()->user ()->hasPermission ('Can Edit Articles ' )) {
113
+ if ($ post ->user_id !== auth ()->id () && ! auth ()->user ()->hasPermission ('Can Edit Articles ' )) {
114
114
return response ()->json (['status ' => 405 , 'success ' => false , 'message ' => 'You can only edit your own posts ' ]);
115
115
} else {
116
116
$ post ->update ($ request ->validated ());
@@ -124,7 +124,7 @@ public function update(StorePostRequest $request, Post $post)
124
124
125
125
public function destroy (DeletePostRequest $ request , Post $ post )
126
126
{
127
- if ($ post ->user_id !== auth ()->id () && !auth ()->user ()->hasPermission ('delete.articles ' )) {
127
+ if ($ post ->user_id !== auth ()->id () && ! auth ()->user ()->hasPermission ('delete.articles ' )) {
128
128
return response ()->json ([
129
129
'status ' => 405 ,
130
130
'success ' => false ,
0 commit comments