style updates
This commit is contained in:
@@ -17,6 +17,7 @@ final class ProductController
|
||||
public function store(StoreProductRequest $request): RedirectResponse
|
||||
{
|
||||
Product::query()->create($request->validated());
|
||||
|
||||
return back()->with('status', 'Product created.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,13 @@ use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
final class StoreProductRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool { return $this->user() !== null; }
|
||||
public function rules(): array { return ['name' => ['required', 'string', 'max:255'], 'is_active' => ['sometimes', 'boolean']]; }
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user() !== null;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return ['name' => ['required', 'string', 'max:255'], 'is_active' => ['sometimes', 'boolean']];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user