src/Requests/ImagesRequest.php
<?php
namespace Grafite\Cms\Requests;
use Auth;
use Gate;
use Grafite\Cms\Models\Image;
use Illuminate\Foundation\Http\FormRequest;
class ImagesRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
if (config('app.env') !== 'testing') {
return Gate::allows('cms', Auth::user());
}
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return Image::$rules;
}
}