mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 05:04:07 -08:00
remove regex, add in starts_with
This commit is contained in:
parent
9cd2783185
commit
aab53cf683
|
@ -1,41 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Models\Manufacturer;
|
||||
|
||||
class SaveManufacturerRequest extends ImageUploadRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return parent::rules() + (new Manufacturer())->getRules();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the data for validation.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
$this->merge([
|
||||
'support_url' => $this->input('support_url'),
|
||||
]);
|
||||
dd($this->all());
|
||||
}
|
||||
}
|
|
@ -24,7 +24,7 @@ class Manufacturer extends SnipeModel
|
|||
'name' => 'required|min:2|max:255|unique:manufacturers,name,NULL,id,deleted_at,NULL',
|
||||
'url' => 'url|nullable',
|
||||
'support_email' => 'email|nullable',
|
||||
'support_url' => ['regex:/.+:\/\/.+/','nullable'],
|
||||
'support_url' => ['starts_with:http://,https://,afp://,facetime://,file://,irc://','nullable'],
|
||||
];
|
||||
|
||||
protected $hidden = ['user_id'];
|
||||
|
|
Loading…
Reference in a new issue