for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Webfactor\Laravel\Backpack\Documents\Requests;
use App\Http\Requests\Request;
use Illuminate\Validation\Rule;
class DocumentRequest extends \Backpack\CRUD\app\Http\Requests\CrudRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
// only allow updates if the user is logged in
return \Auth::check();
}
* Get the validation rules that apply to the request.
* @return array
array<string,array<strin...n\Rules\Unique>|string>
This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.
array
public function rules()
return [
'type' => [
'required',
Rule::in(config('webfactor.documents.types')),
Rule::unique('documents')
],
'title' => 'required|min:5|max:255',
'body' => 'required|string'
];
* Get the validation attributes that apply to the request.
array<string,\Illuminate...ator|string|array|null>
public function attributes()
'type' => trans('webfactor::documents.type'),
'title' => trans('webfactor::documents.title'),
'body' => trans('webfactor::documents.body')
* Get the validation messages that apply to the request.
public function messages()
//
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.