[vagrant@localhost laravel]$ php artisan tinker
Psy Shell v0.9.8 (PHP 7.1.21 — cli) by Justin Hileman
>>> $article = new App\Article();
=> App\Article {#2900}
>>> $article->login_id = ‘user1’;
=> “user1”
>>> $article->role = ‘master’;
=> “master”
>>> $article->name = ‘taniguchi’;
=> “taniguchi”
>>> $article->password = ‘passowrd’;
=> “passowrd”
>>> $article->mail = ‘laravel@gmail.com’;
=> “laravel@gmail.com”
>>> $article->test_mail = ‘laravel_test@gmail.com’;
=> “laravel_test@gmail.com”
>>> $article->updated_person = ‘sasaki’;
=> “sasaki”
>>> $article->save();
=> true
>>> App\Article::all();
=> Illuminate\Database\Eloquent\Collection {#2908
all: [
App\Article {#2909
id: 1,
login_id: “user1”,
role: “master”,
name: “taniguchi”,
password: “passowrd”,
mail: “laravel@gmail.com”,
test_mail: “laravel_test@gmail.com”,
updated_person: “sasaki”,
created_at: “2018-09-21 21:39:07”,
updated_at: “2018-09-21 21:39:07”,
},
],
}
なるほど♪
mysqlにも入っています。
mysql> select * from articles;
+—-+———-+——–+———–+———-+——————-+————————+—————-+———————+———————+
| id | login_id | role | name | password | mail | test_mail | updated_person | created_at | updated_at |
+—-+———-+——–+———–+———-+——————-+————————+—————-+———————+———————+
| 1 | user1 | master | taniguchi | passowrd | laravel@gmail.com | laravel_test@gmail.com | sasaki | 2018-09-21 21:39:07 | 2018-09-21 21:39:07 |
+—-+———-+——–+———–+———-+——————-+————————+—————-+———————+———————+
1 row in set (0.00 sec)