fanatic/app/Http/Requests/UpdateJoinedRequest.php

32 lines
818 B
PHP
Raw Normal View History

2022-04-23 16:25:16 -07:00
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateJoinedRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
2022-04-26 18:43:36 -07:00
public function authorize() : bool
2022-04-23 16:25:16 -07:00
{
2022-04-26 18:43:36 -07:00
return $this->user()->can('update', $this->route('joined'));
2022-04-23 16:25:16 -07:00
}
/**
* Get the validation rules that apply to the request.
*/
2022-04-26 18:43:36 -07:00
public function rules() : array
2022-04-23 16:25:16 -07:00
{
return [
2022-04-26 18:43:36 -07:00
'categories' => ['required', 'array'],
'categories.*' => ['numeric', 'exists:categories,id'],
'url' => ['required', 'url'],
'subject' => ['required', 'string'],
'image' => ['nullable', 'image'],
'approved' => ['nullable', 'boolean'],
2022-04-23 16:25:16 -07:00
];
}
}