<?php compact(array|string $var_name, array|string ...$var_names): array
<?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 { $users = User::all(); return view('admin.user.index', compact('users')); }
<?php { $posts = Post::all(); return view('post.index', compact('posts')); }
<?php { $terms = Term::all(); return view('term.index', compact('terms')); }
<?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')); }