2022-04-23 16:25:16 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
|
2022-04-25 19:50:01 -07:00
|
|
|
use App\Models\Joined;
|
2022-04-23 16:25:16 -07:00
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
2022-04-25 19:50:01 -07:00
|
|
|
use Illuminate\Support\Facades\Auth;
|
2022-04-23 16:25:16 -07:00
|
|
|
|
|
|
|
class StoreJoinedRequest extends FormRequest
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Determine if the user is authorized to make this request.
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function authorize()
|
|
|
|
{
|
2022-04-25 19:50:01 -07:00
|
|
|
return $this->user()->can('create', Joined::class);
|
2022-04-23 16:25:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the validation rules that apply to the request.
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function rules()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'categories' => ['required', 'array'],
|
|
|
|
'categories.*' => [ 'numeric', 'exists:categories,id'],
|
|
|
|
'url' => ['required', 'url'],
|
|
|
|
'subject' => ['required', 'string'],
|
|
|
|
'image' => ['nullable', 'image'],
|
|
|
|
'approved' => ['nullable', 'boolean'],
|
|
|
|
];
|
|
|
|
}
|
2022-04-25 19:50:01 -07:00
|
|
|
}
|