Solution for "laravel update related model"

use Illuminate\Database\Eloquent\Builder; // Retrieve posts with at least one comment containing words like code%... $posts = Post::whereHas('comments', function (Builder $query) { $query->where('content', 'like', 'code%'); })->get(); // Retrieve posts with at least ten comments containing words like code%... $posts = Post::whereHas('comments', function (Builder $query) { $query->where('content', 'like', 'code%'); }, '>=', 10)->get();

whereHas site:https://laravel.com/docs/

$movies = Movie::whereHas('director', function($q) { $q->where('name', 'great'); })->get();

laravel how to query belongsTo relationship

$roles = App\User::find(1)->roles()->orderBy('name')->get();

eloquent relationships

Similar codes for "laravel update related model"


Latest 'PHP' questions

Added before "laravel update related model"