Lae/app/Http/Requests/User/HostRequest.php

34 lines
617 B
PHP
Raw Normal View History

2022-11-25 08:14:42 +00:00
<?php
namespace App\Http\Requests\User;
use Illuminate\Foundation\Http\FormRequest;
class HostRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize(): bool
{
$host = $this->route('host');
// 检测是否是自己的主机
return $host->user_id == auth()->id();
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, mixed>
*/
public function rules()
{
return [
//
];
}
}