@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | | kernel and includes session state, CSRF protection, and more. |
12 | 12 | | |
13 | 13 | */ |
14 | -Route::group(['middleware' => ['web']], function () { |
|
14 | +Route::group([ 'middleware' => [ 'web' ] ], function() { |
|
15 | 15 | |
16 | 16 | Route::auth(); |
17 | 17 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | /* |
29 | 29 | * Builders API for Android |
30 | 30 | */ |
31 | - Route::group(['prefix' => 'api'], function () { |
|
31 | + Route::group([ 'prefix' => 'api' ], function() { |
|
32 | 32 | |
33 | 33 | Route::post('/createaccount', [ |
34 | 34 | 'uses' => 'BuildersController@createAccount', |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | /* |
44 | 44 | * BackOffice |
45 | 45 | */ |
46 | - Route::group(['prefix' => 'admin', 'middleware' => 'auth'], function () { |
|
46 | + Route::group([ 'prefix' => 'admin', 'middleware' => 'auth' ], function() { |
|
47 | 47 | |
48 | 48 | /* |
49 | 49 | * Cart Payment |
50 | 50 | */ |
51 | - Route::group(['prefix' => 'cart'], function () { |
|
51 | + Route::group([ 'prefix' => 'cart' ], function() { |
|
52 | 52 | /* |
53 | 53 | * Pages Recapitulatif |
54 | 54 | */ |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | /* |
104 | 104 | * COMMENTAIRES |
105 | 105 | */ |
106 | - Route::group(['prefix' => 'comments'], function () { |
|
107 | - Route::get('/index', ['uses' => 'CommentsController@index', 'as' => 'comments.index']); |
|
108 | - Route::post('{id}/update', ['uses' => 'CommentsController@update', 'as' => 'comments.update']); |
|
106 | + Route::group([ 'prefix' => 'comments' ], function() { |
|
107 | + Route::get('/index', [ 'uses' => 'CommentsController@index', 'as' => 'comments.index' ]); |
|
108 | + Route::post('{id}/update', [ 'uses' => 'CommentsController@update', 'as' => 'comments.update' ]); |
|
109 | 109 | |
110 | 110 | /* |
111 | 111 | * Action Like |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | /* |
121 | 121 | * CRUD de Movies |
122 | 122 | */ |
123 | - Route::group(['prefix' => 'movies'], function () { |
|
123 | + Route::group([ 'prefix' => 'movies' ], function() { |
|
124 | 124 | |
125 | 125 | /* |
126 | 126 | * Page index: liste des films |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | }); |
198 | 198 | |
199 | 199 | // CRUD de categories |
200 | - Route::group(['prefix' => 'categories'], function () { |
|
200 | + Route::group([ 'prefix' => 'categories' ], function() { |
|
201 | 201 | |
202 | 202 | Route::get('/index', [ |
203 | 203 | 'as' => 'categories_index', |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | }); |
245 | 245 | |
246 | 246 | // CRUD de actors |
247 | - Route::group(['prefix' => 'actors'], function () { |
|
247 | + Route::group([ 'prefix' => 'actors' ], function() { |
|
248 | 248 | |
249 | 249 | Route::get('/index', [ |
250 | 250 | 'as' => 'actors_index', |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | }); |
270 | 270 | |
271 | 271 | // CRUD de directors |
272 | - Route::group(['prefix' => 'directors'], function () { |
|
272 | + Route::group([ 'prefix' => 'directors' ], function() { |
|
273 | 273 | |
274 | 274 | Route::get('/index', [ |
275 | 275 | 'as' => 'directors_delete', |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | |
294 | 294 | }); |
295 | 295 | |
296 | - Route::group(['prefix' => 'api'], function () { |
|
296 | + Route::group([ 'prefix' => 'api' ], function() { |
|
297 | 297 | |
298 | 298 | // mon retour en JSON de mes catégories |
299 | 299 | Route::get('/categories', [ |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | }); |
310 | 310 | |
311 | 311 | // CRUD de administrators |
312 | - Route::group(['prefix' => 'administrators', 'middleware' => 'authorisation'], function () { |
|
312 | + Route::group([ 'prefix' => 'administrators', 'middleware' => 'authorisation' ], function() { |
|
313 | 313 | |
314 | 314 | Route::get('/index', [ |
315 | 315 | 'as' => 'administrators_index', |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | /* |
358 | 358 | * Page FAQ |
359 | 359 | */ |
360 | - Route::get('/faq', function () { |
|
360 | + Route::get('/faq', function() { |
|
361 | 361 | |
362 | 362 | return view('Pages/faq'); |
363 | 363 | }); |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | /* |
366 | 366 | * Page about |
367 | 367 | */ |
368 | - Route::get('/about', function () { |
|
368 | + Route::get('/about', function() { |
|
369 | 369 | |
370 | 370 | // retourne le nom de la vue |
371 | 371 | return view('Pages/about'); |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | /* |
375 | 375 | * Pages concept |
376 | 376 | */ |
377 | - Route::get('/concept', function () { |
|
377 | + Route::get('/concept', function() { |
|
378 | 378 | |
379 | 379 | // retourne le nom de la vue |
380 | 380 | return view('Pages/concept'); |
@@ -16,11 +16,11 @@ discard block |
||
16 | 16 | public function createAccount(Request $request) |
17 | 17 | { |
18 | 18 | $data = [ |
19 | - "name" => $request->name, |
|
20 | - "cp" => $request->cp, |
|
21 | - "phone" => $request->phone, |
|
22 | - "sexe" => $request->sexe, |
|
23 | - "news" => $request->news, |
|
19 | + "name" => $request->name, |
|
20 | + "cp" => $request->cp, |
|
21 | + "phone" => $request->phone, |
|
22 | + "sexe" => $request->sexe, |
|
23 | + "news" => $request->news, |
|
24 | 24 | ]; |
25 | 25 | |
26 | 26 | $manager = new \MongoDB\Driver\Manager('mongodb://localhost:27017'); |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | public function updateAccount(Request $request) |
66 | 66 | { |
67 | 67 | $data = [ |
68 | - "name" => $request->name, |
|
69 | - "cp" => $request->cp, |
|
70 | - "phone" => $request->phone, |
|
71 | - "sexe" => $request->sexe, |
|
72 | - "news" => $request->news, |
|
68 | + "name" => $request->name, |
|
69 | + "cp" => $request->cp, |
|
70 | + "phone" => $request->phone, |
|
71 | + "sexe" => $request->sexe, |
|
72 | + "news" => $request->news, |
|
73 | 73 | ]; |
74 | 74 | |
75 | 75 | $manager = new \MongoDB\Driver\Manager('mongodb://localhost:27017'); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | try{ |
35 | 35 | $collection->insertOne($stat); |
36 | - }catch (\Exception $e){ |
|
36 | + } catch (\Exception $e){ |
|
37 | 37 | return response()->json(['state' => false]); |
38 | 38 | } |
39 | 39 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | try{ |
84 | 84 | $collection->updateOne(["email" => $request->email], $stat); |
85 | - }catch (\Exception $e){ |
|
85 | + } catch (\Exception $e){ |
|
86 | 86 | return response()->json(['state' => false]); |
87 | 87 | } |
88 | 88 |
@@ -4,7 +4,6 @@ |
||
4 | 4 | use App\Http\Models\Api; |
5 | 5 | use Illuminate\Http\Request; |
6 | 6 | use Illuminate\Support\Facades\Auth; |
7 | -use Illuminate\Support\Facades\Input; |
|
8 | 7 | |
9 | 8 | |
10 | 9 | /** |
@@ -35,14 +35,14 @@ discard block |
||
35 | 35 | 'created' => new \DateTime("now"), |
36 | 36 | ]; |
37 | 37 | |
38 | - try{ |
|
38 | + try { |
|
39 | 39 | $collection->insertOne($stat); |
40 | - }catch (\Exception $e){ |
|
41 | - return response()->json(['state' => false]); |
|
40 | + } catch (\Exception $e) { |
|
41 | + return response()->json([ 'state' => false ]); |
|
42 | 42 | } |
43 | 43 | |
44 | - $data["email"] = $request->email; |
|
45 | - return response()->json(['data' => $data, 'state' => true]); |
|
44 | + $data[ "email" ] = $request->email; |
|
45 | + return response()->json([ 'data' => $data, 'state' => true ]); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -58,26 +58,26 @@ discard block |
||
58 | 58 | $collection = new \MongoDB\Collection($manager, 'builders', 'account'); |
59 | 59 | |
60 | 60 | |
61 | - if ($collection->count(["email" => $email]) == 0) { |
|
62 | - return response()->json(['data' => "User doesn't exist", 'state' => false]); |
|
61 | + if ($collection->count([ "email" => $email ]) == 0) { |
|
62 | + return response()->json([ 'data' => "User doesn't exist", 'state' => false ]); |
|
63 | 63 | } |
64 | 64 | |
65 | - $user = $collection->findOne(["email" => $email])->bsonSerialize(); |
|
65 | + $user = $collection->findOne([ "email" => $email ])->bsonSerialize(); |
|
66 | 66 | |
67 | - if(password_verify($password, $user->password) == false){ |
|
68 | - return response()->json(['data' => "Bad email or password", 'state' => false]); |
|
67 | + if (password_verify($password, $user->password) == false) { |
|
68 | + return response()->json([ 'data' => "Bad email or password", 'state' => false ]); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | $api = new Api($user); |
72 | 72 | Auth::login($api); |
73 | 73 | |
74 | - return response()->json(['data' => $user, 'state' => true]); |
|
74 | + return response()->json([ 'data' => $user, 'state' => true ]); |
|
75 | 75 | |
76 | 76 | } else { |
77 | - return response()->json(['data' => "Invalid parameters", 'state' => false]); |
|
77 | + return response()->json([ 'data' => "Invalid parameters", 'state' => false ]); |
|
78 | 78 | } |
79 | 79 | |
80 | - return response()->json(['data' => "Bad credentials", 'state' => false]); |
|
80 | + return response()->json([ 'data' => "Bad credentials", 'state' => false ]); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -89,11 +89,11 @@ discard block |
||
89 | 89 | |
90 | 90 | Auth::logout(); |
91 | 91 | |
92 | - return response()->json(['state' => true]); |
|
92 | + return response()->json([ 'state' => true ]); |
|
93 | 93 | |
94 | 94 | } else { |
95 | 95 | |
96 | - return response()->json(['state' => false]); |
|
96 | + return response()->json([ 'state' => false ]); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | $items = LaraCart::getItems(); |
109 | 109 | |
110 | - return response()->json(['data' => $items, 'state' => true]); |
|
110 | + return response()->json([ 'data' => $items, 'state' => true ]); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | |
@@ -123,9 +123,9 @@ discard block |
||
123 | 123 | $prix = $request->prix; |
124 | 124 | $options = $request->options; |
125 | 125 | |
126 | - $item = LaraCart::add($id, $title, $quantity, $prix, ['size' => $options ]); |
|
126 | + $item = LaraCart::add($id, $title, $quantity, $prix, [ 'size' => $options ]); |
|
127 | 127 | |
128 | - return response()->json(['data' => $item, 'state' => true]); |
|
128 | + return response()->json([ 'data' => $item, 'state' => true ]); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | $items = LaraCart::getItems(); |
142 | 142 | |
143 | - return response()->json(['data' => $items, 'state' => true]); |
|
143 | + return response()->json([ 'data' => $items, 'state' => true ]); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | |
@@ -149,12 +149,12 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public function getTotalAnnouncesCart() |
151 | 151 | { |
152 | - $data['subtotal'] = LaraCart::subTotal($tax = false, $format = true, $withDiscount = true); |
|
153 | - $data['totaldiscount'] = LaraCart::totalDiscount($formatted = false); |
|
154 | - $data['taxtotal'] = LaraCart::taxTotal($formatted = false); |
|
155 | - $data['total'] = LaraCart::total($formatted = false, $withDiscount = true); |
|
152 | + $data[ 'subtotal' ] = LaraCart::subTotal($tax = false, $format = true, $withDiscount = true); |
|
153 | + $data[ 'totaldiscount' ] = LaraCart::totalDiscount($formatted = false); |
|
154 | + $data[ 'taxtotal' ] = LaraCart::taxTotal($formatted = false); |
|
155 | + $data[ 'total' ] = LaraCart::total($formatted = false, $withDiscount = true); |
|
156 | 156 | |
157 | - return response()->json(['data' => $data, 'state' => true]); |
|
157 | + return response()->json([ 'data' => $data, 'state' => true ]); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -177,16 +177,16 @@ discard block |
||
177 | 177 | |
178 | 178 | if ($auth->attempt($credentials) && auth()->guard('user')->check()) { |
179 | 179 | |
180 | - return response()->json(['data' => auth()->guard('user')->user()->toArray(), 'state' => true]); |
|
180 | + return response()->json([ 'data' => auth()->guard('user')->user()->toArray(), 'state' => true ]); |
|
181 | 181 | } else { |
182 | - return response()->json(['data' => "Bad email or password", 'state' => false]); |
|
182 | + return response()->json([ 'data' => "Bad email or password", 'state' => false ]); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | } else { |
186 | - return response()->json(['data' => "Invalid parameters", 'state' => false]); |
|
186 | + return response()->json([ 'data' => "Invalid parameters", 'state' => false ]); |
|
187 | 187 | } |
188 | 188 | |
189 | - return response()->json(['data' => "Bad credentials", 'state' => false]); |
|
189 | + return response()->json([ 'data' => "Bad credentials", 'state' => false ]); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | |
200 | 200 | $result = $collection->find()->toArray(); |
201 | 201 | |
202 | - $tab = []; |
|
203 | - foreach($result as $one){ |
|
204 | - $tab[] = $one->bsonSerialize(); |
|
202 | + $tab = [ ]; |
|
203 | + foreach ($result as $one) { |
|
204 | + $tab[ ] = $one->bsonSerialize(); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | return response()->json($tab); |
@@ -230,14 +230,14 @@ discard block |
||
230 | 230 | 'created' => new \DateTime("now"), |
231 | 231 | ]; |
232 | 232 | |
233 | - try{ |
|
234 | - $collection->updateOne(["email" => $request->email], $stat); |
|
235 | - }catch (\Exception $e){ |
|
236 | - return response()->json(['state' => false]); |
|
233 | + try { |
|
234 | + $collection->updateOne([ "email" => $request->email ], $stat); |
|
235 | + } catch (\Exception $e) { |
|
236 | + return response()->json([ 'state' => false ]); |
|
237 | 237 | } |
238 | 238 | |
239 | - $data["email"] = $request->email; |
|
240 | - return response()->json(['data' => $data, 'state' => true]); |
|
239 | + $data[ "email" ] = $request->email; |
|
240 | + return response()->json([ 'data' => $data, 'state' => true ]); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | /** |
28 | 28 | * @param array $user |
29 | 29 | */ |
30 | - public function __construct($user){ |
|
30 | + public function __construct($user) { |
|
31 | 31 | $this->user = $user; |
32 | 32 | $this->email = $user->email; |
33 | 33 | $this->password = $user->password; |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | class AdController extends Controller |
13 | 13 | { |
14 | 14 | |
15 | - public function adAnnounce(Request $request){ |
|
15 | + public function adAnnounce(Request $request) { |
|
16 | 16 | |
17 | 17 | $data = [ |
18 | 18 | "name" => $request->name, |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | ]; |
28 | 28 | |
29 | 29 | $file = null; |
30 | - $data["email"] = $request->email; |
|
30 | + $data[ "email" ] = $request->email; |
|
31 | 31 | |
32 | 32 | $input = array('image' => Input::file('image')); |
33 | 33 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | if ($validator->fails()) |
41 | 41 | { |
42 | - return response()->json(['data' => 'Fichier invalid', 'state' => false]); |
|
42 | + return response()->json([ 'data' => 'Fichier invalid', 'state' => false ]); |
|
43 | 43 | } else { |
44 | 44 | if ($request->hasFile('image')) { |
45 | 45 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $destinationPath = public_path().'/uploads/ad'; |
50 | 50 | $file->move($destinationPath, $filename); |
51 | 51 | |
52 | - $data['image'] = asset('uploads/ad/'.$filename); |
|
52 | + $data[ 'image' ] = asset('uploads/ad/'.$filename); |
|
53 | 53 | |
54 | 54 | $manager = new \MongoDB\Driver\Manager('mongodb://localhost:27017'); |
55 | 55 | $collection = new \MongoDB\Collection($manager, 'builders', 'ads'); |
@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | 'created' => new \DateTime("now"), |
60 | 60 | ]; |
61 | 61 | |
62 | - try{ |
|
62 | + try { |
|
63 | 63 | $collection->insertOne($stat); |
64 | - } catch (\Exception $e){ |
|
65 | - return response()->json(['state' => false]); |
|
64 | + } catch (\Exception $e) { |
|
65 | + return response()->json([ 'state' => false ]); |
|
66 | 66 | } |
67 | 67 | |
68 | - return response()->json(['data' => $data, 'state' => true]); |
|
68 | + return response()->json([ 'data' => $data, 'state' => true ]); |
|
69 | 69 | |
70 | 70 | } |
71 | 71 | } |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | |
86 | 86 | $result = $collection->find()->toArray(); |
87 | 87 | |
88 | - $tab = []; |
|
89 | - foreach($result as $one){ |
|
90 | - $tab[] = $one->bsonSerialize(); |
|
88 | + $tab = [ ]; |
|
89 | + foreach ($result as $one) { |
|
90 | + $tab[ ] = $one->bsonSerialize(); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | return response()->json($tab); |