@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | class Movies extends Model implements ItemInterface |
15 | 15 | { |
16 | - protected $fillable = ['title', 'description', 'categories_id']; |
|
16 | + protected $fillable = [ 'title', 'description', 'categories_id' ]; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Décrit le nom de la table |
@@ -36,13 +36,13 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function handle() |
38 | 38 | { |
39 | - $infos = \Thujohn\Twitter\Facades\Twitter::getUsersLookup(['screen_name' => 'Symfomany', 'format' => 'php']); |
|
39 | + $infos = \Thujohn\Twitter\Facades\Twitter::getUsersLookup([ 'screen_name' => 'Symfomany', 'format' => 'php' ]); |
|
40 | 40 | $manager = new \MongoDB\Driver\Manager("mongodb://localhost:27017"); |
41 | 41 | $collection = new \MongoDB\Collection($manager, "laravel.tweets"); |
42 | 42 | |
43 | 43 | if (!empty($infos)) { |
44 | 44 | |
45 | - $collection->deleteMany(['origin' => 'Twitter', 'type' => 'infos']); |
|
45 | + $collection->deleteMany([ 'origin' => 'Twitter', 'type' => 'infos' ]); |
|
46 | 46 | |
47 | 47 | $stat = [ |
48 | 48 | "origin" => "Twitter", |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | |
55 | 55 | } |
56 | 56 | |
57 | - $tweets = \Thujohn\Twitter\Facades\Twitter::getDmsOut(['format' => 'php']); |
|
57 | + $tweets = \Thujohn\Twitter\Facades\Twitter::getDmsOut([ 'format' => 'php' ]); |
|
58 | 58 | if (!empty($tweets)) { |
59 | - $collection->deleteMany(['origin' => 'Twitter', 'type' => 'dmsout']); |
|
59 | + $collection->deleteMany([ 'origin' => 'Twitter', 'type' => 'dmsout' ]); |
|
60 | 60 | |
61 | 61 | foreach ($tweets as $tweet) { |
62 | 62 | $stat = [ |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | - $tweets = \Thujohn\Twitter\Facades\Twitter::getFavorites(['format' => 'php']); |
|
72 | + $tweets = \Thujohn\Twitter\Facades\Twitter::getFavorites([ 'format' => 'php' ]); |
|
73 | 73 | if (!empty($tweets)) { |
74 | - $collection->deleteMany(['origin' => 'Twitter', 'type' => 'favorites']); |
|
74 | + $collection->deleteMany([ 'origin' => 'Twitter', 'type' => 'favorites' ]); |
|
75 | 75 | |
76 | 76 | foreach ($tweets as $tweet) { |
77 | 77 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | 'format' => 'php', ]); |
93 | 93 | |
94 | 94 | if (!empty($tweets)) { |
95 | - $collection->deleteMany(['origin' => 'Twitter', 'type' => 'mentionstimeline']); |
|
95 | + $collection->deleteMany([ 'origin' => 'Twitter', 'type' => 'mentionstimeline' ]); |
|
96 | 96 | |
97 | 97 | |
98 | 98 | foreach ($tweets as $tweet) { |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | ]); |
115 | 115 | |
116 | 116 | if (!empty($tweets)) { |
117 | - $collection->deleteMany(['origin' => 'Twitter', 'type' => 'hometimeline']); |
|
117 | + $collection->deleteMany([ 'origin' => 'Twitter', 'type' => 'hometimeline' ]); |
|
118 | 118 | |
119 | 119 | foreach ($tweets as $tweet) { |
120 | 120 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | ]); |
137 | 137 | |
138 | 138 | if (!empty($tweets)) { |
139 | - $collection->deleteMany(['origin' => 'Twitter', 'type' => 'usertimeline']); |
|
139 | + $collection->deleteMany([ 'origin' => 'Twitter', 'type' => 'usertimeline' ]); |
|
140 | 140 | |
141 | 141 | foreach ($tweets as $tweet) { |
142 | 142 |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | if (!empty($channel)) { |
49 | 49 | $manager = new \MongoDB\Driver\Manager("mongodb://localhost:27017"); |
50 | 50 | $collection = new \MongoDB\Collection($manager, "laravel.stats"); |
51 | - $collection->deleteMany([]); |
|
51 | + $collection->deleteMany([ ]); |
|
52 | 52 | |
53 | 53 | $collection = new \MongoDB\Collection($manager, "laravel.stats"); |
54 | 54 | $stat = [ |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | 'maxResults' => 30, |
68 | 68 | ]; |
69 | 69 | |
70 | - $videos = Yt::searchAdvanced($params, true)['results']; |
|
70 | + $videos = Yt::searchAdvanced($params, true)[ 'results' ]; |
|
71 | 71 | |
72 | 72 | if (!empty($videos)) { |
73 | 73 | $collection = new \MongoDB\Collection($manager, "laravel.videos"); |
74 | - $collection->deleteMany([]); |
|
74 | + $collection->deleteMany([ ]); |
|
75 | 75 | |
76 | 76 | foreach ($videos as $video) { |
77 | 77 | $collection = new \MongoDB\Collection($manager, "laravel.videos"); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | public function ajaxmovies(Request $request) |
37 | 37 | { |
38 | 38 | $validator = Validator::make( |
39 | - $request->all(), //request all : tous les elements de requetses |
|
39 | + $request->all(), //request all : tous les elements de requetses |
|
40 | 40 | [ |
41 | 41 | 'title' => 'required|min:10', |
42 | 42 | ], [ |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $executePayment = $payment->execute($paymentExecution, $this->_apiContext); |
78 | 78 | |
79 | 79 | // Clear the shopping cart, write to database, send notifications, etc. |
80 | - $request->session()->pull('likes', []); |
|
80 | + $request->session()->pull('likes', [ ]); |
|
81 | 81 | |
82 | 82 | return view('Main/index'); |
83 | 83 | } |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | $videos = collect($collection->find()->toArray())->shuffle(); |
98 | 98 | |
99 | 99 | $collection = new \MongoDB\Collection($manager, 'laravel', 'stats'); |
100 | - $youtubeinfo = collect($collection->find(['origin' => 'Youtube'])->toArray())->first(); |
|
100 | + $youtubeinfo = collect($collection->find([ 'origin' => 'Youtube' ])->toArray())->first(); |
|
101 | 101 | |
102 | 102 | $collection = new \MongoDB\Collection($manager, 'laravel', 'stats'); |
103 | - $tweeterinfo = collect($collection->find(['origin' => 'Twitter', 'type' => 'infos'])->toArray())->first(); |
|
103 | + $tweeterinfo = collect($collection->find([ 'origin' => 'Twitter', 'type' => 'infos' ])->toArray())->first(); |
|
104 | 104 | |
105 | 105 | $actor = new Actors(); // Je récpere mon modèle |
106 | 106 | $comment = new Comments(); // Je récpere mon modèle |
@@ -121,11 +121,11 @@ discard block |
||
121 | 121 | 'avgnotepresse' => $avgnotepresse->avgpress, |
122 | 122 | 'avgacteurs' => $avgacteurs->age, |
123 | 123 | 'videos' => $videos, |
124 | - 'video' => $videos[0], |
|
124 | + 'video' => $videos[ 0 ], |
|
125 | 125 | 'youtubeinfo' => $youtubeinfo->data, |
126 | - 'tweeterinfo' => $tweeterinfo['data'][0], |
|
126 | + 'tweeterinfo' => $tweeterinfo[ 'data' ][ 0 ], |
|
127 | 127 | 'youtubeinfodateupdated' => $youtubeinfo->created, |
128 | - 'tweeterinfodateupdated' => $tweeterinfo['created_at'], |
|
128 | + 'tweeterinfodateupdated' => $tweeterinfo[ 'created_at' ], |
|
129 | 129 | 'avghour' => $avghour->avghour, |
130 | 130 | 'nbacteurs' => $nbacteurs, |
131 | 131 | 'nbcommentaires' => $nbcommentaires, |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | public function __construct() |
65 | 65 | { |
66 | 66 | // application du middleware guest |
67 | - $this->middleware('guest', ['except' => 'logout']); |
|
67 | + $this->middleware('guest', [ 'except' => 'logout' ]); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | protected function create(array $data) |
94 | 94 | { |
95 | 95 | return Administrators::create([ |
96 | - 'name' => $data['name'], |
|
97 | - 'email' => $data['email'], |
|
98 | - 'password' => bcrypt($data['password']), |
|
96 | + 'name' => $data[ 'name' ], |
|
97 | + 'email' => $data[ 'email' ], |
|
98 | + 'password' => bcrypt($data[ 'password' ]), |
|
99 | 99 | ]); |
100 | 100 | } |
101 | 101 |
@@ -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'); |
@@ -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; |
@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | 'created' => new \DateTime("now"), |
35 | 35 | ]; |
36 | 36 | |
37 | - try{ |
|
37 | + try { |
|
38 | 38 | $collection->insertOne($stat); |
39 | - }catch (\Exception $e){ |
|
40 | - return response()->json(['state' => false]); |
|
39 | + } catch (\Exception $e) { |
|
40 | + return response()->json([ 'state' => false ]); |
|
41 | 41 | } |
42 | 42 | |
43 | - $data["email"] = $request->email; |
|
44 | - return response()->json(['data' => $data, 'state' => true]); |
|
43 | + $data[ "email" ] = $request->email; |
|
44 | + return response()->json([ 'data' => $data, 'state' => true ]); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -57,26 +57,26 @@ discard block |
||
57 | 57 | $collection = new \MongoDB\Collection($manager, 'builders', 'account'); |
58 | 58 | |
59 | 59 | |
60 | - if ($collection->count(["email" => $email]) == 0) { |
|
61 | - return response()->json(['data' => "User doesn't exist", 'state' => false]); |
|
60 | + if ($collection->count([ "email" => $email ]) == 0) { |
|
61 | + return response()->json([ 'data' => "User doesn't exist", 'state' => false ]); |
|
62 | 62 | } |
63 | 63 | |
64 | - $user = $collection->findOne(["email" => $email])->bsonSerialize(); |
|
64 | + $user = $collection->findOne([ "email" => $email ])->bsonSerialize(); |
|
65 | 65 | |
66 | - if(password_verify($password, $user->password) == false){ |
|
67 | - return response()->json(['data' => "Bad email or password", 'state' => false]); |
|
66 | + if (password_verify($password, $user->password) == false) { |
|
67 | + return response()->json([ 'data' => "Bad email or password", 'state' => false ]); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | $api = new Api($user); |
71 | 71 | Auth::login($api); |
72 | 72 | |
73 | - return response()->json(['data' => $user, 'state' => true]); |
|
73 | + return response()->json([ 'data' => $user, 'state' => true ]); |
|
74 | 74 | |
75 | 75 | } else { |
76 | - return response()->json(['data' => "Invalid parameters", 'state' => false]); |
|
76 | + return response()->json([ 'data' => "Invalid parameters", 'state' => false ]); |
|
77 | 77 | } |
78 | 78 | |
79 | - return response()->json(['data' => "Bad credentials", 'state' => false]); |
|
79 | + return response()->json([ 'data' => "Bad credentials", 'state' => false ]); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | |
89 | 89 | auth()->guard('api')->logout(); |
90 | 90 | |
91 | - return response()->json(['state' => true]); |
|
91 | + return response()->json([ 'state' => true ]); |
|
92 | 92 | |
93 | 93 | } else { |
94 | 94 | |
95 | - return response()->json(['state' => false]); |
|
95 | + return response()->json([ 'state' => false ]); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | } |
@@ -115,16 +115,16 @@ discard block |
||
115 | 115 | |
116 | 116 | if ($auth->attempt($credentials) && auth()->guard('user')->check()) { |
117 | 117 | |
118 | - return response()->json(['data' => auth()->guard('user')->user()->toArray(), 'state' => true]); |
|
118 | + return response()->json([ 'data' => auth()->guard('user')->user()->toArray(), 'state' => true ]); |
|
119 | 119 | } else { |
120 | - return response()->json(['data' => "Bad email or password", 'state' => false]); |
|
120 | + return response()->json([ 'data' => "Bad email or password", 'state' => false ]); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | } else { |
124 | - return response()->json(['data' => "Invalid parameters", 'state' => false]); |
|
124 | + return response()->json([ 'data' => "Invalid parameters", 'state' => false ]); |
|
125 | 125 | } |
126 | 126 | |
127 | - return response()->json(['data' => "Bad credentials", 'state' => false]); |
|
127 | + return response()->json([ 'data' => "Bad credentials", 'state' => false ]); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | |
138 | 138 | $result = $collection->find()->toArray(); |
139 | 139 | |
140 | - $tab = []; |
|
141 | - foreach($result as $one){ |
|
142 | - $tab[] = $one->bsonSerialize(); |
|
140 | + $tab = [ ]; |
|
141 | + foreach ($result as $one) { |
|
142 | + $tab[ ] = $one->bsonSerialize(); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | return response()->json($tab); |
@@ -166,14 +166,14 @@ discard block |
||
166 | 166 | 'created' => new \DateTime("now"), |
167 | 167 | ]; |
168 | 168 | |
169 | - try{ |
|
170 | - $collection->updateOne(["email" => $request->email], $stat); |
|
171 | - }catch (\Exception $e){ |
|
172 | - return response()->json(['state' => false]); |
|
169 | + try { |
|
170 | + $collection->updateOne([ "email" => $request->email ], $stat); |
|
171 | + } catch (\Exception $e) { |
|
172 | + return response()->json([ 'state' => false ]); |
|
173 | 173 | } |
174 | 174 | |
175 | - $data["email"] = $request->email; |
|
176 | - return response()->json(['data' => $data, 'state' => true]); |
|
175 | + $data[ "email" ] = $request->email; |
|
176 | + return response()->json([ 'data' => $data, 'state' => true ]); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | } |