$request->user()->tests()->get() ]); } /** * Show the form for creating a new resource. */ public function create() { // } /** * Store a newly created resource in storage. */ public function store(Request $request) { $validated = $request->validate([ "name" => "required|string" ]); $request->user()->tests()->create($validated); return redirect(route("tests.index")); } /** * Display the specified resource. */ public function show(Test $test) { // } /** * Show the form for editing the specified resource. */ public function edit(Test $test) { return view("tests.edit", [ "test" => $test, ]); } /** * Update the specified resource in storage. */ public function update(Request $request, Test $test) { $validated = $request->validate([ "name" => "required|string" ]); $test->update($validated); return redirect(route("tests.index")); } /** * Remove the specified resource from storage. */ public function destroy(Test $test) { $test->delete(); return redirect(route("tests.index")); } }