snipe_it/app/Http/Requests/StoreAssetRequest.php
spencerrlongg 0924a53789 quick fix
2023-11-15 12:28:30 -06:00

43 lines
837 B
PHP

<?php
namespace App\Http\Requests;
use App\Models\Asset;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Gate;
class StoreAssetRequest extends ImageUploadRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize(): bool
{
return Gate::allows('create', new Asset);
}
public function prepareForValidation(): void
{
//
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(): array
{
$rules = array_merge(
(new Asset)->getRules(),
parent::rules(),
);
// temporary fix for unique serials
unset($rules['serial']);
return $rules;
}
}