preparations done
This commit is contained in:
@ -7,13 +7,14 @@ namespace App\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Post;
|
||||
use App\Models\Slider;
|
||||
use App\Models\Preparation;
|
||||
|
||||
class FrontendController extends Controller
|
||||
{
|
||||
public function homePage()
|
||||
{
|
||||
$data['sliderItems'] = Slider::all();
|
||||
// $data['preparations'] = Preparation::all();
|
||||
$data['preparations'] = Preparation::all();
|
||||
// $data['services'] = Service::all();
|
||||
// $data['about'] = About::all();
|
||||
// $data['contact'] = Contact::first();
|
||||
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user