Post::query()
->with(['user' => function ($query) {
$query->select('id', 'username');
}])
->get();
$users = AppBook::with('author:id,name')->get();
1) Post::query()
->with(['user' => function ($query) {
$query->select('id', 'username');
}])
->get();
2) $users = AppBook::with('author:id,name')->get();
Route::get('/', function () {
$articleName = ‘Article 1’;
return view('gfg')->with('articleName', $articleName)->
with('articlePublished', 'On GeeksforGeeks');
});