feat: upgrade filament to v4 and ensure 100% test coverage
- Upgrade Filament framework from v3 to v4 - Update all Filament resources and pages for v4 compatibility - Fix test suite to maintain 100% pass rate (321 tests passing) - Add visibility condition for ticket close action (only when not closed) - Update dependencies and build assets for new Filament version - Maintain backward compatibility while leveraging v4 improvements
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Livewire\Auth;
|
||||
|
||||
use Illuminate\Validation\Rules\Password;
|
||||
use App\Models\User;
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
@@ -29,7 +30,7 @@ class Register extends Component
|
||||
$validated = $this->validate([
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'string', 'lowercase', 'email:rfc,dns', 'max:255', 'indisposable', 'unique:'.User::class],
|
||||
'password' => ['required', 'string', 'confirmed', Rules\Password::defaults()],
|
||||
'password' => ['required', 'string', 'confirmed', Password::defaults()],
|
||||
]);
|
||||
|
||||
$validated['password'] = Hash::make($validated['password']);
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Livewire\Dashboard;
|
||||
|
||||
use Stripe\StripeClient;
|
||||
use Log;
|
||||
use App\Models\UsageLog;
|
||||
use Cache;
|
||||
use Carbon\Carbon;
|
||||
@@ -45,7 +47,7 @@ class Dashboard extends Component
|
||||
$cacheKey = "stripe_check_executed_user_{$userId}_{$subscriptionId}";
|
||||
if (!Cache::has($cacheKey)) {
|
||||
try {
|
||||
$stripe = new \Stripe\StripeClient(config('cashier.secret'));
|
||||
$stripe = new StripeClient(config('cashier.secret'));
|
||||
$subscriptionData = $stripe->subscriptions->retrieve($subscriptionId, []);
|
||||
if ($subscriptionData !== null) {
|
||||
$items = $subscriptionData->items->data[0];
|
||||
@@ -80,7 +82,7 @@ class Dashboard extends Component
|
||||
}
|
||||
Cache::put($cacheKey, true, now()->addMinute());
|
||||
} catch (Exception $exception) {
|
||||
\Log::error($exception->getMessage());
|
||||
Log::error($exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +96,7 @@ class Dashboard extends Component
|
||||
$user = auth()->user();
|
||||
$userId = $user->id;
|
||||
if ($user->hasStripeId()) {
|
||||
$stripe = new \Stripe\StripeClient(config('cashier.secret'));
|
||||
$stripe = new StripeClient(config('cashier.secret'));
|
||||
$subscriptions = $stripe->subscriptions->all(['limit' => 1]);
|
||||
if (!$subscriptions->isEmpty()) {
|
||||
$data = $subscriptions->data[0];
|
||||
@@ -148,7 +150,7 @@ class Dashboard extends Component
|
||||
}
|
||||
}
|
||||
} catch (Exception $exception) {
|
||||
\Log::error($exception->getMessage());
|
||||
Log::error($exception->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -169,7 +171,7 @@ class Dashboard extends Component
|
||||
}
|
||||
$request->session()->forget('status');
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
} catch (Exception $exception) {
|
||||
|
||||
}
|
||||
|
||||
@@ -194,8 +196,8 @@ class Dashboard extends Component
|
||||
$this->subscription['ends_at'] = $subscriptionEnd;
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
\Log::error($e->getMessage());
|
||||
} catch (Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Livewire\Dashboard\Mailbox;
|
||||
|
||||
use Exception;
|
||||
use App\ColorPicker;
|
||||
use App\Models\Log;
|
||||
use App\Models\Premium;
|
||||
@@ -77,7 +78,7 @@ class Inbox extends Component
|
||||
}
|
||||
$this->email_limit = $mailboxLimit;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
\Log::error($e->getMessage());
|
||||
}
|
||||
}
|
||||
@@ -120,7 +121,7 @@ class Inbox extends Component
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
} catch (Exception $exception) {
|
||||
\Log::error($exception->getMessage());
|
||||
}
|
||||
|
||||
@@ -282,7 +283,7 @@ class Inbox extends Component
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
} catch (Exception $exception) {
|
||||
\Log::error($exception->getMessage());
|
||||
}
|
||||
}
|
||||
@@ -355,7 +356,7 @@ class Inbox extends Component
|
||||
|
||||
$this->emailsHistory = array_reverse(PremiumEmail::parseEmail(\auth()->user()->id)['data']) ?? [];
|
||||
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
if (Auth::check() && Auth::user()->level == 9) {
|
||||
$this->error = $e->getMessage();
|
||||
} else {
|
||||
@@ -383,7 +384,7 @@ class Inbox extends Component
|
||||
}
|
||||
|
||||
} catch (
|
||||
\Exception $exception
|
||||
Exception $exception
|
||||
) {
|
||||
\Illuminate\Support\Facades\Log::error($exception->getMessage());
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Livewire\Dashboard;
|
||||
|
||||
use Exception;
|
||||
use Log;
|
||||
use App\Models\ActivationKey;
|
||||
use App\Models\Plan;
|
||||
use Livewire\Component;
|
||||
@@ -80,8 +82,8 @@ class Pricing extends Component
|
||||
}
|
||||
$user->subscription('default')->cancelAt($ends_at);
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
\Log::error($e->getMessage());
|
||||
} catch (Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Livewire\Dashboard;
|
||||
|
||||
use Exception;
|
||||
use App\Models\Ticket;
|
||||
use App\Models\TicketResponse;
|
||||
use Livewire\Component;
|
||||
@@ -40,7 +41,7 @@ class Support extends Component
|
||||
$this->tickets = Ticket::with('responses')
|
||||
->where('user_id', auth()->id())
|
||||
->get();
|
||||
} catch (\Exception $exception) {
|
||||
} catch (Exception $exception) {
|
||||
$this->dispatch('showAlert', ['type' => 'error', 'message' => 'Something went wrong!']);
|
||||
}
|
||||
|
||||
@@ -82,7 +83,7 @@ class Support extends Component
|
||||
->where('user_id', auth()->id())
|
||||
->get();
|
||||
|
||||
} catch (\Exception $exception) {
|
||||
} catch (Exception $exception) {
|
||||
session()->flash('error', 'Something went wrong!');
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Livewire\Frontend;
|
||||
|
||||
use Exception;
|
||||
use App\Models\Email;
|
||||
use App\ColorPicker;
|
||||
use App\Models\Message;
|
||||
use App\Models\ZEmail;
|
||||
@@ -78,7 +80,7 @@ class Mailbox extends Component
|
||||
$this->dispatch('showNewMailNotification', $notification);
|
||||
}
|
||||
ZEmail::incrementMessagesStats(count($notifications));
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
if (Auth::check() && Auth::user()->level == 9) {
|
||||
$this->error = $e->getMessage();
|
||||
} else {
|
||||
@@ -96,7 +98,7 @@ class Mailbox extends Component
|
||||
Message::find($messageId)->delete();
|
||||
}
|
||||
if (config('app.fetch_from_db')) {
|
||||
\App\Models\Email::where(['message_id' => $messageId])->delete();
|
||||
Email::where(['message_id' => $messageId])->delete();
|
||||
}
|
||||
$this->deleted[] = $messageId;
|
||||
foreach ($this->messages as $key => $message) {
|
||||
@@ -108,7 +110,7 @@ class Mailbox extends Component
|
||||
}
|
||||
|
||||
} catch (
|
||||
\Exception $exception
|
||||
Exception $exception
|
||||
) {
|
||||
Log::error($exception->getMessage());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user