@@ -11,14 +11,14 @@ |
||
11 | 11 | * |
12 | 12 | * @return void |
13 | 13 | */ |
14 | - public function up() { |
|
15 | - Schema::create('posts', function (Blueprint $table) { |
|
16 | - $table->increments('id'); |
|
17 | - $table->string('title'); |
|
18 | - $table->text('description'); |
|
19 | - $table->timestamps(); |
|
20 | - }); |
|
21 | - } |
|
14 | + public function up() { |
|
15 | + Schema::create('posts', function (Blueprint $table) { |
|
16 | + $table->increments('id'); |
|
17 | + $table->string('title'); |
|
18 | + $table->text('description'); |
|
19 | + $table->timestamps(); |
|
20 | + }); |
|
21 | + } |
|
22 | 22 | |
23 | 23 | |
24 | 24 | /** |
@@ -12,7 +12,7 @@ |
||
12 | 12 | * @return void |
13 | 13 | */ |
14 | 14 | public function up() { |
15 | - Schema::create('posts', function (Blueprint $table) { |
|
15 | + Schema::create('posts', function(Blueprint $table) { |
|
16 | 16 | $table->increments('id'); |
17 | 17 | $table->string('title'); |
18 | 18 | $table->text('description'); |
@@ -16,10 +16,10 @@ |
||
16 | 16 | public function up() |
17 | 17 | { |
18 | 18 | Schema::create('social_twitter_accounts', function (Blueprint $table) { |
19 | - $table->integer('user_id'); |
|
20 | - $table->string('provider_user_id'); |
|
21 | - $table->string('provider'); |
|
22 | - $table->timestamps(); |
|
19 | + $table->integer('user_id'); |
|
20 | + $table->string('provider_user_id'); |
|
21 | + $table->string('provider'); |
|
22 | + $table->timestamps(); |
|
23 | 23 | }); |
24 | 24 | } |
25 | 25 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | */ |
16 | 16 | public function up() |
17 | 17 | { |
18 | - Schema::create('social_twitter_accounts', function (Blueprint $table) { |
|
18 | + Schema::create('social_twitter_accounts', function(Blueprint $table) { |
|
19 | 19 | $table->integer('user_id'); |
20 | 20 | $table->string('provider_user_id'); |
21 | 21 | $table->string('provider'); |
@@ -16,10 +16,10 @@ |
||
16 | 16 | public function up() |
17 | 17 | { |
18 | 18 | Schema::create('social_facebook_accounts', function (Blueprint $table) { |
19 | - $table->integer('user_id'); |
|
20 | - $table->string('provider_user_id'); |
|
21 | - $table->string('provider'); |
|
22 | - $table->timestamps(); |
|
19 | + $table->integer('user_id'); |
|
20 | + $table->string('provider_user_id'); |
|
21 | + $table->string('provider'); |
|
22 | + $table->timestamps(); |
|
23 | 23 | }); |
24 | 24 | } |
25 | 25 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | */ |
16 | 16 | public function up() |
17 | 17 | { |
18 | - Schema::create('social_facebook_accounts', function (Blueprint $table) { |
|
18 | + Schema::create('social_facebook_accounts', function(Blueprint $table) { |
|
19 | 19 | $table->integer('user_id'); |
20 | 20 | $table->string('provider_user_id'); |
21 | 21 | $table->string('provider'); |
@@ -8,10 +8,10 @@ discard block |
||
8 | 8 | |
9 | 9 | class PostController extends Controller { |
10 | 10 | |
11 | - /** |
|
12 | - * Saves a new post to the database |
|
13 | - */ |
|
14 | - public function store(Request $request) { |
|
11 | + /** |
|
12 | + * Saves a new post to the database |
|
13 | + */ |
|
14 | + public function store(Request $request) { |
|
15 | 15 | // ... |
16 | 16 | // validation can be done here before saving |
17 | 17 | // with $this->validate($request, $rules) |
@@ -30,5 +30,5 @@ discard block |
||
30 | 30 | |
31 | 31 | // return post as response, Laravel automatically serializes this to JSON |
32 | 32 | return response($post, 201); |
33 | - } |
|
33 | + } |
|
34 | 34 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | // ... |
19 | 19 | |
20 | 20 | // get data to save in an associative array using $request->only() |
21 | - $data = $request->only(['title', 'description']); |
|
21 | + $data = $request->only([ 'title', 'description' ]); |
|
22 | 22 | |
23 | 23 | // save post and assign return value of created post to $post array |
24 | 24 | $post = Post::create($data); |