47 lines
		
	
	
		
			984 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			984 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
declare(strict_types=1);
 | 
						|
 | 
						|
namespace App\Http\Requests\Comment;
 | 
						|
 | 
						|
use App\Http\Requests\InvalidDataResponseTrait;
 | 
						|
use Illuminate\Foundation\Http\FormRequest;
 | 
						|
 | 
						|
class UpdateCommentRequest extends FormRequest
 | 
						|
{
 | 
						|
    use InvalidDataResponseTrait;
 | 
						|
 | 
						|
    /**
 | 
						|
     * @return array<string, string>
 | 
						|
     */
 | 
						|
    public function all($keys = null): array
 | 
						|
    {
 | 
						|
        $request = parent::all($keys);
 | 
						|
 | 
						|
        $request['id'] = $this->route('id');
 | 
						|
        $request['post_id'] = $this->route('post_id');
 | 
						|
 | 
						|
        return $request;
 | 
						|
    }
 | 
						|
 | 
						|
 | 
						|
    /**
 | 
						|
     * Determine if the user is authorized to make this request.
 | 
						|
     */
 | 
						|
    public function authorize(): bool
 | 
						|
    {
 | 
						|
        return true;
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
 | 
						|
     */
 | 
						|
    public function rules(): array
 | 
						|
    {
 | 
						|
        return [
 | 
						|
            ...StoreCommentRequest::rulesDefinition(),
 | 
						|
            'id' => 'required|integer|exists:comments,id',
 | 
						|
        ];
 | 
						|
    }
 | 
						|
}
 |