laravel explain with relationship code example
Example 1: laravel relationship
$comment = Post::find(1)->comments()
->where('title', 'foo')
->first();
Example 2: laravel relationship
use App\Models\Post;
$comments = Post::find(1)->comments;
foreach ($comments as $comment) {
//
}