Laravel From Scratch part. 5
Section 7 Eloquent
Eloquentについて学びます。データベース系の知識がないので、SQLから勉強した方が良い気がしました。
Basic Eloquent Relationships
Understanding Foreign Keys and Database Factories
Factoryメソッド?を使ってダミーのユーザーと記事を作成します。
ユーザーIDをCASCADE?にするとユーザーの削除と同時にそのユーザーの記事も削除されます。
Many to Many Relationships With Linking Tables
記事にタグをつけるためにデータベースにテーブルを追加します。
Display All Tags Under Each Article
記事にタグを付けます。
Attach and Validate Many-to-Many Inserts
投稿画面からタグを選べるようにします。編集画面でタグを選べるようになってない気がしました。