Completed
Push — master ( dd0ca4...f00659 )
by Julien
03:18
created
app/Http/Controllers/AdministratorsController.php 4 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use App\Http\Models\Administrators;
6 6
 use App\Http\Requests\AdministratorsRequest;
7
-use Illuminate\Http\Request;
8 7
 use Illuminate\Support\Facades\Auth;
9 8
 use Illuminate\Support\Facades\Redirect;
10 9
 use Illuminate\Support\Facades\Session;
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
 
91 91
         $administrator->save();
92 92
 
93
-       // Auth::login($administrator); => Autologin
93
+        // Auth::login($administrator); => Autologin
94 94
         Session::flash('success', "L'administrateur {$administrator->email} a bien été crée");
95 95
         return Redirect::route('administrators_index');
96 96
 
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -12,15 +12,15 @@  discard block
 block discarded – undo
12 12
 /**
13 13
  * Class AdministratorsController
14 14
  */
15
-class AdministratorsController extends Controller{
15
+class AdministratorsController extends Controller {
16 16
 
17 17
     /**
18 18
      * Page de liste des administrateurs
19 19
      */
20
-    public function index(){
20
+    public function index() {
21 21
         $administrators = Administrators::all();
22 22
 
23
-        return view('Administrators/index',[
23
+        return view('Administrators/index', [
24 24
             'administrators' => $administrators
25 25
         ]);
26 26
     }
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
      * @param $id
32 32
      * @return mixed
33 33
      */
34
-    public function remove($id){
34
+    public function remove($id) {
35 35
 
36 36
         // To load an administrator
37 37
         $administrator = Administrators::find($id);
38 38
 
39
-        if($administrator){
39
+        if ($administrator) {
40 40
             Session::flash('success', "L'administrateur {$administrator->email} a bien été supprimé");
41 41
             $administrator->delete();
42 42
         }
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      * @param $id
52 52
      * @return mixed
53 53
      */
54
-    public function create(){
54
+    public function create() {
55 55
 
56 56
         return view('Administrators/create');
57 57
     }
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
      * @param $id
61 61
      * @return mixed
62 62
      */
63
-    public function store(AdministratorsRequest $request, $id = null){
63
+    public function store(AdministratorsRequest $request, $id = null) {
64 64
 
65 65
         //creation
66
-        if($id == null){
66
+        if ($id == null) {
67 67
             $administrator = new Administrators();
68
-        }else{
68
+        } else {
69 69
             $administrator = Administrators::find($id);
70 70
         }
71 71
 
@@ -74,18 +74,18 @@  discard block
 block discarded – undo
74 74
         $administrator->email = $request->email;
75 75
         $administrator->description = $request->description;
76 76
         $administrator->password = bcrypt($request->password); //if en mode edit
77
-        $administrator->super_admin =  $request->super_admin;
77
+        $administrator->super_admin = $request->super_admin;
78 78
         $administrator->expiration_date = new \DateTime('+1 year');
79 79
         $administrator->active = true;
80 80
 
81 81
         //upload
82 82
         $filename = "";
83
-        if($request->hasFile('image')) {
83
+        if ($request->hasFile('image')) {
84 84
             $file = $request->file('image');
85 85
             $filename = $file->getClientOriginalName(); // Récupère le nom original du fichier
86
-            $destinationPath = public_path() . '/uploads/administrators'; // Indique où stocker le fichier
86
+            $destinationPath = public_path().'/uploads/administrators'; // Indique où stocker le fichier
87 87
             $file->move($destinationPath, $filename); // Déplace le fichier
88
-            $administrator->photo = asset("uploads/administrators/". $filename);
88
+            $administrator->photo = asset("uploads/administrators/".$filename);
89 89
         }
90 90
 
91 91
         $administrator->save();
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      * @param $id
105 105
      * @return mixed
106 106
      */
107
-    public function edit($id){
107
+    public function edit($id) {
108 108
 
109 109
         $administrator = Administrators::find($id);
110 110
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
         //creation
66 66
         if($id == null){
67 67
             $administrator = new Administrators();
68
-        }else{
68
+        } else{
69 69
             $administrator = Administrators::find($id);
70 70
         }
71 71
 
Please login to merge, or discard this patch.
app/Http/Controllers/MoviesController.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -148,7 +148,6 @@
 block discarded – undo
148 148
 
149 149
     /**
150 150
      * Fonction de like des films, enregistré en session
151
-     * @param Request $request
152 151
      */
153 152
     public function like($id, $action)
154 153
     {
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -20,17 +20,17 @@  discard block
 block discarded – undo
20 20
  * Sufficé par le mot clef Controller
21 21
  * et doit hérité de la super classe Controller
22 22
  */
23
-class MoviesController extends Controller{
23
+class MoviesController extends Controller {
24 24
 
25 25
 
26 26
     /**
27 27
      * Page Acceuil
28 28
      */
29
-    public function index(){
29
+    public function index() {
30 30
 
31 31
         $movies = Movies::all();
32 32
 
33
-        return view('Movies/index',[
33
+        return view('Movies/index', [
34 34
                 'movies' => $movies
35 35
             ]
36 36
         );
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     /**
40 40
      * Page Create
41 41
      */
42
-    public function create(){
42
+    public function create() {
43 43
 
44 44
         $categories = Categories::all();
45 45
         $actors = Actors::all();
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
     /**
59 59
      * Page Read
60 60
      */
61
-    public function read($id){
61
+    public function read($id) {
62 62
 
63 63
         return view('Movies/read');
64 64
     }
65 65
     /**
66 66
      * Page Read
67 67
      */
68
-    public function edit($id){
68
+    public function edit($id) {
69 69
 
70 70
         $categories = Categories::all();
71 71
         $actors = Actors::all();
@@ -85,17 +85,17 @@  discard block
 block discarded – undo
85 85
      * Action qui va me permettre d'activer un film
86 86
      * @param $id
87 87
      */
88
-    public function activate($id){
88
+    public function activate($id) {
89 89
         $movie = Movies::find($id);
90 90
 
91
-        if($movie->visible == 0){
91
+        if ($movie->visible == 0) {
92 92
             $movie->visible = 1;
93
-            Session::flash("success","Le film {$movie->title} a bien été activé");
93
+            Session::flash("success", "Le film {$movie->title} a bien été activé");
94 94
 
95 95
         }
96
-        else{
96
+        else {
97 97
             $movie->visible = 0;
98
-            Session::flash("success","Le film {$movie->title} a bien été desactivé");
98
+            Session::flash("success", "Le film {$movie->title} a bien été desactivé");
99 99
         }
100 100
 
101 101
         $movie->save();
@@ -108,19 +108,19 @@  discard block
 block discarded – undo
108 108
      * Action qui va me permettre de metter en avant un film
109 109
      * @param $id
110 110
      */
111
-    public function cover($id){
111
+    public function cover($id) {
112 112
         // find() permet de retourner un Objet Movie
113 113
         // depuis son id
114 114
         $movie = Movies::find($id);
115 115
 
116
-        if($movie->cover == 0){
116
+        if ($movie->cover == 0) {
117 117
             $movie->cover = 1;
118
-            Session::flash("success","Le film {$movie->title} a bien été mis en avant");
118
+            Session::flash("success", "Le film {$movie->title} a bien été mis en avant");
119 119
 
120 120
         }
121
-        else{
121
+        else {
122 122
             $movie->cover = 0;
123
-            Session::flash("danger","Le film {$movie->title} a bien été retiré de l'avant");
123
+            Session::flash("danger", "Le film {$movie->title} a bien été retiré de l'avant");
124 124
         }
125 125
 
126 126
         $movie->save();
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
     /**
134 134
      * Suppresion
135 135
      */
136
-    public function delete($id){
136
+    public function delete($id) {
137 137
 
138 138
         $movie = Movies::find($id);
139 139
 
140
-        if($movie){
140
+        if ($movie) {
141 141
             Session::flash('success', "Le film {$movie->title} a bien été supprimé");
142 142
             $movie->delete();
143 143
         }
@@ -154,14 +154,14 @@  discard block
 block discarded – undo
154 154
     {
155 155
         $movie = Movies::find($id);
156 156
 
157
-        $likes = session("likes", []);
157
+        $likes = session("likes", [ ]);
158 158
 
159 159
         if ($action == "like") {
160 160
 
161
-            $likes[$id] = $movie->id;
161
+            $likes[ $id ] = $movie->id;
162 162
 
163
-        }else{
164
-            unset($likes[$id]);
163
+        } else {
164
+            unset($likes[ $id ]);
165 165
         }
166 166
         Session::put("likes", $likes);
167 167
         Session::flash('success', "Le film {$movie->title} a bien été liké");
@@ -175,9 +175,9 @@  discard block
 block discarded – undo
175 175
     /**
176 176
      * Store database
177 177
      */
178
-    public function store(MoviesRequest $request){
178
+    public function store(MoviesRequest $request) {
179 179
 
180
-        $dateoutput =  \DateTime::createFromFormat('d/m/Y',$request->date_release);
180
+        $dateoutput = \DateTime::createFromFormat('d/m/Y', $request->date_release);
181 181
         $movie = new Movies();
182 182
         $movie->type = $request->type;
183 183
         $movie->title = $request->title;
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
 
195 195
         $filename = "";
196 196
 
197
-        if($request->hasFile('image')) {
197
+        if ($request->hasFile('image')) {
198 198
             $file = $request->file('image');
199 199
             $filename = $file->getClientOriginalName(); // Récupère le nom original du fichier
200
-            $destinationPath = public_path() . '/uploads/movies'; // Indique où stocker le fichier
200
+            $destinationPath = public_path().'/uploads/movies'; // Indique où stocker le fichier
201 201
             $file->move($destinationPath, $filename); // Déplace le fichier
202 202
         }
203 203
 
204
-        $movie->image = asset("uploads/movies/". $filename);
204
+        $movie->image = asset("uploads/movies/".$filename);
205 205
         $movie->save();
206 206
 
207 207
         $actors = $request->actors;
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
             foreach ($actors as $actor) {
210 210
                 DB::table('actors_movies')
211 211
                     ->insert([
212
-                        ['movies_id' => $movie->id, 'actors_id' => $actor]
212
+                        [ 'movies_id' => $movie->id, 'actors_id' => $actor ]
213 213
                     ]);
214 214
             }
215 215
         }
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
             foreach ($directors as $director) {
220 220
                 DB::table('directors_movies')
221 221
                     ->insert([
222
-                        ['movies_id' => $movie->id, 'directors_id' => $director]
222
+                        [ 'movies_id' => $movie->id, 'directors_id' => $director ]
223 223
                     ]);
224 224
             }
225 225
         }
Please login to merge, or discard this patch.
Braces   +3 added lines, -5 removed lines patch added patch discarded remove patch
@@ -92,8 +92,7 @@  discard block
 block discarded – undo
92 92
             $movie->visible = 1;
93 93
             Session::flash("success","Le film {$movie->title} a bien été activé");
94 94
 
95
-        }
96
-        else{
95
+        } else{
97 96
             $movie->visible = 0;
98 97
             Session::flash("success","Le film {$movie->title} a bien été desactivé");
99 98
         }
@@ -117,8 +116,7 @@  discard block
 block discarded – undo
117 116
             $movie->cover = 1;
118 117
             Session::flash("success","Le film {$movie->title} a bien été mis en avant");
119 118
 
120
-        }
121
-        else{
119
+        } else{
122 120
             $movie->cover = 0;
123 121
             Session::flash("danger","Le film {$movie->title} a bien été retiré de l'avant");
124 122
         }
@@ -160,7 +158,7 @@  discard block
 block discarded – undo
160 158
 
161 159
             $likes[$id] = $movie->id;
162 160
 
163
-        }else{
161
+        } else{
164 162
             unset($likes[$id]);
165 163
         }
166 164
         Session::put("likes", $likes);
Please login to merge, or discard this patch.
app/Http/Models/Administrators.php 1 patch
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -3,12 +3,9 @@
 block discarded – undo
3 3
 namespace App\Http\Models;
4 4
 
5 5
 use Illuminate\Database\Eloquent\Model;
6
-
7
-
8 6
 use Illuminate\Auth\Authenticatable;
9 7
 use Illuminate\Foundation\Auth\Access\Authorizable;
10 8
 use Illuminate\Auth\Passwords\CanResetPassword;
11
-
12 9
 use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
13 10
 use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
14 11
 use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
Please login to merge, or discard this patch.
app/Http/Requests/AdministratorsRequest.php 3 patches
Unused Use Statements   -4 removed lines patch added patch discarded remove patch
@@ -2,11 +2,7 @@
 block discarded – undo
2 2
 
3 3
 namespace App\Http\Requests;
4 4
 
5
-use App\Http\Models\Administrators;
6 5
 use Illuminate\Foundation\Http\FormRequest;
7
-use Illuminate\Support\Facades\Auth;
8
-
9
-use Illuminate\Support\Facades\Request;
10 6
 
11 7
 /**
12 8
  * Class AdministratorsRequest
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         // get id since router
27 27
         $id = $this->route('id');
28 28
 
29
-        if($id == null) {
29
+        if ($id == null) {
30 30
             return [
31 31
                 'firstname' => 'required|max:255',
32 32
                 'lastname' => 'required|max:255',
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
                 'password' => 'required|confirmed|min:6',
36 36
                 'image' => 'required|image',
37 37
             ];
38
-        }else{
38
+        } else {
39 39
             return [
40 40
                 'firstname' => 'required|max:255',
41 41
                 'lastname' => 'required|max:255',
42 42
                 'description' => 'required|min:10',
43
-                'email' => 'required|email|max:255|unique:administrators,email,' . $id,
43
+                'email' => 'required|email|max:255|unique:administrators,email,'.$id,
44 44
                 'password' => 'confirmed|min:6',
45 45
                 'image' => 'image',
46 46
             ];
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
                 'password' => 'required|confirmed|min:6',
36 36
                 'image' => 'required|image',
37 37
             ];
38
-        }else{
38
+        } else{
39 39
             return [
40 40
                 'firstname' => 'required|max:255',
41 41
                 'lastname' => 'required|max:255',
Please login to merge, or discard this patch.
app/Http/routes.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 /**
26 26
  * BackOffice
27 27
  */
28
-Route::group(['prefix' => 'admin', 'middleware' => 'auth'], function () {
28
+Route::group([ 'prefix' => 'admin', 'middleware' => 'auth' ], function() {
29 29
 
30 30
     /**
31 31
      * Pages Dashboard
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
     /**
41 41
      * COMMENTAIRES
42 42
      */
43
-    Route::group(['prefix' => 'comments'], function () {
44
-        Route::get('/index', ['uses' => 'CommentsController@index','as' => 'comments.index']);
45
-        Route::post('{id}/update', ['uses' => 'CommentsController@update','as' => 'comments.update']);
43
+    Route::group([ 'prefix' => 'comments' ], function() {
44
+        Route::get('/index', [ 'uses' => 'CommentsController@index', 'as' => 'comments.index' ]);
45
+        Route::post('{id}/update', [ 'uses' => 'CommentsController@update', 'as' => 'comments.update' ]);
46 46
 
47 47
     });
48 48
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     /**
51 51
      * CRUD de Movies
52 52
      */
53
-    Route::group(['prefix' => 'movies'], function () {
53
+    Route::group([ 'prefix' => 'movies' ], function() {
54 54
 
55 55
         /**
56 56
          * Page index: liste des films
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
 
138 138
 // CRUD de categories
139
-    Route::group(['prefix' => 'categories'], function () {
139
+    Route::group([ 'prefix' => 'categories' ], function() {
140 140
 
141 141
         Route::get('/index', [
142 142
             'as' => 'categories_index',
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 
188 188
 
189 189
 // CRUD de actors
190
-    Route::group(['prefix' => 'actors'], function () {
190
+    Route::group([ 'prefix' => 'actors' ], function() {
191 191
 
192 192
         Route::get('/index', [
193 193
             'as' => 'actors_index',
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 
216 216
 
217 217
 // CRUD de directors
218
-    Route::group(['prefix' => 'directors'], function () {
218
+    Route::group([ 'prefix' => 'directors' ], function() {
219 219
 
220 220
         Route::get('/index', [
221 221
             'as' => 'directors_delete',
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 
244 244
 
245 245
     // CRUD de administrators
246
-    Route::group(['prefix' => "administrators",    "middleware" => "authorisation"], function () {
246
+    Route::group([ 'prefix' => "administrators", "middleware" => "authorisation" ], function() {
247 247
 
248 248
         Route::get('/index', [
249 249
             'as' => 'administrators_index',
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 /**
296 296
  * Page FAQ
297 297
  */
298
-Route::get('/faq', function () {
298
+Route::get('/faq', function() {
299 299
 
300 300
     return view('Pages/faq');
301 301
 });
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 /**
305 305
  * Page about
306 306
  */
307
-Route::get('/about', function () {
307
+Route::get('/about', function() {
308 308
 
309 309
     // retourne le nom de la vue
310 310
     return view('Pages/about');
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 /**
315 315
  * Pages concept
316 316
  */
317
-Route::get('/concept', function () {
317
+Route::get('/concept', function() {
318 318
 
319 319
     // retourne le nom de la vue
320 320
     return view('Pages/concept');
Please login to merge, or discard this patch.
app/Policies/SuperAdminPolicy.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
      */
21 21
     public function isSuperAdmin(Administrators $administrator)
22 22
     {
23
-        if($administrator->super_admin == true){
23
+        if ($administrator->super_admin == true) {
24 24
             return true;
25
-        }else{
25
+        } else {
26 26
             return false;
27 27
         }
28 28
     }
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
     {
37 37
 
38 38
         // si j'ai expiration au niveau des date d'expiratio n
39
-        if($administrator->expiration_date > date('Y-m-d')){
39
+        if ($administrator->expiration_date > date('Y-m-d')) {
40 40
             return true;
41
-        }else{
41
+        } else {
42 42
             return false;
43 43
         }
44 44
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     {
23 23
         if($administrator->super_admin == true){
24 24
             return true;
25
-        }else{
25
+        } else{
26 26
             return false;
27 27
         }
28 28
     }
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         // si j'ai expiration au niveau des date d'expiratio n
39 39
         if($administrator->expiration_date > date('Y-m-d')){
40 40
             return true;
41
-        }else{
41
+        } else{
42 42
             return false;
43 43
         }
44 44
     }
Please login to merge, or discard this patch.