phases 8
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Products\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\View\View;
|
||||
use Modules\Products\Http\Requests\StoreProductRequest;
|
||||
use Modules\Products\Models\Product;
|
||||
|
||||
final class ProductController
|
||||
{
|
||||
public function index(): View
|
||||
{
|
||||
return view('products::admin.products.index', ['records' => Product::query()->latest()->paginate()]);
|
||||
}
|
||||
|
||||
public function store(StoreProductRequest $request): RedirectResponse
|
||||
{
|
||||
Product::query()->create($request->validated());
|
||||
return back()->with('status', 'Product created.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user