@@ -30,7 +30,7 @@ |
||
| 30 | 30 | // should return either a User instance or null. You're free to obtain |
| 31 | 31 | // the User instance via an API token or any other method necessary. |
| 32 | 32 | |
| 33 | - $this->app['auth']->viaRequest('api', function ($request) { |
|
| 33 | + $this->app[ 'auth' ]->viaRequest('api', function($request) { |
|
| 34 | 34 | if ($request->input('api_token')) { |
| 35 | 35 | return User::where('api_token', $request->input('api_token'))->first(); |
| 36 | 36 | } |
@@ -7,12 +7,12 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | $api = app('Dingo\Api\Routing\Router'); |
| 10 | -$api->version('v1', function ($api) { |
|
| 10 | +$api->version('v1', function($api) { |
|
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * Welcome message. |
| 14 | 14 | */ |
| 15 | - $api->get('/', function () { |
|
| 15 | + $api->get('/', function() { |
|
| 16 | 16 | return 'LaCMS API'; |
| 17 | 17 | }); |
| 18 | 18 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | // 'middleware' => 'api:auth', // @todo |
| 24 | 24 | 'prefix' => 'images', |
| 25 | 25 | 'namespace' => 'App\Http\Controllers\Api\V1', |
| 26 | - ], function ($api) { |
|
| 26 | + ], function($api) { |
|
| 27 | 27 | $api->get('/', 'ImagesController@index'); |
| 28 | 28 | $api->post('/', 'ImagesController@store'); |
| 29 | 29 | $api->get('/{id}', 'ImagesController@show'); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | // 'middleware' => 'foo', |
| 41 | 41 | 'prefix' => 'posts', |
| 42 | 42 | 'namespace' => 'App\Http\Controllers\Api\V1', |
| 43 | - ], function ($api) { |
|
| 43 | + ], function($api) { |
|
| 44 | 44 | $api->get('/', 'PostsController@index'); |
| 45 | 45 | $api->post('/', 'PostsController@store'); |
| 46 | 46 | $api->get('/{id}', 'PostsController@show'); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | // 'middleware' => 'foo', |
| 60 | 60 | 'prefix' => 'authors', |
| 61 | 61 | 'namespace' => 'App\Http\Controllers\Api\V1', |
| 62 | - ], function ($api) { |
|
| 62 | + ], function($api) { |
|
| 63 | 63 | $api->get('/', 'AuthorsController@index'); |
| 64 | 64 | $api->post('/', 'AuthorsController@store'); |
| 65 | 65 | $api->get('/{id}', 'AuthorsController@show'); |
@@ -96,7 +96,7 @@ |
||
| 96 | 96 | |
| 97 | 97 | $app->router->group([ |
| 98 | 98 | 'namespace' => 'App\Http\Controllers', |
| 99 | -], function ($router) { |
|
| 99 | +], function($router) { |
|
| 100 | 100 | require __DIR__.'/../routes/web.php'; |
| 101 | 101 | }); |
| 102 | 102 | |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('authors', function (Blueprint $table) { |
|
| 16 | + Schema::create('authors', function(Blueprint $table) { |
|
| 17 | 17 | $table->increments('id'); |
| 18 | 18 | $table->string('first_name'); |
| 19 | 19 | $table->string('last_name'); |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('images', function (Blueprint $table) { |
|
| 16 | + Schema::create('images', function(Blueprint $table) { |
|
| 17 | 17 | $table->increments('id'); |
| 18 | 18 | $table->integer('post_id')->unsigned(); |
| 19 | 19 | $table->string('url'); |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('posts', function (Blueprint $table) { |
|
| 16 | + Schema::create('posts', function(Blueprint $table) { |
|
| 17 | 17 | $table->increments('id'); |
| 18 | 18 | $table->integer('author_id')->unsigned(); |
| 19 | 19 | $table->string('title'); |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | | |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -$factory->define(App\User::class, function (Faker\Generator $faker) { |
|
| 14 | +$factory->define(App\User::class, function(Faker\Generator $faker) { |
|
| 15 | 15 | return [ |
| 16 | 16 | 'name' => $faker->name, |
| 17 | 17 | 'email' => $faker->email, |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | public function index() |
| 26 | 26 | { |
| 27 | 27 | $posts = Redis::get('posts'); |
| 28 | - if (! $posts) { |
|
| 28 | + if (!$posts) { |
|
| 29 | 29 | $posts = Post::with('author')->get(); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | public function show($id) |
| 48 | 48 | { |
| 49 | 49 | $post = Redis::get('posts:'.$id); |
| 50 | - if (! $post) { |
|
| 50 | + if (!$post) { |
|
| 51 | 51 | $post = Post::with('author')->findOrFail($id); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | public function author($id) |
| 98 | 98 | { |
| 99 | 99 | $author = Redis::get('posts:authors:'.$id); |
| 100 | - if (! $author) { |
|
| 100 | + if (!$author) { |
|
| 101 | 101 | $author = Post::findOrFail($id)->author; |
| 102 | 102 | } |
| 103 | 103 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | public function images($id) |
| 115 | 115 | { |
| 116 | 116 | $images = Redis::get('posts:images:'.$id); |
| 117 | - if (! $images) { |
|
| 117 | + if (!$images) { |
|
| 118 | 118 | $images = Post::findOrFail($id)->images; |
| 119 | 119 | } |
| 120 | 120 | |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | { |
| 48 | 48 | $parts = explode('\\', $this->model); |
| 49 | 49 | |
| 50 | - return strtolower($parts[sizeof($parts)-1]); |
|
| 50 | + return strtolower($parts[ sizeof($parts) - 1 ]); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |