validacion con request
This commit is contained in:
parent
9d9b6c5be9
commit
ac8dfe04b3
|
|
@ -62,7 +62,6 @@ class CategoriasController extends Controller
|
|||
]
|
||||
);
|
||||
|
||||
|
||||
$categorias = new Categorias();
|
||||
$categorias->fill([
|
||||
'nombre' => $request->input('nombre'),
|
||||
|
|
@ -79,7 +78,7 @@ class CategoriasController extends Controller
|
|||
return view('categorias.edit', ["cat"=>$categoria]);
|
||||
}
|
||||
|
||||
public function update(Request $request, $id){
|
||||
public function update(UpdatedCategoriaRequest $request, $id){
|
||||
$categorias = Categorias::findOrfail($id);
|
||||
$categorias->fill([
|
||||
'nombre' => $request->input('nombre'),
|
||||
|
|
|
|||
28
app/Http/Requests/StoreCategoriasRequest.php
Normal file
28
app/Http/Requests/StoreCategoriasRequest.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreCategoriasRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -37,7 +37,6 @@
|
|||
name="nombre"
|
||||
id="nombre"
|
||||
value="{{ old('nombre') }}"
|
||||
required
|
||||
class="form-control">
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user