The
view
function retrieves a view instance:<?php return view('auth.login');
<?php {
$users = User::all();
return view('user.index', compact('users'));
}
<?php {
$posts = Post::where('title', $title)->where('content', $content)->orderBy('published_at')->limit(5)->get();
return view('post.index', compact('posts'));
}
<?php {
$post = Post::find($id);
return view('post.edit', compact('post'));
}
<?php public function __invoke(Request $request)
{
return view('report');
}
}
<?php {
event(new ReportGenerated());
return view('report');
}
}
<?php {
$users = User::all();
return view('admin.user.index', compact('users'));
}
<?php {
$posts = Post::all();
return view('post.index', compact('posts'));
}
<?php {
$posts = Post::all();
return view('post.index', compact('posts'));
}
<?php {
$posts = Post::all();
return view('post.index', compact('posts'));
}
<?php {
$terms = Term::all();
return view('term.index', compact('terms'));
}
<?php public function create(Request $request): \Illuminate\Http\Response
{
return view('term.create');
}
<?php public function show(Request $request, Term $term): \Illuminate\Http\Response
{
return view('term.show', compact('term'));
}
<?php public function edit(Request $request, Term $term): \Illuminate\Http\Response
{
return view('term.edit', compact('term'));
}