2022-04-26 21:16:46 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
2022-04-27 21:15:01 -07:00
|
|
|
use Illuminate\Validation\Rule;
|
2022-04-26 21:16:46 -07:00
|
|
|
|
|
|
|
class StoreOwnedRequest extends FormRequest
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Determine if the user is authorized to make this request.
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function authorize()
|
|
|
|
{
|
2022-04-27 21:15:01 -07:00
|
|
|
return $this->user()->can('create', Joined::class);
|
2022-04-26 21:16:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the validation rules that apply to the request.
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function rules()
|
|
|
|
{
|
|
|
|
return [
|
2022-04-27 21:15:01 -07:00
|
|
|
'categories' => ['required', 'array'],
|
|
|
|
'categories.*' => ['numeric', 'exists:categories,id'],
|
|
|
|
'subject' => ['required', 'string'],
|
|
|
|
'status' => ['required', 'string', Rule::in(['current', 'upcoming'])],
|
|
|
|
'slug' => ['required', 'alpha_dash'],
|
|
|
|
'title' => ['nullable', 'string'],
|
|
|
|
'image' => ['nullable', 'image'],
|
|
|
|
'date_opened' => ['nullable', 'date'],
|
|
|
|
'hold_member_updates' => ['nullable', 'boolean'],
|
2022-04-26 21:16:46 -07:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|