snipe-it/app/Http/Livewire/OauthClients.php

40 lines
855 B
PHP
Raw Normal View History

2023-12-05 12:52:14 -08:00
<?php
namespace App\Http\Livewire;
use Illuminate\Support\Facades\Auth;
use Laravel\Passport\ClientRepository;
use Livewire\Component;
class OauthClients extends Component
{
public function render()
{
return view('livewire.oauth-clients', [
'clients' => app(ClientRepository::class)->activeForUser(auth()->user()->id),
]);
}
public function rules(): array
{
return [
'name' => 'required|string|max:255',
'redirect' => 'required|url|max:255',
];
}
public function createClient(): void
{
$this->validate();
//$newClient = ;
$this->dispatchBrowserEvent('clientCreated', $newClient->accessToken);
}
public function deleteClient($clientId): void
{
Auth::user()->clients()->find($clientId)->delete();
}
}