ledgerrz/app/Http/Requests/StoreMessageRequest.php
2026-06-15 01:03:38 +02:00

32 lines
688 B
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
class StoreMessageRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
$chat = $this->route('chat');
return $chat && $this->user()->can('view', $chat->chatable);
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array|string>
*/
public function rules(): array
{
return [
'content' => ['required', 'string'],
];
}
}