Skip to content

Commit

Permalink
Process feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
bramr94 committed May 3, 2024
1 parent be0dd6e commit 1324b44
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/FilamentDeveloperLoginsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function configurePackage(Package $package): void
public function packageRegistered(): void
{
$this->app->singleton(FilamentDevelopersLogin::class);
$this->app->alias(FilamentDevelopersLogin::class, 'filament-developers-login');
$this->app->bind('filament-developers-login', FilamentDevelopersLogin::class);
}

public function packageBooted(): void
Expand Down
18 changes: 2 additions & 16 deletions src/Http/Controllers/DeveloperLoginsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use DutchCodingCompany\FilamentDeveloperLogins\FilamentDeveloperLoginsPlugin;
use DutchCodingCompany\FilamentDeveloperLogins\Http\Requests\LoginAsRequest;
use Filament\Facades\Filament;
use Filament\Panel;
use Illuminate\Http\RedirectResponse;
use Illuminate\Routing\Controller;
use Livewire\Features\SupportRedirects\Redirector;
Expand All @@ -19,23 +18,10 @@ class DeveloperLoginsController extends Controller
*/
public function loginAs(LoginAsRequest $request): RedirectResponse | Redirector
{
[$panel, $plugin] = $this->initiate($request);

$panel = Filament::getPanel($request->validated('panel_id'));
$plugin = FilamentDeveloperLoginsPlugin::getById($request->validated('panel_id'));
$credentials = $request->validated('credentials');

return FilamentDevelopersLogin::login($panel, $plugin, $credentials);
}

/**
* @return array{Panel, FilamentDeveloperLoginsPlugin}
*
* @throws ImplementationException
*/
protected function initiate(LoginAsRequest $request): array
{
return [
Filament::getPanel($request->validated('panel_id')),
FilamentDeveloperLoginsPlugin::getById($request->validated('panel_id')),
];
}
}
5 changes: 0 additions & 5 deletions src/Http/Requests/LoginAsRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@

namespace DutchCodingCompany\FilamentDeveloperLogins\Http\Requests;

use DutchCodingCompany\FilamentDeveloperLogins\Facades\FilamentDevelopersLogin;
use DutchCodingCompany\FilamentDeveloperLogins\FilamentDeveloperLoginsPlugin;
use Filament\Facades\Filament;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class LoginAsRequest extends FormRequest
{
protected ?FilamentDeveloperLoginsPlugin $plugin = null;

/**
* @return array<string, mixed>
*/
Expand Down

0 comments on commit 1324b44

Please sign in to comment.