mirror of
https://github.com/koel/koel
synced 2024-12-25 20:13:06 +00:00
31 lines
604 B
PHP
31 lines
604 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\API;
|
|
|
|
use App\Models\User;
|
|
|
|
/**
|
|
* @property string $password
|
|
* @property string $name
|
|
* @property string $email
|
|
* @property bool $is_admin
|
|
*/
|
|
class UserUpdateRequest extends Request
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return auth()->user()->is_admin;
|
|
}
|
|
|
|
/** @return array<mixed> */
|
|
public function rules(): array
|
|
{
|
|
/** @var User $user */
|
|
$user = $this->route('user');
|
|
|
|
return [
|
|
'name' => 'required',
|
|
'email' => 'required|email|unique:users,email,' . $user->id,
|
|
];
|
|
}
|
|
}
|