Personal_Website/app/Http/Requests/BlogArticlePublishRequest.php

41 lines
978 B
PHP

<?php
namespace App\Http\Requests;
use App\Http\Services\AuthService;
use Illuminate\Foundation\Http\FormRequest;
class BlogArticlePublishRequest extends FormRequest
{
private $authService;
public function __construct(AuthService $authService, array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null)
{
parent::__construct($query, $request, $attributes, $cookies, $files, $server, $content);
$this->authService = $authService;
}
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->authService->isAuthenticated();
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'published' => 'required|boolean',
];
}
}