34 lines
617 B
PHP
34 lines
617 B
PHP
|
<?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 [
|
||
|
//
|
||
|
];
|
||
|
}
|
||
|
}
|