ヤマカサのプログラミング勉強日記

プログラミングに関する日記とどうでもよい雑記からなるブログです。

Laravel From Scratch part. 5

Section 7 Eloquent

laracasts.com

GitHub - YamaKasa3/laravel6

Eloquentについて学びます。データベース系の知識がないので、SQLから勉強した方が良い気がしました。

Basic Eloquent Relationships

Eloquent:リレーション 6.x Laravel

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

投稿画面からタグを選べるようにします。編集画面でタグを選べるようになってない気がしました。