preparations done

This commit is contained in:
2025-06-05 10:53:57 +05:45
parent b3e543863a
commit 18e5f8f173
11 changed files with 253 additions and 31 deletions

View File

@ -7,26 +7,17 @@ use Illuminate\Http\Request;
class PreparationController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$preparations = PreparationController::all();
return view('preparation.index', compact('preparations'));
$preparations = Preparation::all();
return view('preparations.index', compact('preparations'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('posts.create');
return view('preparations.create');
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$validated = $request->validate([
@ -35,28 +26,19 @@ class PreparationController extends Controller
]);
Preparation::create($validated);
return redirect()->route('preparation.index')->with('success', 'Preparation created successfully');
return redirect()->route('preparations.index')->with('success', 'Preparation created successfully');
}
/**
* Display the specified resource.
*/
public function show(string $id)
public function show(Preparation $preparation)
{
return view('preparations.show', compact('preparation'));
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
public function edit(Preparation $preparation)
{
return view('preparations.edit', compact('preparation'));
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, Preparation $preparation)
{
$validated = $request->validate([
@ -65,16 +47,13 @@ class PreparationController extends Controller
]);
$preparation->update($validated);
return redirect()->route('preparation.index')->with('success', 'Preparation updated successfully');
return redirect()->route('preparations.index')->with('success', 'Preparation updated successfully');
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Preparation $preparation)
{
$preparation->delete();
return redirect()->route('preparation.index')->with('success', 'Preparation deleted successfully');
return redirect()->route('preparations.index')->with('success', 'Preparation deleted successfully');
}
}