remove regex, add in starts_with

This commit is contained in:
akemidx 2023-04-26 15:18:13 -04:00
parent 9cd2783185
commit aab53cf683
2 changed files with 1 additions and 42 deletions

View file

@ -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());
}
}

View file

@ -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'];