mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-07-15 02:07:56 -04:00
43 lines
974 B
PHP
43 lines
974 B
PHP
<?php
|
|
|
|
namespace Modules\Frontend\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class ProcessSocialMediaRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules()
|
|
{
|
|
$id_rules = ['required', 'integer', 'gt:0', 'exists:frontend_social_medias'];
|
|
|
|
if ($this->method() == 'DELETE' || ($this->has('nodata'))) {
|
|
return [
|
|
'id' => $id_rules,
|
|
];
|
|
}
|
|
|
|
return [
|
|
'id' => [Rule::when($this->method() == 'PUT', $id_rules)],
|
|
'name' => ['required', 'string'],
|
|
'url' => ['required', 'string'],
|
|
'icon' => ['required', 'string'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return bool
|
|
*/
|
|
public function authorize()
|
|
{
|
|
return true;
|
|
}
|
|
}
|