Skip to content

Commit

Permalink
Merge pull request #96 from jeffgreco13/1.x-dev
Browse files Browse the repository at this point in the history
Update to use new Filament Notifications package
  • Loading branch information
jeffgreco13 authored Aug 3, 2022
2 parents 2755bce + f1293c3 commit c17aab5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"require": {
"php": "^8.0|^8.1",
"spatie/laravel-package-tools": "^1.9.2",
"filament/filament": "^2.13",
"filament/filament": "^2.15",
"illuminate/contracts": "^8.0|^9.0",
"bacon/bacon-qr-code": "^2.0",
"pragmarx/google2fa": "^7.0|^8.0"
Expand Down
5 changes: 3 additions & 2 deletions resources/views/components/auth-card.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
'dark:bg-gray-900 dark:text-white' => config('filament.dark_mode'),
])>

<x-filament::notification-manager />

<div
class="px-6 -mt-16 md:mt-0 md:px-2 max-w-{{ config('filament-breezy.auth_card_max_w') ?? 'md' }} space-y-8 w-screen">
<form wire:submit.prevent="{{ $action }}" @class([
Expand All @@ -18,4 +16,7 @@ class="px-6 -mt-16 md:mt-0 md:px-2 max-w-{{ config('filament-breezy.auth_card_ma
{{ $this->modal }}
<x-filament::footer />
</div>

@livewire('notifications')

</div>
6 changes: 2 additions & 4 deletions src/Http/Livewire/Auth/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@
use Filament\Facades\Filament;
use Filament\Forms\Components\TextInput;
use Filament\Http\Livewire\Auth\Login as FilamentLogin;
use Filament\Http\Livewire\Concerns\CanNotify;
use Filament\Http\Responses\Auth\Contracts\LoginResponse;
use Filament\Notifications\Notification;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Arr;
use JeffGreco13\FilamentBreezy\FilamentBreezy;

class Login extends FilamentLogin
{
use CanNotify;

public $loginColumn;
public $showCodeForm = false;
public $usingRecoveryCode = false;
Expand Down Expand Up @@ -166,7 +164,7 @@ public function mount(): void
$this->form->fill([$this->loginColumn => $login]);
}
if (request()->query("reset")) {
$this->notify("success", __("passwords.reset"), true);
Notification::make()->title(__("passwords.reset"))->success()->send();
}
}

Expand Down
11 changes: 5 additions & 6 deletions src/Http/Livewire/Auth/ResetPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace JeffGreco13\FilamentBreezy\Http\Livewire\Auth;

use Filament\Forms;
use Filament\Http\Livewire\Concerns\CanNotify;
use Filament\Notifications\Notification;
use Illuminate\Auth\Events\PasswordReset;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Facades\Hash;
Expand All @@ -15,7 +15,6 @@
class ResetPassword extends Component implements Forms\Contracts\HasForms
{
use Forms\Concerns\InteractsWithForms;
use CanNotify;

public $email;
public $token;
Expand Down Expand Up @@ -79,19 +78,19 @@ public function submit()
if ($response == Password::PASSWORD_RESET) {
return redirect(route('filament.auth.login', ['email' => $this->email,'reset' => true]));
} else {
$this->notify('danger', __("filament-breezy::default.reset_password.notification_error"));
Notification::make()->title(__("filament-breezy::default.reset_password.notification_error"))->danger()->send();
}
} else {
$response = Password::sendResetLink(['email' => $this->email]);
if ($response == Password::RESET_LINK_SENT) {
$this->notify('success', __("filament-breezy::default.reset_password.notification_success"));
Notification::make()->title(__("filament-breezy::default.reset_password.notification_success"))->success()->send();

$this->hasBeenSent = true;
} else {
$this->notify('danger', match ($response) {
Notification::make()->title(match ($response) {
"passwords.throttled" => __("passwords.throttled"),
"passwords.user" => __("passwords.user")
});
})->danger()->send();
}
}
}
Expand Down
8 changes: 2 additions & 6 deletions src/Http/Livewire/Auth/Verify.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@

use Filament\Facades\Filament;
use Filament\Forms;
use Filament\Http\Livewire\Concerns\CanNotify;
use Filament\Notifications\Notification;
use Illuminate\Contracts\View\View;
use Livewire\Component;

class Verify extends Component implements Forms\Contracts\HasForms
{
use CanNotify;
use Forms\Concerns\InteractsWithForms;

public bool $hasBeenSent = false;
Expand Down Expand Up @@ -40,10 +39,7 @@ public function resend()
->user()
->sendEmailVerificationNotification();

$this->notify(
"success",
__("filament-breezy::default.verification.notification_resend")
);
Notification::make()->title(__("filament-breezy::default.verification.notification_resend"))->success()->send();
$this->hasBeenSent = true;
}

Expand Down

0 comments on commit c17aab5

Please sign in to comment.