34 lines
646 B
PHP
34 lines
646 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Requests\Invoice;
|
||
|
|
|
||
|
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
|
||
|
|
class InvoiceSetDateRequest extends FormRequest
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Determine if the user is authorized to make this request.
|
||
|
|
*
|
||
|
|
* @return boolean
|
||
|
|
*/
|
||
|
|
public function authorize(): bool
|
||
|
|
{
|
||
|
|
/** @var \App\Models\User|null $user */
|
||
|
|
$user = auth()->user();
|
||
|
|
|
||
|
|
return auth()->check() && $user->isAdmin();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get the validation rules that apply to the request.
|
||
|
|
*
|
||
|
|
* @return array
|
||
|
|
*/
|
||
|
|
public function rules()
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'date' => 'required|date'
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|