@@ -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 | } |
@@ -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 | /** |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::table('images', function (Blueprint $table) { |
|
| 16 | + Schema::table('images', function(Blueprint $table) { |
|
| 17 | 17 | $table->string('filename'); |
| 18 | 18 | }); |
| 19 | 19 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public function down() |
| 27 | 27 | { |
| 28 | - Schema::table('images', function (Blueprint $table) { |
|
| 28 | + Schema::table('images', function(Blueprint $table) { |
|
| 29 | 29 | $table->dropColumnIfExists('filename'); |
| 30 | 30 | }); |
| 31 | 31 | } |
@@ -70,23 +70,23 @@ |
||
| 70 | 70 | ); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if (! $this->requests->hasFile('file')) { |
|
| 73 | + if (!$this->requests->hasFile('file')) { |
|
| 74 | 74 | return $this->response->array([ |
| 75 | 75 | 'status' => 'error', |
| 76 | 76 | 'message' => 'Invalid request', |
| 77 | - 'errors' => ['Invalid file.',], |
|
| 77 | + 'errors' => [ 'Invalid file.', ], |
|
| 78 | 78 | ]); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if (! $this->requests->file('file')->isValid()) { |
|
| 81 | + if (!$this->requests->file('file')->isValid()) { |
|
| 82 | 82 | return $this->response->array([ |
| 83 | 83 | 'status' => 'error', |
| 84 | 84 | 'message' => 'Invalid request', |
| 85 | - 'errors' => ['Invalid file upload.',], |
|
| 85 | + 'errors' => [ 'Invalid file upload.', ], |
|
| 86 | 86 | ]); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - $slug = uniqid().'_'.str_slug(explode('.', $this->requests->file->getClientOriginalName())[0]); |
|
| 89 | + $slug = uniqid().'_'.str_slug(explode('.', $this->requests->file->getClientOriginalName())[ 0 ]); |
|
| 90 | 90 | $filename = $slug.'.'.$this->requests->file->extension(); |
| 91 | 91 | |
| 92 | 92 | // move image |