レッスン一覧 · レッスン 5/5
The Basics · レッスン 5/5
Working with the Database
Describe your tables with migrations, then read and write rows with Eloquent.
1分 コメント0件
A migration describes a table in PHP, so the whole team gets the same database structure.
Schema::create('posts', function (Blueprint $table) {
$table->id();
$table->string('title');
$table->text('body');
$table->timestamps();
});Reading and writing
With the table in place, Post::create() saves a row and Post::latest()->get() reads them back, newest first. No SQL needed for everyday work.
ディスカッション
コメントするにはログインしてください。 ログイン
まだディスカッションはありません。最初の質問をしてみましょう。