- require composer kwaadpepper/enum - User->role is now an enum - Add isLocal and isAdmin to user model - changed multiple fields casts on model Settings - added validation for settings
33 lines
677 B
PHP
33 lines
677 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class CodeSearchRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return boolean
|
|
*/
|
|
public function authorize()
|
|
{
|
|
// ? Is auth and super admin ?
|
|
/** @var \App\Models\User $user */
|
|
$user = auth()->user();
|
|
return auth()->check() and $user->isAdmin();
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
'code' => 'required|string|min:1|max:25'
|
|
];
|
|
}
|
|
}
|