app/Http/Requests/SemesterStoreRequest.php
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class SemesterStoreRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return auth()->user()->can('create semesters');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'semester_name' => 'required',
'start_date' => 'required|date',
'end_date' => 'required|date',
'session_id' => 'required|integer|gt:0',
];
}
}