@@ -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; |
@@ -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 | } |
@@ -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); |