chore: code styling via pint

This commit is contained in:
idevakk
2025-11-14 01:51:35 -08:00
parent 3892c48ef2
commit 90ab79b3a2
121 changed files with 1003 additions and 892 deletions

View File

@@ -7,32 +7,32 @@ trait ColorPicker
public static function chooseColor($letter): array
{
$colorReferences = [
"A" => ["dark" => "dark:bg-amber-500", "light" => "bg-amber-800"],
"B" => ["dark" => "dark:bg-blue-500", "light" => "bg-blue-800"],
"C" => ["dark" => "dark:bg-cyan-500", "light" => "bg-cyan-800"],
"D" => ["dark" => "dark:bg-emerald-500", "light" => "bg-emerald-800"],
"E" => ["dark" => "dark:bg-fuchsia-500", "light" => "bg-fuchsia-800"],
"F" => ["dark" => "dark:bg-gray-500", "light" => "bg-gray-800"],
"G" => ["dark" => "dark:bg-green-500", "light" => "bg-green-800"],
"H" => ["dark" => "dark:bg-indigo-500", "light" => "bg-indigo-800"],
"I" => ["dark" => "dark:bg-lime-500", "light" => "bg-lime-800"],
"J" => ["dark" => "dark:bg-neutral-500", "light" => "bg-neutral-800"],
"K" => ["dark" => "dark:bg-orange-500", "light" => "bg-orange-800"],
"L" => ["dark" => "dark:bg-pink-500", "light" => "bg-pink-800"],
"M" => ["dark" => "dark:bg-purple-500", "light" => "bg-purple-800"],
"N" => ["dark" => "dark:bg-red-500", "light" => "bg-red-800"],
"O" => ["dark" => "dark:bg-rose-500", "light" => "bg-rose-800"],
"P" => ["dark" => "dark:bg-sky-500", "light" => "bg-sky-800"],
"Q" => ["dark" => "dark:bg-slate-500", "light" => "bg-slate-800"],
"R" => ["dark" => "dark:bg-stone-500", "light" => "bg-stone-800"],
"S" => ["dark" => "dark:bg-teal-500", "light" => "bg-teal-800"],
"T" => ["dark" => "dark:bg-violet-500", "light" => "bg-violet-800"],
"U" => ["dark" => "dark:bg-yellow-500", "light" => "bg-yellow-800"],
"V" => ["dark" => "dark:bg-zinc-500", "light" => "bg-zinc-800"],
"W" => ["dark" => "dark:bg-neutral-500", "light" => "bg-neutral-800"],
"X" => ["dark" => "dark:bg-slate-500", "light" => "bg-slate-800"],
"Y" => ["dark" => "dark:bg-stone-500", "light" => "bg-stone-800"],
"Z" => ["dark" => "dark:bg-teal-500", "light" => "bg-teal-800"]
'A' => ['dark' => 'dark:bg-amber-500', 'light' => 'bg-amber-800'],
'B' => ['dark' => 'dark:bg-blue-500', 'light' => 'bg-blue-800'],
'C' => ['dark' => 'dark:bg-cyan-500', 'light' => 'bg-cyan-800'],
'D' => ['dark' => 'dark:bg-emerald-500', 'light' => 'bg-emerald-800'],
'E' => ['dark' => 'dark:bg-fuchsia-500', 'light' => 'bg-fuchsia-800'],
'F' => ['dark' => 'dark:bg-gray-500', 'light' => 'bg-gray-800'],
'G' => ['dark' => 'dark:bg-green-500', 'light' => 'bg-green-800'],
'H' => ['dark' => 'dark:bg-indigo-500', 'light' => 'bg-indigo-800'],
'I' => ['dark' => 'dark:bg-lime-500', 'light' => 'bg-lime-800'],
'J' => ['dark' => 'dark:bg-neutral-500', 'light' => 'bg-neutral-800'],
'K' => ['dark' => 'dark:bg-orange-500', 'light' => 'bg-orange-800'],
'L' => ['dark' => 'dark:bg-pink-500', 'light' => 'bg-pink-800'],
'M' => ['dark' => 'dark:bg-purple-500', 'light' => 'bg-purple-800'],
'N' => ['dark' => 'dark:bg-red-500', 'light' => 'bg-red-800'],
'O' => ['dark' => 'dark:bg-rose-500', 'light' => 'bg-rose-800'],
'P' => ['dark' => 'dark:bg-sky-500', 'light' => 'bg-sky-800'],
'Q' => ['dark' => 'dark:bg-slate-500', 'light' => 'bg-slate-800'],
'R' => ['dark' => 'dark:bg-stone-500', 'light' => 'bg-stone-800'],
'S' => ['dark' => 'dark:bg-teal-500', 'light' => 'bg-teal-800'],
'T' => ['dark' => 'dark:bg-violet-500', 'light' => 'bg-violet-800'],
'U' => ['dark' => 'dark:bg-yellow-500', 'light' => 'bg-yellow-800'],
'V' => ['dark' => 'dark:bg-zinc-500', 'light' => 'bg-zinc-800'],
'W' => ['dark' => 'dark:bg-neutral-500', 'light' => 'bg-neutral-800'],
'X' => ['dark' => 'dark:bg-slate-500', 'light' => 'bg-slate-800'],
'Y' => ['dark' => 'dark:bg-stone-500', 'light' => 'bg-stone-800'],
'Z' => ['dark' => 'dark:bg-teal-500', 'light' => 'bg-teal-800'],
];
$letter = strtoupper($letter);
@@ -41,7 +41,7 @@ trait ColorPicker
return $colorReferences[$letter];
}
return ["dark" => "dark:bg-gray-500", "light" => "bg-gray-800"];
return ['dark' => 'dark:bg-gray-500', 'light' => 'bg-gray-800'];
}
}

View File

@@ -2,35 +2,39 @@
namespace App\Filament\Pages;
use Illuminate\Database\Eloquent\Builder;
use Filament\Actions\BulkAction;
use App\Models\ActivationKey;
use App\Models\Plan;
use Filament\Actions\BulkAction;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Notifications\Notification;
use Filament\Pages\Page;
use Filament\Tables\Columns\BooleanColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Concerns\InteractsWithTable;
use Filament\Tables\Contracts\HasTable;
use Filament\Tables\Filters\SelectFilter;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Collection;
use Response;
use Str;
use Filament\Notifications\Notification;
class GenerateActivationKeys extends Page implements HasForms, HasTable
{
use InteractsWithForms, InteractsWithTable;
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-key';
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-key';
protected string $view = 'filament.pages.generate-activation-keys';
protected static string | \UnitEnum | null $navigationGroup = 'Admin';
protected static string|\UnitEnum|null $navigationGroup = 'Admin';
protected static ?string $title = 'Activation Keys';
public $plan_id;
public $quantity = 1;
public function mount(): void
@@ -97,10 +101,10 @@ class GenerateActivationKeys extends Page implements HasForms, HasTable
->label('Interval')
->getStateUsing(function ($record) {
$isMonthly = Plan::where('pricing_id', $record->price_id)->value('monthly_billing');
return $isMonthly ? 'Monthly' : 'Yearly';
}),
TextColumn::make('created_at')
->dateTime(),
];
@@ -136,12 +140,12 @@ class GenerateActivationKeys extends Page implements HasForms, HasTable
{
$text = $records->pluck('activation_key')->implode("\n");
$filename = 'activation_keys_' . now()->timestamp . '.txt';
$filename = 'activation_keys_'.now()->timestamp.'.txt';
// Store the file in the 'public' directory or a subdirectory within 'public'
$path = public_path("activation/{$filename}");
// Make sure the 'activation' folder exists, create it if it doesn't
if (!file_exists(public_path('activation'))) {
if (! file_exists(public_path('activation'))) {
mkdir(public_path('activation'), 0777, true);
}
@@ -151,5 +155,4 @@ class GenerateActivationKeys extends Page implements HasForms, HasTable
// Return the response that allows users to download the file directly
return response()->download($path)->deleteFileAfterSend(true);
}
}

View File

@@ -2,13 +2,10 @@
namespace App\Filament\Pages;
use Filament\Schemas\Schema;
use Filament\Schemas\Components\Section;
use Exception;
use App\Models\Setting;
use App\Models\ZEmail;
use Artisan;
use Ddeboer\Imap\Server;
use Exception;
use Filament\Forms\Components\Checkbox;
use Filament\Forms\Components\KeyValue;
use Filament\Forms\Components\Repeater;
@@ -19,6 +16,8 @@ use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Notifications\Notification;
use Filament\Pages\Page;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;
class Settings extends Page implements HasForms
{
@@ -26,11 +25,11 @@ class Settings extends Page implements HasForms
public ?array $data = [];
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-cog-6-tooth';
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-cog-6-tooth';
protected string $view = 'filament.pages.settings';
protected static string | \UnitEnum | null $navigationGroup = 'Web Master';
protected static string|\UnitEnum|null $navigationGroup = 'Web Master';
public function mount(): void
{
@@ -51,7 +50,7 @@ class Settings extends Page implements HasForms
]);
$this->applyDefaults($configurationSettings, [
'cron_password' => fn() => $this->generateRandomString(20),
'cron_password' => fn () => $this->generateRandomString(20),
'date_format' => 'd M Y h:i A',
'after_last_email_delete' => 'redirect_to_homepage',
]);
@@ -92,7 +91,6 @@ class Settings extends Page implements HasForms
'ads_settings' => $adsSettings,
]);
} else {
$this->form->fill([
'app_admin' => $auth_email,
@@ -142,13 +140,12 @@ class Settings extends Page implements HasForms
->collapsed()
->schema([
Repeater::make('app_social')
->statePath('app_social')
->schema([
TextInput::make('icon')->label('Icon')->required()->maxLength(100),
TextInput::make('url')->label('URL')->url()->required()->maxLength(255),
])
]),
]),
@@ -161,7 +158,7 @@ class Settings extends Page implements HasForms
Select::make('imap_settings.encryption')->options([
'none' => 'None',
'ssl' => 'SSL',
'tls' => 'TLS'
'tls' => 'TLS',
]),
Checkbox::make('imap_settings.validate_cert')->label('Validate Encryption Certificate')->default(false),
TextInput::make('imap_settings.username')->label('Username')->required(),
@@ -180,7 +177,7 @@ class Settings extends Page implements HasForms
Select::make('imap_settings.premium_encryption')->options([
'none' => 'None',
'ssl' => 'SSL',
'tls' => 'TLS'
'tls' => 'TLS',
]),
Checkbox::make('imap_settings.premium_validate_cert')->label('Validate Encryption Certificate')->default(false),
TextInput::make('imap_settings.premium_username')->label('Username')->required(),
@@ -197,64 +194,64 @@ class Settings extends Page implements HasForms
Section::make('General Configuration')
->columns(2)
->schema([
Checkbox::make('configuration_settings.enable_masking_external_link')
->label('Enable URL Masking of External URL')
->default(false)
->columnSpan(1)
->helperText('If you enable this, then we will use href.li to remove your site footprint being passed-on to external link.'),
Checkbox::make('configuration_settings.disable_mailbox_slug')
->label('Disable Mailbox Slug')
->default(false)
->columnSpan(1)
->helperText('If you enable this, then we will disable mailbox slug.'),
Checkbox::make('configuration_settings.enable_create_from_url')
->label('Enable Mail ID Creation from URL')
->default(true)
->columnSpan(1)
->helperText('If you enable this, then users will be able to create email ID from URL.'),
Checkbox::make('configuration_settings.enable_ad_block_detector')
->label('Enable Ad Block Detector')
->default(true)
->columnSpan(1)
->helperText('If you enable this, then we block all the users from using when that have Ad Blocker enabled.'),
KeyValue::make('configuration_settings.font_family')
->label('Font Family')
->columnSpan(2)
->helperText('Use Google Fonts with exact name.')
]),
Checkbox::make('configuration_settings.enable_masking_external_link')
->label('Enable URL Masking of External URL')
->default(false)
->columnSpan(1)
->helperText('If you enable this, then we will use href.li to remove your site footprint being passed-on to external link.'),
Checkbox::make('configuration_settings.disable_mailbox_slug')
->label('Disable Mailbox Slug')
->default(false)
->columnSpan(1)
->helperText('If you enable this, then we will disable mailbox slug.'),
Checkbox::make('configuration_settings.enable_create_from_url')
->label('Enable Mail ID Creation from URL')
->default(true)
->columnSpan(1)
->helperText('If you enable this, then users will be able to create email ID from URL.'),
Checkbox::make('configuration_settings.enable_ad_block_detector')
->label('Enable Ad Block Detector')
->default(true)
->columnSpan(1)
->helperText('If you enable this, then we block all the users from using when that have Ad Blocker enabled.'),
KeyValue::make('configuration_settings.font_family')
->label('Font Family')
->columnSpan(2)
->helperText('Use Google Fonts with exact name.'),
]),
Select::make('configuration_settings.default_language')->options([
'ar' => 'Arabic',
'de' => 'German',
'en' => 'English',
'fr' => 'French',
'hi' => 'Hindi',
'pl' => 'Polish',
'ru' => 'Russian',
'es' => 'Spanish',
'vi' => 'Viet',
'tr' => 'Turkish',
'no' => 'Norwegian',
'id' => 'Indonesian',
'ar' => 'Arabic',
'de' => 'German',
'en' => 'English',
'fr' => 'French',
'hi' => 'Hindi',
'pl' => 'Polish',
'ru' => 'Russian',
'es' => 'Spanish',
'vi' => 'Viet',
'tr' => 'Turkish',
'no' => 'Norwegian',
'id' => 'Indonesian',
]),
Section::make('Domains & Gmail Usernames')
->collapsed()
->columns(2)
->schema([
Repeater::make('configuration_settings.domains')
->statePath('configuration_settings.domains')
->columnSpan(1)
->schema([
TextInput::make('domain')->label('Domain')->required()->maxLength(30),
]),
Repeater::make('configuration_settings.gmailUsernames')
->statePath('configuration_settings.gmailUsernames')
->columnSpan(1)
->schema([
TextInput::make('gmailUsername')->label('Gmail Username')->required()->maxLength(30),
]),
]),
Repeater::make('configuration_settings.domains')
->statePath('configuration_settings.domains')
->columnSpan(1)
->schema([
TextInput::make('domain')->label('Domain')->required()->maxLength(30),
]),
Repeater::make('configuration_settings.gmailUsernames')
->statePath('configuration_settings.gmailUsernames')
->columnSpan(1)
->schema([
TextInput::make('gmailUsername')->label('Gmail Username')->required()->maxLength(30),
]),
]),
Section::make('Premium Domains & Gmail Usernames')
->collapsed()
@@ -356,7 +353,6 @@ class Settings extends Page implements HasForms
->statePath('data');
}
public function flushCache(): void
{
try {
@@ -378,7 +374,7 @@ class Settings extends Page implements HasForms
try {
$data = $this->form->getState();
if (!$this->testIMAP($data['imap_settings'])) {
if (! $this->testIMAP($data['imap_settings'])) {
return;
} else {
Notification::make()
@@ -389,9 +385,9 @@ class Settings extends Page implements HasForms
foreach ([
'protocol' => 'imap',
'default_account' => 'default',
'premium_protocol' => 'imap',
'premium_default_account' => 'default',
] as $key => $default) {
'premium_protocol' => 'imap',
'premium_default_account' => 'default',
] as $key => $default) {
$data['imap_settings'][$key] ??= $default;
}
@@ -403,7 +399,7 @@ class Settings extends Page implements HasForms
'outlookUsernames' => 'outlookUsername',
'premium_outlookUsernames' => 'premium_outlookUsername',
'forbidden_ids' => 'forbidden_id',
'blocked_domains' => 'blocked_domain'
'blocked_domains' => 'blocked_domain',
];
foreach ($pluckMap as $key => $subKey) {
@@ -423,13 +419,13 @@ class Settings extends Page implements HasForms
$app_admin = $setting->app_admin;
if ($app_admin == $auth_email) {
$update_res = $setting->update($data);
if($update_res) {
if ($update_res) {
Notification::make()
->title('Saved successfully')
->success()
->send();
}
} else {
} else {
Notification::make()
->title('Please Login With Administrator Credentials')
->danger()
@@ -453,7 +449,7 @@ class Settings extends Page implements HasForms
];
$create_res = Setting::create(array_merge($data));
if($create_res) {
if ($create_res) {
Notification::make()
->title('Saved successfully')
->success()
@@ -476,10 +472,12 @@ class Settings extends Page implements HasForms
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
private function applyDefaults(array &$target, array $defaults): void {
private function applyDefaults(array &$target, array $defaults): void
{
foreach ($defaults as $key => $value) {
$target[$key] ??= is_callable($value) ? $value() : $value;
}
@@ -489,16 +487,18 @@ class Settings extends Page implements HasForms
{
try {
// First check if IMAP extension is available
if (!function_exists('imap_open')) {
if (! function_exists('imap_open')) {
Notification::make()
->title('IMAP Extension Not Available')
->body('The PHP IMAP extension is not loaded in your web server. Please check your Herd PHP configuration or restart your server.')
->danger()
->send();
return false;
}
ZEmail::connectMailBox($imap);
return true;
} catch (Exception $exception) {
$errorMessage = $exception->getMessage();
@@ -509,9 +509,10 @@ class Settings extends Page implements HasForms
}
Notification::make()
->title('IMAP Error: ' . $errorMessage)
->title('IMAP Error: '.$errorMessage)
->danger()
->send();
return false;
}
}

View File

@@ -2,52 +2,45 @@
namespace App\Filament\Resources;
use Filament\Schemas\Schema;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Utilities\Set;
use Filament\Actions\ViewAction;
use Filament\Actions\EditAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\Action;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use App\Filament\Resources\BlogResource\Pages\ListBlogs;
use App\Filament\Resources\BlogResource\Pages\CreateBlog;
use App\Filament\Resources\BlogResource\Pages\EditBlog;
use App\Filament\Resources\BlogResource\Pages;
use App\Filament\Resources\BlogResource\RelationManagers;
use App\Filament\Resources\BlogResource\Pages\ListBlogs;
use App\Models\Blog;
use App\Models\Category;
use Filament\Forms;
use Filament\Actions\Action;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Actions\ViewAction;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\KeyValue;
use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Utilities\Set;
use Filament\Schemas\Schema;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\SelectFilter;
use Filament\Tables\Table;
use Illuminate\Support\Str;
class BlogResource extends Resource
{
protected static ?string $model = Blog::class;
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-m-newspaper';
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-m-newspaper';
protected static string | \UnitEnum | null $navigationGroup = 'Content';
protected static string|\UnitEnum|null $navigationGroup = 'Content';
public static function form(Schema $schema): Schema
{
$categories = Category::pluck('name', 'id')->toArray();
return $schema
->components([
Section::make('Post Information')
@@ -74,7 +67,7 @@ class BlogResource extends Resource
Select::make('is_published')
->options([
0 => 'Draft',
1 => 'Published'
1 => 'Published',
])
->searchable()
->default(1)
@@ -107,7 +100,6 @@ class BlogResource extends Resource
->valuePlaceholder('Content'),
Textarea::make('custom_header')->rows(6)->label('Custom Header (Optional)'),
]),
]);
@@ -141,7 +133,7 @@ class BlogResource extends Resource
->label('Toggle Published')
->icon('heroicon-o-eye')
->action(function (Blog $record) {
$record->update(['is_published' => !$record->is_published]);
$record->update(['is_published' => ! $record->is_published]);
}),
])
->toolbarActions([

View File

@@ -3,7 +3,6 @@
namespace App\Filament\Resources\BlogResource\Pages;
use App\Filament\Resources\BlogResource;
use Filament\Actions;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\CreateRecord;

View File

@@ -2,9 +2,8 @@
namespace App\Filament\Resources\BlogResource\Pages;
use Filament\Actions\DeleteAction;
use App\Filament\Resources\BlogResource;
use Filament\Actions;
use Filament\Actions\DeleteAction;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\EditRecord;
@@ -18,6 +17,7 @@ class EditBlog extends EditRecord
DeleteAction::make(),
];
}
protected function getRedirectUrl(): ?string
{
return $this->getResource()::getUrl('index');

View File

@@ -2,9 +2,8 @@
namespace App\Filament\Resources\BlogResource\Pages;
use Filament\Actions\CreateAction;
use App\Filament\Resources\BlogResource;
use Filament\Actions;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
class ListBlogs extends ListRecords

View File

@@ -2,39 +2,33 @@
namespace App\Filament\Resources;
use Filament\Schemas\Schema;
use Filament\Schemas\Components\Utilities\Set;
use Filament\Actions\ViewAction;
use Filament\Actions\EditAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\Action;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use App\Filament\Resources\CategoryResource\Pages\ListCategories;
use App\Filament\Resources\CategoryResource\Pages\CreateCategory;
use App\Filament\Resources\CategoryResource\Pages\EditCategory;
use App\Filament\Resources\CategoryResource\Pages;
use App\Filament\Resources\CategoryResource\RelationManagers;
use App\Filament\Resources\CategoryResource\Pages\ListCategories;
use App\Models\Category;
use Filament\Forms;
use Filament\Actions\Action;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Actions\ViewAction;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Filament\Schemas\Components\Utilities\Set;
use Filament\Schemas\Schema;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Illuminate\Support\Str;
class CategoryResource extends Resource
{
protected static ?string $model = Category::class;
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-ticket';
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-ticket';
protected static string | \UnitEnum | null $navigationGroup = 'Content';
protected static string|\UnitEnum|null $navigationGroup = 'Content';
public static function form(Schema $schema): Schema
{
@@ -52,7 +46,7 @@ class CategoryResource extends Resource
])
->columnSpanFull()
->required()
->default(1)
->default(1),
]);
}
@@ -80,7 +74,7 @@ class CategoryResource extends Resource
->label('Toggle Status')
->icon('heroicon-o-power')
->action(function (Category $record) {
$record->update(['is_active' => !$record->is_active]);
$record->update(['is_active' => ! $record->is_active]);
}),
])
->toolbarActions([

View File

@@ -3,7 +3,6 @@
namespace App\Filament\Resources\CategoryResource\Pages;
use App\Filament\Resources\CategoryResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreateCategory extends CreateRecord

View File

@@ -2,9 +2,8 @@
namespace App\Filament\Resources\CategoryResource\Pages;
use Filament\Actions\DeleteAction;
use App\Filament\Resources\CategoryResource;
use Filament\Actions;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;
class EditCategory extends EditRecord

View File

@@ -2,9 +2,8 @@
namespace App\Filament\Resources\CategoryResource\Pages;
use Filament\Actions\CreateAction;
use App\Filament\Resources\CategoryResource;
use Filament\Actions;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
class ListCategories extends ListRecords

View File

@@ -2,41 +2,36 @@
namespace App\Filament\Resources;
use Filament\Schemas\Schema;
use Filament\Actions\ViewAction;
use Filament\Actions\EditAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use App\Filament\Resources\MenuResource\Pages\ListMenus;
use App\Filament\Resources\MenuResource\Pages\CreateMenu;
use App\Filament\Resources\MenuResource\Pages\EditMenu;
use App\Filament\Resources\MenuResource\Pages;
use App\Filament\Resources\MenuResource\RelationManagers;
use App\Filament\Resources\MenuResource\Pages\ListMenus;
use App\Models\Menu;
use Filament\Forms;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Actions\ViewAction;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Schemas\Schema;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
class MenuResource extends Resource
{
protected static ?string $model = Menu::class;
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-bars-3-bottom-left';
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-bars-3-bottom-left';
protected static string | \UnitEnum | null $navigationGroup = 'Content';
protected static string|\UnitEnum|null $navigationGroup = 'Content';
public static function form(Schema $schema): Schema
{
$menus = Menu::Pluck('name', 'id')->toArray();
return $schema
->components([
TextInput::make('name')
@@ -65,7 +60,7 @@ class MenuResource extends Resource
TextColumn::make('name')->sortable(),
TextColumn::make('url')->label('URL'),
TextColumn::make('parentname.name')->label('Parent Name'),
IconColumn::make('new_tab')->label('Open in New Tab')->boolean()
IconColumn::make('new_tab')->label('Open in New Tab')->boolean(),
])
->filters([
//

View File

@@ -3,7 +3,6 @@
namespace App\Filament\Resources\MenuResource\Pages;
use App\Filament\Resources\MenuResource;
use Filament\Actions;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\CreateRecord;

View File

@@ -2,9 +2,8 @@
namespace App\Filament\Resources\MenuResource\Pages;
use Filament\Actions\DeleteAction;
use App\Filament\Resources\MenuResource;
use Filament\Actions;
use Filament\Actions\DeleteAction;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\EditRecord;
@@ -18,6 +17,7 @@ class EditMenu extends EditRecord
DeleteAction::make(),
];
}
protected function getRedirectUrl(): ?string
{
return $this->getResource()::getUrl('index');

View File

@@ -2,9 +2,8 @@
namespace App\Filament\Resources\MenuResource\Pages;
use Filament\Actions\CreateAction;
use App\Filament\Resources\MenuResource;
use Filament\Actions;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
class ListMenus extends ListRecords

View File

@@ -2,48 +2,39 @@
namespace App\Filament\Resources;
use Filament\Schemas\Schema;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Utilities\Set;
use Filament\Tables\Filters\SelectFilter;
use Filament\Actions\ViewAction;
use Filament\Actions\EditAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\Action;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use App\Filament\Resources\PageResource\Pages\ListPages;
use App\Filament\Resources\PageResource\Pages\CreatePage;
use App\Filament\Resources\PageResource\Pages\EditPage;
use App\Filament\Resources\PageResource\Pages;
use App\Filament\Resources\PageResource\RelationManagers;
use App\Filament\Resources\PageResource\Pages\ListPages;
use App\Models\Page;
use Filament\Forms;
use Filament\Actions\Action;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Actions\ViewAction;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\KeyValue;
use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Illuminate\Support\Str;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Utilities\Set;
use Filament\Schemas\Schema;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\SelectFilter;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Symfony\Contracts\Service\Attribute\Required;
use Illuminate\Support\Str;
class PageResource extends Resource
{
protected static ?string $model = Page::class;
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-document';
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-document';
protected static string | \UnitEnum | null $navigationGroup = 'Content';
protected static string|\UnitEnum|null $navigationGroup = 'Content';
public static function form(Schema $schema): Schema
{
@@ -64,7 +55,7 @@ class PageResource extends Resource
Select::make('is_published')
->options([
0 => 'Draft',
1 => 'Published'
1 => 'Published',
])
->default(1)
->required()
@@ -94,8 +85,6 @@ class PageResource extends Resource
Textarea::make('custom_header')->rows(6)->label('Custom Header (Optional)'),
]),
]);
}
@@ -126,7 +115,7 @@ class PageResource extends Resource
->label('Toggle Published')
->icon('heroicon-o-eye')
->action(function (Page $record) {
$record->update(['is_published' => !$record->is_published]);
$record->update(['is_published' => ! $record->is_published]);
}),
])
->toolbarActions([

View File

@@ -3,7 +3,6 @@
namespace App\Filament\Resources\PageResource\Pages;
use App\Filament\Resources\PageResource;
use Filament\Actions;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\CreateRecord;

View File

@@ -2,9 +2,8 @@
namespace App\Filament\Resources\PageResource\Pages;
use Filament\Actions\DeleteAction;
use App\Filament\Resources\PageResource;
use Filament\Actions;
use Filament\Actions\DeleteAction;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\EditRecord;
@@ -18,6 +17,7 @@ class EditPage extends EditRecord
DeleteAction::make(),
];
}
protected function getRedirectUrl(): ?string
{
return $this->getResource()::getUrl('index');

View File

@@ -2,9 +2,8 @@
namespace App\Filament\Resources\PageResource\Pages;
use Filament\Actions\CreateAction;
use App\Filament\Resources\PageResource;
use Filament\Actions;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
class ListPages extends ListRecords

View File

@@ -2,45 +2,33 @@
namespace App\Filament\Resources;
use Filament\Schemas\Schema;
use Filament\Schemas\Components\Section;
use Filament\Tables\Filters\SelectFilter;
use Filament\Actions\ViewAction;
use Filament\Actions\EditAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use App\Filament\Resources\PlanResource\Pages\ListPlans;
use App\Filament\Resources\PlanResource\Pages\CreatePlan;
use App\Filament\Resources\PlanResource\Pages\EditPlan;
use App\Filament\Resources\PlanResource\Pages;
use App\Filament\Resources\PlanResource\RelationManagers;
use App\Filament\Resources\PlanResource\Pages\ListPlans;
use App\Models\Plan;
use Filament\Forms;
use Filament\Forms\Components\FileUpload;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Actions\ViewAction;
use Filament\Forms\Components\KeyValue;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Set;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;
use Filament\Tables\Columns\BooleanColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\SelectFilter;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Support\Str;
use phpDocumentor\Reflection\Types\Boolean;
class PlanResource extends Resource
{
protected static ?string $model = Plan::class;
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-rectangle-stack';
protected static string | \UnitEnum | null $navigationGroup = 'Web Master';
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-rectangle-stack';
protected static string|\UnitEnum|null $navigationGroup = 'Web Master';
public static function form(Schema $schema): Schema
{
@@ -114,6 +102,7 @@ class PlanResource extends Resource
return $query->where('accept_oxapay', true);
}
}
return $query;
}),
])

View File

@@ -3,7 +3,6 @@
namespace App\Filament\Resources\PlanResource\Pages;
use App\Filament\Resources\PlanResource;
use Filament\Actions;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\CreateRecord;

View File

@@ -2,9 +2,8 @@
namespace App\Filament\Resources\PlanResource\Pages;
use Filament\Actions\DeleteAction;
use App\Filament\Resources\PlanResource;
use Filament\Actions;
use Filament\Actions\DeleteAction;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\EditRecord;
@@ -18,6 +17,7 @@ class EditPlan extends EditRecord
DeleteAction::make(),
];
}
protected function getRedirectUrl(): ?string
{
return $this->getResource()::getUrl('index');

View File

@@ -2,9 +2,8 @@
namespace App\Filament\Resources\PlanResource\Pages;
use Filament\Actions\CreateAction;
use App\Filament\Resources\PlanResource;
use Filament\Actions;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
class ListPlans extends ListRecords

View File

@@ -2,50 +2,44 @@
namespace App\Filament\Resources;
use Filament\Schemas\Schema;
use Filament\Actions\ViewAction;
use Filament\Actions\EditAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\Action;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\BulkAction;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Mail;
use App\Mail\TicketResponseNotification;
use App\Filament\Resources\TicketResource\RelationManagers\ResponsesRelationManager;
use App\Filament\Resources\TicketResource\Pages\ListTickets;
use App\Filament\Resources\TicketResource\Pages\CreateTicket;
use App\Filament\Resources\TicketResource\Pages\EditTicket;
use App\Filament\Resources\TicketResource\Pages;
use App\Filament\Resources\TicketResource\RelationManagers;
use App\Filament\Resources\TicketResource\Pages\ListTickets;
use App\Filament\Resources\TicketResource\RelationManagers\ResponsesRelationManager;
use App\Mail\TicketResponseNotification;
use App\Models\Ticket;
use App\Models\TicketResponse;
use Filament\Forms;
use Filament\Actions\Action;
use Filament\Actions\BulkAction;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Actions\ViewAction;
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Notifications\Notification;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Tables;
use Filament\Tables\Columns\BadgeColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\Filter;
use Filament\Tables\Filters\SelectFilter;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\HtmlString;
class TicketResource extends Resource
{
protected static ?string $model = Ticket::class;
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-ticket';
protected static string | \UnitEnum | null $navigationGroup = 'Support';
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-ticket';
protected static string|\UnitEnum|null $navigationGroup = 'Support';
public static function form(Schema $schema): Schema
{
@@ -99,7 +93,7 @@ class TicketResource extends Resource
->colors([
'success' => fn ($state) => $state === 'open',
'warning' => fn ($state) => $state === 'pending',
'danger' => fn ($state) => $state === 'closed',
'danger' => fn ($state) => $state === 'closed',
])
->sortable(),
TextColumn::make('created_at')
@@ -165,8 +159,8 @@ class TicketResource extends Resource
// Ticket Subject & Message
$html .= '<div class="bg-gray-100 dark:bg-gray-900 border p-2 rounded-md">';
$html .= '<h6 class="xs font-semibold text-gray-800 dark:text-gray-100">Subject: ' . e($ticket->subject) . '</h6>';
$html .= '<p class="mt-1 text-gray-700 dark:text-gray-300">Message: ' . nl2br(e($ticket->message)) . '</p>';
$html .= '<h6 class="xs font-semibold text-gray-800 dark:text-gray-100">Subject: '.e($ticket->subject).'</h6>';
$html .= '<p class="mt-1 text-gray-700 dark:text-gray-300">Message: '.nl2br(e($ticket->message)).'</p>';
$html .= '</div>';
// Responses Section
@@ -175,10 +169,10 @@ class TicketResource extends Resource
foreach ($ticket->responses as $response) {
$html .= '<div class="rounded-md border p-2 bg-gray-50 dark:bg-gray-800">';
$html .= '<div class="text-xs text-gray-600 dark:text-gray-300">';
$html .= '<strong>' . e($response->user->name) . '</strong>';
$html .= '<span class="ml-2 text-[11px] text-gray-500">' . e($response->created_at->diffForHumans()) . '</span>';
$html .= '<strong>'.e($response->user->name).'</strong>';
$html .= '<span class="ml-2 text-[11px] text-gray-500">'.e($response->created_at->diffForHumans()).'</span>';
$html .= '</div>';
$html .= '<p class="mt-1 text-gray-800 dark:text-gray-100">' . nl2br(e($response->response)) . '</p>';
$html .= '<p class="mt-1 text-gray-800 dark:text-gray-100">'.nl2br(e($response->response)).'</p>';
$html .= '</div>';
}

View File

@@ -3,7 +3,6 @@
namespace App\Filament\Resources\TicketResource\Pages;
use App\Filament\Resources\TicketResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreateTicket extends CreateRecord

View File

@@ -2,9 +2,8 @@
namespace App\Filament\Resources\TicketResource\Pages;
use Filament\Actions\DeleteAction;
use App\Filament\Resources\TicketResource;
use Filament\Actions;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;
class EditTicket extends EditRecord

View File

@@ -2,9 +2,8 @@
namespace App\Filament\Resources\TicketResource\Pages;
use Filament\Actions\CreateAction;
use App\Filament\Resources\TicketResource;
use Filament\Actions;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
class ListTickets extends ListRecords

View File

@@ -2,22 +2,17 @@
namespace App\Filament\Resources\TicketResource\RelationManagers;
use Filament\Schemas\Schema;
use Filament\Actions\CreateAction;
use Filament\Actions\EditAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\CreateAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Forms;
use Filament\Actions\EditAction;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables;
use Filament\Schemas\Schema;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
class ResponsesRelationManager extends RelationManager
{

View File

@@ -2,45 +2,38 @@
namespace App\Filament\Resources;
use Filament\Schemas\Schema;
use Filament\Actions\EditAction;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\BulkAction;
use Exception;
use App\Filament\Resources\UserResource\Pages\ListUsers;
use App\Filament\Resources\UserResource\Pages\CreateUser;
use App\Filament\Resources\UserResource\Pages\EditUser;
use App\Filament\Resources\UserResource\Pages;
use App\Filament\Resources\UserResource\Pages\ListUsers;
use App\Filament\Resources\UserResource\RelationManagers\LogsRelationManager;
use App\Filament\Resources\UserResource\RelationManagers\UsageLogsRelationManager;
use App\Models\User;
use DB;
use Filament\Actions\Action;
use Filament\Forms;
use Exception;
use Filament\Actions\BulkAction;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Notifications\Notification;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Schemas\Schema;
use Filament\Tables\Columns\BadgeColumn;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\SelectFilter;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Support\Facades\Response;
class UserResource extends Resource
{
protected static ?string $model = User::class;
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-users';
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-users';
protected static string | \UnitEnum | null $navigationGroup = 'Admin';
protected static string|\UnitEnum|null $navigationGroup = 'Admin';
public static function form(Schema $schema): Schema
{
@@ -58,7 +51,7 @@ class UserResource extends Resource
->label('Email Verification Status')
->disabled()
->formatStateUsing(fn ($record) => $record->email_verified_at ?? ''
? 'Verified at ' . $record->email_verified_at->toDateTimeString()
? 'Verified at '.$record->email_verified_at->toDateTimeString()
: 'Not Verified')
->helperText('Shows whether the user has verified their email address.'),
TextInput::make('stripe_id')
@@ -103,7 +96,7 @@ class UserResource extends Resource
->falseIcon('heroicon-o-x-circle')
->trueColor('success')
->falseColor('danger')
->getStateUsing(fn ($record) => !is_null($record->email_verified_at))
->getStateUsing(fn ($record) => ! is_null($record->email_verified_at))
->sortable(),
BadgeColumn::make('level')
->label('User Level')
@@ -118,7 +111,7 @@ class UserResource extends Resource
->colors([
'success' => fn ($state) => $state === 'Normal User',
'danger' => fn ($state) => $state === 'Banned',
'warning' => fn ($state) => $state === 'Super Admin',
'warning' => fn ($state) => $state === 'Super Admin',
])
->sortable(),
TextColumn::make('stripe_id')->label('Stripe ID')->copyable(),
@@ -179,7 +172,6 @@ class UserResource extends Resource
->whereIn('id', $records->pluck('id'))
->update(['level' => $newLevel]);
Notification::make()
->title('User Level Updated')
->body('The selected users\' levels have been updated successfully.')
@@ -219,6 +211,4 @@ class UserResource extends Resource
'edit' => EditUser::route('/{record}/edit'),
];
}
}

View File

@@ -3,7 +3,6 @@
namespace App\Filament\Resources\UserResource\Pages;
use App\Filament\Resources\UserResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreateUser extends CreateRecord

View File

@@ -2,11 +2,10 @@
namespace App\Filament\Resources\UserResource\Pages;
use Filament\Actions\DeleteAction;
use App\Filament\Resources\UserResource;
use App\Models\User;
use Filament\Actions;
use Filament\Actions\Action;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;
use Illuminate\Support\Facades\Response;
@@ -79,7 +78,7 @@ class EditUser extends EditRecord
function () use ($csvContent) {
echo $csvContent;
},
"user_{$record->id}_report_" . now()->format('Ymd_His') . '.csv',
"user_{$record->id}_report_".now()->format('Ymd_His').'.csv',
['Content-Type' => 'text/csv']
);
})

View File

@@ -2,9 +2,8 @@
namespace App\Filament\Resources\UserResource\Pages;
use Filament\Actions\CreateAction;
use App\Filament\Resources\UserResource;
use Filament\Actions;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
class ListUsers extends ListRecords

View File

@@ -2,19 +2,16 @@
namespace App\Filament\Resources\UserResource\RelationManagers;
use Filament\Tables\Columns\TextColumn;
use Filament\Actions\BulkActionGroup;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
class LogsRelationManager extends RelationManager
{
protected static string $relationship = 'logs';
protected static ?string $title = 'General Logs';
public function table(Table $table): Table
@@ -37,15 +34,15 @@ class LogsRelationManager extends RelationManager
//
])
->headerActions([
//Tables\Actions\CreateAction::make(),
// Tables\Actions\CreateAction::make(),
])
->recordActions([
//Tables\Actions\EditAction::make(),
//Tables\Actions\DeleteAction::make(),
// Tables\Actions\EditAction::make(),
// Tables\Actions\DeleteAction::make(),
])
->toolbarActions([
BulkActionGroup::make([
//Tables\Actions\DeleteBulkAction::make(),
// Tables\Actions\DeleteBulkAction::make(),
]),
]);
}

View File

@@ -2,15 +2,11 @@
namespace App\Filament\Resources\UserResource\RelationManagers;
use Filament\Tables\Columns\TextColumn;
use Filament\Actions\BulkActionGroup;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
class UsageLogsRelationManager extends RelationManager
{
@@ -42,15 +38,15 @@ class UsageLogsRelationManager extends RelationManager
//
])
->headerActions([
//Tables\Actions\CreateAction::make(),
// Tables\Actions\CreateAction::make(),
])
->recordActions([
//Tables\Actions\EditAction::make(),
//Tables\Actions\DeleteAction::make(),
// Tables\Actions\EditAction::make(),
// Tables\Actions\DeleteAction::make(),
])
->toolbarActions([
BulkActionGroup::make([
//Tables\Actions\DeleteBulkAction::make(),
// Tables\Actions\DeleteBulkAction::make(),
]),
]);
}

View File

@@ -79,6 +79,7 @@ class StatsOverview extends BaseWidget
if ($today == $yesterday) {
return null;
}
return $today > $yesterday ? 'heroicon-o-arrow-up' : 'heroicon-o-arrow-down';
}
@@ -87,6 +88,7 @@ class StatsOverview extends BaseWidget
if ($today == $yesterday) {
return 'gray';
}
return $today > $yesterday ? 'success' : 'danger';
}
@@ -95,6 +97,7 @@ class StatsOverview extends BaseWidget
if ($period === 'yesterday') {
return User::where('created_at', '<', Carbon::today('UTC')->startOfDay())->count();
}
return User::count();
}
@@ -111,6 +114,7 @@ class StatsOverview extends BaseWidget
if ($period === 'yesterday') {
return Log::where('created_at', '<', Carbon::today('UTC')->startOfDay())->count();
}
return Log::count();
}
@@ -131,6 +135,7 @@ class StatsOverview extends BaseWidget
->where('created_at', '<', Carbon::today('UTC')->startOfDay())
->count();
}
return User::whereNotNull('stripe_id')->count();
}
@@ -139,6 +144,7 @@ class StatsOverview extends BaseWidget
if ($period === 'yesterday') {
return PremiumEmail::where('created_at', '<', Carbon::today('UTC')->startOfDay())->count();
}
return PremiumEmail::count();
}

View File

@@ -4,12 +4,12 @@ namespace App\Http\Controllers;
use App\Models\Premium;
use App\Models\ZEmail;
use Illuminate\Http\Request;
use Session;
class AppController extends Controller
{
public function mailbox($email = null) {
public function mailbox($email = null)
{
if ($email) {
$validatedData = validator(['email' => $email], [
'email' => 'required|email',
@@ -18,39 +18,48 @@ class AppController extends Controller
if (json_decode(config('app.settings.configuration_settings'))->enable_create_from_url) {
ZEmail::createCustomEmailFull($email);
}
return redirect()->route('mailbox');
}
if (!ZEmail::getEmail()) {
if (! ZEmail::getEmail()) {
return redirect()->route('home');
}
if (json_decode(config('app.settings.configuration_settings'))->disable_mailbox_slug) {
return redirect()->route('home');
}
return $this->app();
}
public function app() {
public function app()
{
return redirect()->route('home');
}
public function switch($email) {
public function switch($email)
{
ZEmail::setEmail($email);
if (json_decode(config('app.settings.configuration_settings'))->disable_mailbox_slug) {
return redirect()->route('home');
}
return redirect()->route('mailbox');
}
public function delete($email = null) {
public function delete($email = null)
{
if ($email) {
$emails = ZEmail::getEmails();
ZEmail::removeEmail($email);
return redirect()->route('mailbox');
} else {
return redirect()->route('home');
}
}
public function switchP($email) {
public function switchP($email)
{
if (Session::get('isInboxTypePremium')) {
Premium::setEmailP($email);
} else {
@@ -59,10 +68,12 @@ class AppController extends Controller
if (json_decode(config('app.settings.configuration_settings'))->disable_mailbox_slug) {
return redirect()->route('dashboard');
}
return redirect()->route('dashboard.premium');
}
public function deleteP($email = null) {
public function deleteP($email = null)
{
if ($email) {
if (Session::get('isInboxTypePremium')) {
$emails = Premium::getEmails();
@@ -71,43 +82,50 @@ class AppController extends Controller
$emails = ZEmail::getEmails();
ZEmail::removeEmail($email);
}
return redirect()->route('dashboard.premium');
} else {
return redirect()->route('dashboard');
}
}
public function locale($locale) {
public function locale($locale)
{
if (in_array($locale, config('app.locales'))) {
session(['locale' => $locale]);
return redirect()->back();
}
abort(400);
}
private function getStringBetween($string, $start, $end) {
$string = ' ' . $string;
private function getStringBetween($string, $start, $end)
{
$string = ' '.$string;
$ini = strpos($string, $start);
if ($ini == 0) return '';
if ($ini == 0) {
return '';
}
$ini += strlen($start);
$len = strpos($string, $end, $ini) - $ini;
return substr($string, $ini, $len);
}
private function setHeaders($page) {
private function setHeaders($page)
{
$header = $page->header;
foreach ($page->meta ? unserialize($page->meta) : [] as $meta) {
if ($meta['name'] == 'canonical') {
$header .= '<link rel="canonical" href="' . $meta['content'] . '" />';
} else if (str_contains($meta['name'], 'og:')) {
$header .= '<meta property="' . $meta['name'] . '" content="' . $meta['content'] . '" />';
$header .= '<link rel="canonical" href="'.$meta['content'].'" />';
} elseif (str_contains($meta['name'], 'og:')) {
$header .= '<meta property="'.$meta['name'].'" content="'.$meta['content'].'" />';
} else {
$header .= '<meta name="' . $meta['name'] . '" content="' . $meta['content'] . '" />';
$header .= '<meta name="'.$meta['name'].'" content="'.$meta['content'].'" />';
}
}
$page->header = $header;
return $page;
}
}

View File

@@ -2,9 +2,9 @@
namespace App\Http\Controllers\Auth;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use App\Http\Controllers\Controller;
use Illuminate\Auth\Events\Verified;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\EmailVerificationRequest;
use Illuminate\Http\RedirectResponse;

View File

@@ -2,15 +2,16 @@
namespace App\Http\Controllers;
use Log;
use Exception;
use App\NotifyMe;
use Carbon\Carbon;
use Exception;
use Illuminate\Http\Request;
use Log;
class WebhookController extends Controller
{
use NotifyMe;
public function oxapay(Request $request)
{
// Get the request data
@@ -18,8 +19,9 @@ class WebhookController extends Controller
$data = json_decode($postData, true);
// Validate request data
if (!$data || !isset($data['type']) || !in_array($data['type'], ['invoice', 'payment_link', 'payout'])) {
if (! $data || ! isset($data['type']) || ! in_array($data['type'], ['invoice', 'payment_link', 'payout'])) {
Log::warning('Invalid Oxapay webhook data', ['data' => $data]);
return response('Invalid data.type', 400);
}
@@ -53,11 +55,11 @@ class WebhookController extends Controller
'date' => $date,
]);
$message = "✅ Oxapay Invoice Payment Success\n" .
"Track ID: {$trackId}\n" .
"Email: {$email}\n" .
"Amount: {$amount} {$currency}\n" .
"Order ID: {$orderId}\n" .
$message = "✅ Oxapay Invoice Payment Success\n".
"Track ID: {$trackId}\n".
"Email: {$email}\n".
"Amount: {$amount} {$currency}\n".
"Order ID: {$orderId}\n".
"Time: {$date}";
self::sendTelegramNotification($message);
} elseif ($data['type'] === 'payout') {
@@ -83,13 +85,13 @@ class WebhookController extends Controller
'date' => $date,
]);
$message = "📤 Oxapay Payout Confirmed\n" .
"Track ID: {$trackId}\n" .
"Amount: {$amount} {$currency}\n" .
"Network: {$network}\n" .
"Address: {$address}\n" .
"Transaction Hash: {$txHash}\n" .
"Description: {$description}\n" .
$message = "📤 Oxapay Payout Confirmed\n".
"Track ID: {$trackId}\n".
"Amount: {$amount} {$currency}\n".
"Network: {$network}\n".
"Address: {$address}\n".
"Transaction Hash: {$txHash}\n".
"Description: {$description}\n".
"Date: {$date}";
self::sendTelegramNotification($message);
}
@@ -100,13 +102,15 @@ class WebhookController extends Controller
self::sendTelegramNotification("
Failed to process Oxapay webhook\n
Type: {$data['type']}\n
Email/Track ID: " . ($data['type'] === 'invoice' ? ($data['email'] ?? 'Unknown') : ($data['track_id'] ?? 'Unknown')) . "\n
Email/Track ID: ".($data['type'] === 'invoice' ? ($data['email'] ?? 'Unknown') : ($data['track_id'] ?? 'Unknown'))."\n
Error: {$e->getMessage()}
");
return response('Processing error', 400);
}
} else {
Log::warning('Invalid Oxapay HMAC signature', ['hmac_header' => $hmacHeader, 'calculated_hmac' => $calculatedHmac]);
return response('Invalid HMAC signature', 400);
}
}

View File

@@ -11,7 +11,7 @@ class CheckPageSlug
/**
* Handle an incoming request.
*
* @param Closure(Request):Response $next
* @param Closure(Request):Response $next
*/
public function handle(Request $request, Closure $next): Response
{
@@ -21,9 +21,10 @@ class CheckPageSlug
if (file_exists($publicPath) && is_file($publicPath) && pathinfo($slug, PATHINFO_EXTENSION) === 'php') {
ob_start();
include($publicPath);
include $publicPath;
$content = ob_get_clean();
ob_flush();
return response($content);
}

View File

@@ -12,7 +12,7 @@ class CheckUserBanned
/**
* Handle an incoming request.
*
* @param Closure(Request):Response $next
* @param Closure(Request):Response $next
*/
public function handle(Request $request, Closure $next): Response
{
@@ -20,6 +20,7 @@ class CheckUserBanned
// Return the banned page instead of proceeding with the request
return response()->view('banned');
}
return $next($request);
}
}

View File

@@ -2,8 +2,8 @@
namespace App\Http\Middleware;
use Exception;
use Closure;
use Exception;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -12,7 +12,7 @@ class Locale
/**
* Handle an incoming request.
*
* @param Closure(Request):Response $next
* @param Closure(Request):Response $next
*/
public function handle(Request $request, Closure $next): Response
{
@@ -24,6 +24,7 @@ class Locale
} catch (Exception $e) {
}
app()->setLocale(session('locale', session('browser-locale', config('app.settings.language', config('app.locale', 'en')))));
return $next($request);
}
}

View File

@@ -3,16 +3,13 @@
namespace App\Listeners;
use App\NotifyMe;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Facades\Log;
use Laravel\Cashier\Events\WebhookReceived;
use Livewire\Livewire;
class StripeEventListener
{
use NotifyMe;
/**
* Create the event listener.
*/
@@ -32,10 +29,10 @@ class StripeEventListener
$amount = $event->payload['data']['object']['amount_paid'] / 100 ?? 'Unknown'; // Convert cents to dollars
$email = $event->payload['data']['object']['customer_email'] ?? 'Unknown';
$message = "✅ Payment Success\n" .
"Email: {$email}\n" .
"Amount: $" . number_format($amount, 2) . "\n" .
"Time: " . now()->toDateTimeString();
$message = "✅ Payment Success\n".
"Email: {$email}\n".
'Amount: $'.number_format($amount, 2)."\n".
'Time: '.now()->toDateTimeString();
self::sendTelegramNotification($message);
}
@@ -45,9 +42,9 @@ class StripeEventListener
$email = $event->payload['data']['object']['customer_email'] ?? 'Unknown';
$message = "❌ Subscription Canceled\n" .
"Email: {$email}\n" .
"Time: " . now()->toDateTimeString();
$message = "❌ Subscription Canceled\n".
"Email: {$email}\n".
'Time: '.now()->toDateTimeString();
self::sendTelegramNotification($message);
}
}

View File

@@ -4,17 +4,22 @@ namespace App\Livewire;
use App\Models\ZEmail;
use Livewire\Component;
use Request;
use Session;
class AddOn extends Component
{
public $title = "";
public $description = "";
public $keywords = "";
public $route = "";
public $title = '';
public $description = '';
public $keywords = '';
public $route = '';
public $faqs = [];
public $faqSchema;
protected $listeners = ['fetchMessages' => 'checkIfAnyMessage'];
public function checkIfAnyMessage()
@@ -38,18 +43,18 @@ class AddOn extends Component
$this->route = $route;
$this->faqs = $this->faqs[$route];
$this->faqSchema = [
"@context" => "https://schema.org",
"@type" => "FAQPage",
"mainEntity" => collect($this->faqs)->map(function ($faq) {
'@context' => 'https://schema.org',
'@type' => 'FAQPage',
'mainEntity' => collect($this->faqs)->map(function ($faq) {
return [
"@type" => "Question",
"name" => $faq['title'],
"acceptedAnswer" => [
"@type" => "Answer",
"text" => $faq['content']
]
'@type' => 'Question',
'name' => $faq['title'],
'acceptedAnswer' => [
'@type' => 'Answer',
'text' => $faq['content'],
],
];
})->toArray()
})->toArray(),
];
} elseif ($route == 'disposable-gmail') {
$this->title = 'Disposable Gmail Email | Free Temporary Gmail Inbox Online';
@@ -58,18 +63,18 @@ class AddOn extends Component
$this->route = $route;
$this->faqs = $this->faqs[$route];
$this->faqSchema = [
"@context" => "https://schema.org",
"@type" => "FAQPage",
"mainEntity" => collect($this->faqs)->map(function ($faq) {
'@context' => 'https://schema.org',
'@type' => 'FAQPage',
'mainEntity' => collect($this->faqs)->map(function ($faq) {
return [
"@type" => "Question",
"name" => $faq['title'],
"acceptedAnswer" => [
"@type" => "Answer",
"text" => $faq['content']
]
'@type' => 'Question',
'name' => $faq['title'],
'acceptedAnswer' => [
'@type' => 'Answer',
'text' => $faq['content'],
],
];
})->toArray()
})->toArray(),
];
} elseif ($route == 'disposable-outlook') {
@@ -79,18 +84,18 @@ class AddOn extends Component
$this->route = $route;
$this->faqs = $this->faqs[$route];
$this->faqSchema = [
"@context" => "https://schema.org",
"@type" => "FAQPage",
"mainEntity" => collect($this->faqs)->map(function ($faq) {
'@context' => 'https://schema.org',
'@type' => 'FAQPage',
'mainEntity' => collect($this->faqs)->map(function ($faq) {
return [
"@type" => "Question",
"name" => $faq['title'],
"acceptedAnswer" => [
"@type" => "Answer",
"text" => $faq['content']
]
'@type' => 'Question',
'name' => $faq['title'],
'acceptedAnswer' => [
'@type' => 'Answer',
'text' => $faq['content'],
],
];
})->toArray()
})->toArray(),
];
} elseif ($route == 'disposable-yahoo') {
$this->title = 'Disposable Yahoo Mail | Free Temporary Yahoo Inbox';
@@ -99,18 +104,18 @@ class AddOn extends Component
$this->route = $route;
$this->faqs = $this->faqs[$route];
$this->faqSchema = [
"@context" => "https://schema.org",
"@type" => "FAQPage",
"mainEntity" => collect($this->faqs)->map(function ($faq) {
'@context' => 'https://schema.org',
'@type' => 'FAQPage',
'mainEntity' => collect($this->faqs)->map(function ($faq) {
return [
"@type" => "Question",
"name" => $faq['title'],
"acceptedAnswer" => [
"@type" => "Answer",
"text" => $faq['content']
]
'@type' => 'Question',
'name' => $faq['title'],
'acceptedAnswer' => [
'@type' => 'Answer',
'text' => $faq['content'],
],
];
})->toArray()
})->toArray(),
];
} elseif ($route == 'gmailnator') {
$this->title = 'Gmailnator - Free Temporary Gmail Email Address Generator';
@@ -119,18 +124,18 @@ class AddOn extends Component
$this->route = $route;
$this->faqs = $this->faqs[$route];
$this->faqSchema = [
"@context" => "https://schema.org",
"@type" => "FAQPage",
"mainEntity" => collect($this->faqs)->map(function ($faq) {
'@context' => 'https://schema.org',
'@type' => 'FAQPage',
'mainEntity' => collect($this->faqs)->map(function ($faq) {
return [
"@type" => "Question",
"name" => $faq['title'],
"acceptedAnswer" => [
"@type" => "Answer",
"text" => $faq['content']
]
'@type' => 'Question',
'name' => $faq['title'],
'acceptedAnswer' => [
'@type' => 'Answer',
'text' => $faq['content'],
],
];
})->toArray()
})->toArray(),
];
} elseif ($route == 'emailnator') {
$this->title = 'Emailnator - Free Disposable Temporary Email Service';
@@ -139,18 +144,18 @@ class AddOn extends Component
$this->route = $route;
$this->faqs = $this->faqs[$route];
$this->faqSchema = [
"@context" => "https://schema.org",
"@type" => "FAQPage",
"mainEntity" => collect($this->faqs)->map(function ($faq) {
'@context' => 'https://schema.org',
'@type' => 'FAQPage',
'mainEntity' => collect($this->faqs)->map(function ($faq) {
return [
"@type" => "Question",
"name" => $faq['title'],
"acceptedAnswer" => [
"@type" => "Answer",
"text" => $faq['content']
]
'@type' => 'Question',
'name' => $faq['title'],
'acceptedAnswer' => [
'@type' => 'Answer',
'text' => $faq['content'],
],
];
})->toArray()
})->toArray(),
];
} elseif ($route == 'temp-gmail') {
$this->title = 'Temp Gmail | Free Temporary Gmail Inbox for Instant Use';
@@ -159,18 +164,18 @@ class AddOn extends Component
$this->route = $route;
$this->faqs = $this->faqs[$route];
$this->faqSchema = [
"@context" => "https://schema.org",
"@type" => "FAQPage",
"mainEntity" => collect($this->faqs)->map(function ($faq) {
'@context' => 'https://schema.org',
'@type' => 'FAQPage',
'mainEntity' => collect($this->faqs)->map(function ($faq) {
return [
"@type" => "Question",
"name" => $faq['title'],
"acceptedAnswer" => [
"@type" => "Answer",
"text" => $faq['content']
]
'@type' => 'Question',
'name' => $faq['title'],
'acceptedAnswer' => [
'@type' => 'Answer',
'text' => $faq['content'],
],
];
})->toArray()
})->toArray(),
];
}

View File

@@ -2,12 +2,11 @@
namespace App\Livewire\Auth;
use Illuminate\Validation\Rules\Password;
use App\Models\User;
use Illuminate\Auth\Events\Registered;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\Rules;
use Illuminate\Validation\Rules\Password;
use Livewire\Attributes\Layout;
use Livewire\Component;

View File

@@ -8,9 +8,11 @@ use Livewire\Component;
class Blog extends Component
{
public $postDetail;
public $category;
public function mount($slug) {
public function mount($slug)
{
$this->postDetail = \App\Models\Blog::where('slug', $slug)->firstOrFail();
$this->category = Category::where('id', $this->postDetail->category_id)->first();
}

View File

@@ -8,14 +8,17 @@ use Session;
class Bulk extends Component
{
public $bulkEmails = [];
public $bulkCount = 1;
private $isSubscribed = false;
public function mount() {
public function mount()
{
$subscriptionCheck = auth()->user()->subscribedToProduct(config('app.plans')[0]['product_id']);
Session::put('isSubscribed', $subscriptionCheck);
}
public function generateBulk()
{
$this->validate([
@@ -34,11 +37,11 @@ class Bulk extends Component
public function downloadBulk()
{
// Ensure there's something to download
if (empty($this->bulkEmails) || !is_array($this->bulkEmails)) {
if (empty($this->bulkEmails) || ! is_array($this->bulkEmails)) {
return;
}
$filename = 'bulk_emails_' . now()->format('Ymd_His') . '.txt';
$filename = 'bulk_emails_'.now()->format('Ymd_His').'.txt';
$content = implode(PHP_EOL, $this->bulkEmails);
return response()->streamDownload(function () use ($content) {
@@ -49,40 +52,42 @@ class Bulk extends Component
private function randomEmail(): string
{
$domain = $this->getRandomDomain();
if ($domain == "gmail.com" || $domain == "googlemail.com") {
if ($domain == 'gmail.com' || $domain == 'googlemail.com') {
$uname = $this->getRandomGmailUser();
$uname_len = strlen($uname);
$len_power = $uname_len - 1;
$combination = pow(2,$len_power);
$rand_comb = mt_rand(1,$combination);
$formatted = implode(' ',str_split($uname));
$combination = pow(2, $len_power);
$rand_comb = mt_rand(1, $combination);
$formatted = implode(' ', str_split($uname));
$uname_exp = explode(' ', $formatted);
$bin = intval("");
for($i=0; $i<$len_power; $i++) {
$bin .= mt_rand(0,1);
$bin = intval('');
for ($i = 0; $i < $len_power; $i++) {
$bin .= mt_rand(0, 1);
}
$bin = explode(' ', implode(' ',str_split(strval($bin))));
$bin = explode(' ', implode(' ', str_split(strval($bin))));
$email = "";
for($i=0; $i<$len_power; $i++) {
$email = '';
for ($i = 0; $i < $len_power; $i++) {
$email .= $uname_exp[$i];
if($bin[$i]) {
$email .= ".";
if ($bin[$i]) {
$email .= '.';
}
}
$email .= $uname_exp[$i];
$gmail_rand = mt_rand(1,10);
if($gmail_rand > 5) {
$email .= "@gmail.com";
$gmail_rand = mt_rand(1, 10);
if ($gmail_rand > 5) {
$email .= '@gmail.com';
} else {
$email .= "@googlemail.com";
$email .= '@googlemail.com';
}
return $email;
} else {
return $this->generateRandomUsername().'@'.$domain;
}
}
private function generateRandomUsername(): string
{
$start = json_decode(config('app.settings.configuration_settings'))->random_username_length_min ?? 0;
@@ -90,36 +95,48 @@ class Bulk extends Component
if ($start == 0 && $end == 0) {
return $this->generatePronounceableWord();
}
return $this->generatedRandomBetweenLength($start, $end);
}
private function generatedRandomBetweenLength($start, $end): string
{
$length = rand($start, $end);
return $this->generateRandomString($length);
}
private function getRandomDomain() {
private function getRandomDomain()
{
$domains = json_decode(config('app.settings.configuration_settings'))->premium_domains ?? [];
$count = count($domains);
return $count > 0 ? $domains[rand(1, $count) - 1] : '';
}
private function getRandomGmailUser() {
private function getRandomGmailUser()
{
$gmailusername = json_decode(config('app.settings.configuration_settings'))->premium_gmailUsernames ?? [];
$count = count($gmailusername);
return $count > 0 ? $gmailusername[rand(1, $count) - 1] : '';
}
private function generatePronounceableWord(): string
{
$c = 'bcdfghjklmnprstvwz'; //consonants except hard to speak ones
$v = 'aeiou'; //vowels
$a = $c . $v; //both
$c = 'bcdfghjklmnprstvwz'; // consonants except hard to speak ones
$v = 'aeiou'; // vowels
$a = $c.$v; // both
$random = '';
for ($j = 0; $j < 2; $j++) {
$random .= $c[rand(0, strlen($c) - 1)];
$random .= $v[rand(0, strlen($v) - 1)];
$random .= $a[rand(0, strlen($a) - 1)];
}
return $random;
}
private function generateRandomString($length = 10): string
{
$characters = '0123456789abcdefghijklmnopqrstuvwxyz';
@@ -128,6 +145,7 @@ class Bulk extends Component
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}

View File

@@ -4,15 +4,17 @@ namespace App\Livewire\Dashboard;
use Livewire\Component;
use Session;
use function Pest\Laravel\withoutMockingConsoleOutput;
class BulkGmail extends Component
{
public $email;
public int $quantity = 10;
public $bulkEmails = [];
public function mount() {
public function mount()
{
$subscriptionCheck = auth()->user()->subscribedToProduct(config('app.plans')[0]['product_id']);
Session::put('isSubscribed', $subscriptionCheck);
}
@@ -32,17 +34,17 @@ class BulkGmail extends Component
$this->bulkEmails = [];
}
$this->bulkEmails = $this->generateDotVariants(explode("@", $this->email)[0], $this->quantity);
$this->bulkEmails = $this->generateDotVariants(explode('@', $this->email)[0], $this->quantity);
}
public function downloadBulk()
{
// Ensure there's something to download
if (empty($this->bulkEmails) || !is_array($this->bulkEmails)) {
if (empty($this->bulkEmails) || ! is_array($this->bulkEmails)) {
return;
}
$filename = 'bulk_gmails_' . now()->format('Ymd_His') . '.txt';
$filename = 'bulk_gmails_'.now()->format('Ymd_His').'.txt';
$content = implode(PHP_EOL, $this->bulkEmails);
return response()->streamDownload(function () use ($content) {
@@ -66,11 +68,11 @@ class BulkGmail extends Component
$lastPos = 0;
foreach ($combo as $pos) {
$dotted .= substr($uname, $lastPos, $pos - $lastPos) . '.';
$dotted .= substr($uname, $lastPos, $pos - $lastPos).'.';
$lastPos = $pos;
}
$dotted .= substr($uname, $lastPos);
$results[] = $dotted . '@gmail.com';
$results[] = $dotted.'@gmail.com';
if (count($results) >= $quantity) {
return $results;

View File

@@ -2,8 +2,6 @@
namespace App\Livewire\Dashboard;
use Stripe\StripeClient;
use Log;
use App\Models\UsageLog;
use Cache;
use Carbon\Carbon;
@@ -11,13 +9,19 @@ use DB;
use Exception;
use Illuminate\Http\Request;
use Livewire\Component;
use Log;
use Stripe\StripeClient;
class Dashboard extends Component
{
public $message;
public $usageLog;
public $subscription;
public $plans;
public $showStripeBilling = false;
public function paymentStatus(Request $request)
@@ -26,6 +30,7 @@ class Dashboard extends Component
$currentUrl = $request->fullUrl();
if ($status == 'success') {
$this->syncSubscription();
return redirect()->route('dashboard')->with('status', 'success');
} elseif ($status == 'cancel') {
return redirect()->route('dashboard')->with('status', 'cancel');
@@ -39,13 +44,13 @@ class Dashboard extends Component
$userId = $user->id;
if ($user->subscribed()) {
$subscription = $user->subscriptions()
//->where(['stripe_status' => 'active'])
// ->where(['stripe_status' => 'active'])
->orderByDesc('updated_at')
->first();
if ($subscription !== null) {
$subscriptionId = $subscription->stripe_id;
$cacheKey = "stripe_check_executed_user_{$userId}_{$subscriptionId}";
if (!Cache::has($cacheKey)) {
if (! Cache::has($cacheKey)) {
try {
$stripe = new StripeClient(config('cashier.secret'));
$subscriptionData = $stripe->subscriptions->retrieve($subscriptionId, []);
@@ -60,11 +65,11 @@ class Dashboard extends Component
if ($cancel_at_period_end) {
$final_ends_at = Carbon::createFromTimestamp($cancel_at)->toDateTimeString();
} else {
if ($cancel_at === null && $canceled_at !== null && $status === "canceled" && $cancel_at_period_end === false) {
//$final_ends_at = Carbon::createFromTimestamp($canceled_at)->toDateTimeString();
if ($cancel_at === null && $canceled_at !== null && $status === 'canceled' && $cancel_at_period_end === false) {
// $final_ends_at = Carbon::createFromTimestamp($canceled_at)->toDateTimeString();
$final_ends_at = Carbon::now()->subDays(2)->toDateTimeString();
$redirect = true;
} elseif($status === "active" && $cancel_at !== null) {
} elseif ($status === 'active' && $cancel_at !== null) {
$final_ends_at = Carbon::createFromTimestamp($cancel_at)->toDateTimeString();
} else {
$final_ends_at = null;
@@ -88,6 +93,7 @@ class Dashboard extends Component
}
}
return $redirect;
}
@@ -98,7 +104,7 @@ class Dashboard extends Component
if ($user->hasStripeId()) {
$stripe = new StripeClient(config('cashier.secret'));
$subscriptions = $stripe->subscriptions->all(['limit' => 1]);
if (!$subscriptions->isEmpty()) {
if (! $subscriptions->isEmpty()) {
$data = $subscriptions->data[0];
$items = $subscriptions->data[0]->items->data[0];
@@ -110,7 +116,7 @@ class Dashboard extends Component
$stripe_price = $items->price->id;
$stripe_product = $items->price->product;
$ends_at = $items->current_period_end;
$subscriptionItemId = $items->id;
$subscriptionItemId = $items->id;
if ($cancel_at_period_end) {
$final_ends_at = Carbon::createFromTimestamp($ends_at)->toDateTimeString();
} else {
@@ -118,7 +124,7 @@ class Dashboard extends Component
}
try {
if ($status === "active") {
if ($status === 'active') {
$subscriptionsTable = DB::table('subscriptions')->where(['stripe_id' => $subscriptionId])->first();
if ($subscriptionsTable == null) {
$subscriptionsTable = DB::table('subscriptions')->insert([
@@ -158,9 +164,9 @@ class Dashboard extends Component
public function mount(Request $request)
{
if($this->checkForSubscriptionStatus()) {
if ($this->checkForSubscriptionStatus()) {
return redirect()->route('dashboard');
};
}
try {
$status = $request->session()->get('status');
if (isset($status)) {
@@ -176,7 +182,7 @@ class Dashboard extends Component
}
$plans = config('app.plans', []);
if (!empty($plans) && isset($plans[0]) && is_array($plans[0]) && isset($plans[0]['product_id']) && auth()->user()->subscribedToProduct($plans[0]['product_id'])) {
if (! empty($plans) && isset($plans[0]) && is_array($plans[0]) && isset($plans[0]['product_id']) && auth()->user()->subscribedToProduct($plans[0]['product_id'])) {
try {
$result = auth()->user()->subscriptions()->where(['stripe_status' => 'active'])->orderByDesc('updated_at')->first();
if ($result != null) {

View File

@@ -2,44 +2,62 @@
namespace App\Livewire\Dashboard\Mailbox;
use Exception;
use App\ColorPicker;
use App\Models\Log;
use App\Models\Premium;
use App\Models\PremiumEmail;
use App\Models\UsageLog;
use App\Models\ZEmail;
use Artisan;
use Carbon\Carbon;
use Exception;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Cookie;
use Livewire\Component;
use Session;
class Inbox extends Component
{
use ColorPicker;
public $messages = [];
public $deleted = [];
public $error = '';
public $email;
public $initial = false;
public $type;
public $overflow = false;
public $messageId;
public $list = false;
public $emails;
public $mailboxHistory;
public $emailsHistory;
public $username, $domain, $domains, $action;
public $username;
public $domain;
public $domains;
public $action;
public $email_limit = 20;
public bool $premium = true;
private $isSubscribed;
protected $listeners = ['updateEmail' => 'syncEmail', 'getEmail' => 'generateEmail', 'fetchMessages' => 'fetch', 'setMessageId' => 'setMessageId'];
public function mount(): void
{
$this->premium = Session::get('isInboxTypePremium', true);
@@ -64,7 +82,7 @@ class Inbox extends Component
$subscriptionCheck = auth()->user()->subscribedToProduct(config('app.plans')[0]['product_id']);
Session::put('isSubscribed', $subscriptionCheck);
if($subscriptionCheck) {
if ($subscriptionCheck) {
try {
$result = auth()->user()->subscriptions()->where(['stripe_status' => 'active'])->orderByDesc('updated_at')->first();
$userPriceID = $result['items'][0]['stripe_price'];
@@ -116,7 +134,7 @@ class Inbox extends Component
} else {
$domains = json_decode(config('app.settings.configuration_settings'))->domains ?? [];
}
if (!in_array($domain, $domains)) {
if (! in_array($domain, $domains)) {
return $this->showAlert('error', __('This mailbox can not be recovered.'));
}
}
@@ -150,24 +168,25 @@ class Inbox extends Component
}
/* Actions */
public function create() {
if (!$this->username) {
public function create()
{
if (! $this->username) {
return $this->showAlert('error', __('Please enter Username'));
}
$this->checkDomainInUsername();
if (strlen($this->username) < json_decode(config('app.settings.configuration_settings'))->custom_username_length_min || strlen($this->username) > json_decode(config('app.settings.configuration_settings'))->custom_username_length_max) {
return $this->showAlert('error', __('Username length cannot be less than') . ' ' . json_decode(config('app.settings.configuration_settings'))->custom_username_length_min . ' ' . __('and greater than') . ' ' . json_decode(config('app.settings.configuration_settings'))->custom_username_length_max);
return $this->showAlert('error', __('Username length cannot be less than').' '.json_decode(config('app.settings.configuration_settings'))->custom_username_length_min.' '.__('and greater than').' '.json_decode(config('app.settings.configuration_settings'))->custom_username_length_max);
}
if (!$this->domain) {
if (! $this->domain) {
return $this->showAlert('error', __('Please Select a Domain'));
}
if (in_array($this->username, json_decode(config('app.settings.configuration_settings'))->forbidden_ids)) {
return $this->showAlert('error', __('Username not allowed'));
}
if (!$this->checkEmailLimit()) {
return $this->showAlert('error', __('You have reached daily limit of MAX ') . $this->email_limit . __(' temp mail'));
if (! $this->checkEmailLimit()) {
return $this->showAlert('error', __('You have reached daily limit of MAX ').$this->email_limit.__(' temp mail'));
}
if (!$this->checkUsedEmail()) {
if (! $this->checkUsedEmail()) {
return $this->showAlert('error', __('Sorry! That email is already been used by someone else. Please try a different email address.'));
}
if ($this->premium) {
@@ -175,42 +194,51 @@ class Inbox extends Component
} else {
$this->email = ZEmail::createCustomEmail($this->username, $this->domain);
}
return redirect()->route('dashboard.premium');
}
public function random() {
if (!$this->checkEmailLimit()) {
return $this->showAlert('error', __('You have reached daily limit of maximum ') . $this->email_limit . __(' temp mail addresses.'));
public function random()
{
if (! $this->checkEmailLimit()) {
return $this->showAlert('error', __('You have reached daily limit of maximum ').$this->email_limit.__(' temp mail addresses.'));
}
if ($this->premium) {
$this->email = Premium::generateRandomEmail();
} else {
$this->email = ZEmail::generateRandomEmail();
}
return redirect()->route('dashboard.premium');
}
public function gmail() {
if (!$this->checkEmailLimit()) {
return $this->showAlert('error', __('You have reached daily limit of maximum ') . $this->email_limit . __(' temp mail addresses.'));
public function gmail()
{
if (! $this->checkEmailLimit()) {
return $this->showAlert('error', __('You have reached daily limit of maximum ').$this->email_limit.__(' temp mail addresses.'));
}
if ($this->premium) {
$this->email = Premium::generateRandomGmail();
} else {
$this->email = ZEmail::generateRandomGmail();
}
return redirect()->route('dashboard.premium');
}
public function outlook() {
if (!$this->checkEmailLimit()) {
return $this->showAlert('error', __('You have reached daily limit of maximum ') . $this->email_limit . __(' temp mail addresses.'));
public function outlook()
{
if (! $this->checkEmailLimit()) {
return $this->showAlert('error', __('You have reached daily limit of maximum ').$this->email_limit.__(' temp mail addresses.'));
}
if ($this->premium) {
$this->email = Premium::generateRandomOutlook();
} else {
$this->email = ZEmail::generateRandomOutlook();
}
return redirect()->route('dashboard.premium');
}
@@ -230,18 +258,21 @@ class Inbox extends Component
if (count($logs) >= $this->email_limit) {
return false;
}
return true;
}
private function checkUsedEmail(): bool
{
if (json_decode(config('app.settings.configuration_settings'))->disable_used_email) {
$check = Log::where('email', $this->user . '@' . $this->domain)->where('ip', '<>', request()->ip())->count();
$check = Log::where('email', $this->user.'@'.$this->domain)->where('ip', '<>', request()->ip())->count();
if ($check > 0) {
return false;
}
return true;
}
return true;
}
@@ -268,7 +299,7 @@ class Inbox extends Component
} else {
$domains = json_decode(config('app.settings.configuration_settings'))->domains ?? [];
}
if (!in_array($domain, $domains)) {
if (! in_array($domain, $domains)) {
$key = array_search($this->email, $this->emails);
if ($this->premium) {
Premium::removeEmail($this->email);
@@ -290,7 +321,6 @@ class Inbox extends Component
/* Mailbox */
public function fetch(): void
{
try {
@@ -300,33 +330,33 @@ class Inbox extends Component
}
$responses = [];
if ($this->premium) {
if (config('app.beta_feature') || !json_decode(config('app.settings.imap_settings'))->premium_cc_check) {
if (config('app.beta_feature') || ! json_decode(config('app.settings.imap_settings'))->premium_cc_check) {
$responses = [
'to' => Premium::getMessages($this->email, 'to', $this->deleted),
'cc' => [
'data' => [],
'notifications' => []
]
'notifications' => [],
],
];
} else {
$responses = [
'to' => Premium::getMessages($this->email, 'to', $this->deleted),
'cc' => Premium::getMessages($this->email, 'cc', $this->deleted)
'cc' => Premium::getMessages($this->email, 'cc', $this->deleted),
];
}
} else {
if (config('app.beta_feature') || !json_decode(config('app.settings.imap_settings'))->cc_check) {
if (config('app.beta_feature') || ! json_decode(config('app.settings.imap_settings'))->cc_check) {
$responses = [
'to' => ZEmail::getMessages($this->email, 'to', $this->deleted),
'cc' => [
'data' => [],
'notifications' => []
]
'notifications' => [],
],
];
} else {
$responses = [
'to' => ZEmail::getMessages($this->email, 'to', $this->deleted),
'cc' => ZEmail::getMessages($this->email, 'cc', $this->deleted)
'cc' => ZEmail::getMessages($this->email, 'cc', $this->deleted),
];
}
}
@@ -336,7 +366,7 @@ class Inbox extends Component
$notifications = array_merge($responses['to']['notifications'], $responses['cc']['notifications']);
if (count($notifications)) {
if (!$this->overflow && count($this->messages) == $count) {
if (! $this->overflow && count($this->messages) == $count) {
$this->overflow = true;
}
} else {
@@ -367,16 +397,17 @@ class Inbox extends Component
$this->initial = true;
}
public function delete($messageId) {
public function delete($messageId)
{
try {
$this->deleted[] = $messageId;
foreach ($this->messages as $key => $message) {
if ($message['id'] == $messageId) {
if ($this->premium) {
$directory = public_path('tmp/premium/attachments/') . $messageId;
$directory = public_path('tmp/premium/attachments/').$messageId;
} else {
$directory = public_path('tmp/attachments/') . $messageId;
$directory = public_path('tmp/attachments/').$messageId;
}
$this->rrmdir($directory);
unset($this->messages[$key]);
@@ -384,7 +415,7 @@ class Inbox extends Component
}
} catch (
Exception $exception
Exception $exception
) {
\Illuminate\Support\Facades\Log::error($exception->getMessage());
}
@@ -393,7 +424,7 @@ class Inbox extends Component
public function toggleMode()
{
$this->premium = !$this->premium;
$this->premium = ! $this->premium;
Session::put('isInboxTypePremium', $this->premium);
if ($this->premium) {
$this->domains = json_decode(config('app.settings.configuration_settings'))->premium_domains ?? [];
@@ -432,11 +463,12 @@ class Inbox extends Component
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (is_dir($dir . DIRECTORY_SEPARATOR . $object) && !is_link($dir . "/" . $object))
$this->rrmdir($dir . DIRECTORY_SEPARATOR . $object);
else
unlink($dir . DIRECTORY_SEPARATOR . $object);
if ($object != '.' && $object != '..') {
if (is_dir($dir.DIRECTORY_SEPARATOR.$object) && ! is_link($dir.'/'.$object)) {
$this->rrmdir($dir.DIRECTORY_SEPARATOR.$object);
} else {
unlink($dir.DIRECTORY_SEPARATOR.$object);
}
}
}
rmdir($dir);

View File

@@ -2,15 +2,16 @@
namespace App\Livewire\Dashboard;
use Exception;
use Log;
use App\Models\ActivationKey;
use App\Models\Plan;
use Exception;
use Livewire\Component;
use Log;
class Pricing extends Component
{
public $plans;
public $activation_key;
public function mount(): void
@@ -66,12 +67,12 @@ class Pricing extends Component
$user->updateStripeCustomer([
'address' => [
'postal_code' => '10001',
'country' => 'US',
'country' => 'US',
],
'name' => $user->name,
'email' => $user->email,
]);
$user->creditBalance($plan->price * 100, 'Premium Top-up for plan: ' . $plan->name);
$user->creditBalance($plan->price * 100, 'Premium Top-up for plan: '.$plan->name);
$balance = $user->balance();
$user->newSubscription('default', $plan->pricing_id)->create();
@@ -81,12 +82,15 @@ class Pricing extends Component
$ends_at = now()->addYear();
}
$user->subscription('default')->cancelAt($ends_at);
return true;
} catch (Exception $e) {
Log::error($e->getMessage());
return false;
}
}
public function render()
{
return view('livewire.dashboard.pricing');

View File

@@ -2,9 +2,9 @@
namespace App\Livewire\Dashboard;
use Exception;
use App\Models\Ticket;
use App\Models\TicketResponse;
use Exception;
use Livewire\Component;
use Request;
use Str;
@@ -12,11 +12,17 @@ use Str;
class Support extends Component
{
public $tickets = [];
public $subject;
public $message;
public $response;
public $list = false;
public $open = 0;
public $closed = 0;
public function store()
@@ -37,15 +43,14 @@ class Support extends Component
]);
$this->dispatch('showAlert', ['type' => 'success', 'message' => 'Your ticket has been created successfully!']);
$this->dispatch('closeModal');
$this->reset(['subject','message']);
$this->reset(['subject', 'message']);
$this->tickets = Ticket::with('responses')
->where('user_id', auth()->id())
->get();
->where('user_id', auth()->id())
->get();
} catch (Exception $exception) {
$this->dispatch('showAlert', ['type' => 'error', 'message' => 'Something went wrong!']);
}
}
public function reply($ticket_id)
@@ -56,14 +61,16 @@ class Support extends Component
try {
if (!is_numeric($ticket_id)) {
if (! is_numeric($ticket_id)) {
$this->dispatch('showAlert', ['type' => 'error', 'message' => 'Invalid ticket ID.']);
return;
}
$ticket = Ticket::find($ticket_id);
if (!$ticket) {
if (! $ticket) {
$this->dispatch('showAlert', ['type' => 'error', 'message' => 'Ticket not found.']);
return;
}
@@ -91,13 +98,15 @@ class Support extends Component
public function close($ticket_id)
{
if (!is_numeric($ticket_id)) {
if (! is_numeric($ticket_id)) {
$this->dispatch('showAlert', ['type' => 'error', 'message' => 'Invalid ticket ID.']);
return;
}
$ticket = Ticket::find($ticket_id);
if (!$ticket) {
if (! $ticket) {
$this->dispatch('showAlert', ['type' => 'error', 'message' => 'Ticket not found.']);
return;
}
@@ -113,8 +122,8 @@ class Support extends Component
public function mount()
{
$this->tickets = Ticket::with('responses')
->where('user_id', auth()->id())
->get();
->where('user_id', auth()->id())
->get();
$this->updateTicketCounts();
}

View File

@@ -9,61 +9,83 @@ use Livewire\Component;
class Action extends Component
{
public $username, $email, $emails, $domain, $domains, $action, $initial;
public function mount() {
public $username;
public $email;
public $emails;
public $domain;
public $domains;
public $action;
public $initial;
public function mount()
{
$this->domains = json_decode(config('app.settings.configuration_settings'))->domains ?? [];
$this->email = ZEmail::getEmail();
$this->emails = ZEmail::getEmails();
$this->validateDomainInEmail();
}
public function create() {
if (!$this->username) {
public function create()
{
if (! $this->username) {
return $this->showAlert('error', __('Please enter Username'));
}
$this->checkDomainInUsername();
if (strlen($this->username) < json_decode(config('app.settings.configuration_settings'))->custom_username_length_min || strlen($this->username) > json_decode(config('app.settings.configuration_settings'))->custom_username_length_max) {
return $this->showAlert('error', __('Username length cannot be less than') . ' ' . json_decode(config('app.settings.configuration_settings'))->custom_username_length_min . ' ' . __('and greater than') . ' ' . json_decode(config('app.settings.configuration_settings'))->custom_username_length_max);
return $this->showAlert('error', __('Username length cannot be less than').' '.json_decode(config('app.settings.configuration_settings'))->custom_username_length_min.' '.__('and greater than').' '.json_decode(config('app.settings.configuration_settings'))->custom_username_length_max);
}
if (!$this->domain) {
if (! $this->domain) {
return $this->showAlert('error', __('Please Select a Domain'));
}
if (in_array($this->username, json_decode(config('app.settings.configuration_settings'))->forbidden_ids)) {
return $this->showAlert('error', __('Username not allowed'));
}
if (!$this->checkEmailLimit()) {
return $this->showAlert('error', __('You have reached daily limit of MAX ') . json_decode(config('app.settings.configuration_settings'))->email_limit . __(' temp mail'));
if (! $this->checkEmailLimit()) {
return $this->showAlert('error', __('You have reached daily limit of MAX ').json_decode(config('app.settings.configuration_settings'))->email_limit.__(' temp mail'));
}
if (!$this->checkUsedEmail()) {
if (! $this->checkUsedEmail()) {
return $this->showAlert('error', __('Sorry! That email is already been used by someone else. Please try a different email address.'));
}
$this->email = ZEmail::createCustomEmail($this->username, $this->domain);
return redirect()->route('mailbox');
}
public function random() {
if (!$this->checkEmailLimit()) {
return $this->showAlert('error', __('You have reached daily limit of maximum ') . json_decode(config('app.settings.configuration_settings'))->email_limit . __(' temp mail addresses.'));
public function random()
{
if (! $this->checkEmailLimit()) {
return $this->showAlert('error', __('You have reached daily limit of maximum ').json_decode(config('app.settings.configuration_settings'))->email_limit.__(' temp mail addresses.'));
}
$this->email = ZEmail::generateRandomEmail();
return redirect()->route('mailbox');
}
public function gmail() {
if (!$this->checkEmailLimit()) {
return $this->showAlert('error', __('You have reached daily limit of maximum ') . json_decode(config('app.settings.configuration_settings'))->email_limit . __(' temp mail addresses.'));
public function gmail()
{
if (! $this->checkEmailLimit()) {
return $this->showAlert('error', __('You have reached daily limit of maximum ').json_decode(config('app.settings.configuration_settings'))->email_limit.__(' temp mail addresses.'));
}
$this->email = ZEmail::generateRandomGmail();
return redirect()->route('mailbox');
}
public function outlook() {
if (!$this->checkEmailLimit()) {
return $this->showAlert('error', __('You have reached daily limit of maximum ') . json_decode(config('app.settings.configuration_settings'))->email_limit . __(' temp mail addresses.'));
public function outlook()
{
if (! $this->checkEmailLimit()) {
return $this->showAlert('error', __('You have reached daily limit of maximum ').json_decode(config('app.settings.configuration_settings'))->email_limit.__(' temp mail addresses.'));
}
$this->email = ZEmail::generateRandomOutlook();
return redirect()->route('mailbox');
}
@@ -87,22 +109,26 @@ class Action extends Component
if (count($logs) >= json_decode(config('app.settings.configuration_settings'))->email_limit) {
return false;
}
return true;
}
private function checkUsedEmail(): bool
{
if (json_decode(config('app.settings.configuration_settings'))->disable_used_email) {
$check = Log::where('email', $this->user . '@' . $this->domain)->where('ip', '<>', request()->ip())->count();
$check = Log::where('email', $this->user.'@'.$this->domain)->where('ip', '<>', request()->ip())->count();
if ($check > 0) {
return false;
}
return true;
}
return true;
}
private function checkDomainInUsername() {
private function checkDomainInUsername()
{
$parts = explode('@', $this->username);
if (isset($parts[1])) {
if (in_array($parts[1], $this->domains)) {
@@ -118,7 +144,7 @@ class Action extends Component
if (isset($data[1])) {
$domain = $data[1];
$domains = json_decode(config('app.settings.configuration_settings'))->domains ?? [];
if (!in_array($domain, $domains)) {
if (! in_array($domain, $domains)) {
$key = array_search($this->email, $this->emails);
ZEmail::removeEmail($this->email);
if ($key == 0 && count($this->emails) == 1 && json_decode(config('app.settings.configuration_settings'))->after_last_email_delete == 'redirect_to_homepage') {
@@ -129,7 +155,9 @@ class Action extends Component
}
}
}
public function render() {
public function render()
{
return view('livewire.frontend.action');
}
}

View File

@@ -8,7 +8,14 @@ use Livewire\Component;
class Email extends Component
{
public $list = false;
public $type, $email, $emails, $initial;
public $type;
public $email;
public $emails;
public $initial;
protected $listeners = ['updateEmail' => 'syncEmail', 'getEmail' => 'generateEmail'];

View File

@@ -2,11 +2,11 @@
namespace App\Livewire\Frontend;
use Exception;
use App\Models\Email;
use App\ColorPicker;
use App\Models\Email;
use App\Models\Message;
use App\Models\ZEmail;
use Exception;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
use Livewire\Component;
@@ -16,12 +16,19 @@ class Mailbox extends Component
use ColorPicker;
public $messages = [];
public $deleted = [];
public $error = '';
public $email;
public $initial = false;
public $type;
public $overflow = false;
public $messageId;
protected $listeners = ['fetchMessages' => 'fetch', 'syncMailbox' => 'syncEmail', 'setMessageId' => 'setMessageId'];
@@ -30,10 +37,11 @@ class Mailbox extends Component
{
$this->email = ZEmail::getEmail();
$this->initial = false;
if (!ZEmail::getEmail()) {
if (! ZEmail::getEmail()) {
return redirect()->route('home');
}
}
public function syncEmail($email): void
{
$this->email = $email;
@@ -49,18 +57,18 @@ class Mailbox extends Component
$this->messages = [];
}
$responses = [];
if (config('app.beta_feature') || !json_decode(config('app.settings.imap_settings'))->cc_check) {
if (config('app.beta_feature') || ! json_decode(config('app.settings.imap_settings'))->cc_check) {
$responses = [
'to' => ZEmail::getMessages($this->email, 'to', $this->deleted),
'cc' => [
'data' => [],
'notifications' => []
]
'notifications' => [],
],
];
} else {
$responses = [
'to' => ZEmail::getMessages($this->email, 'to', $this->deleted),
'cc' => ZEmail::getMessages($this->email, 'cc', $this->deleted)
'cc' => ZEmail::getMessages($this->email, 'cc', $this->deleted),
];
}
@@ -69,7 +77,7 @@ class Mailbox extends Component
$notifications = array_merge($responses['to']['notifications'], $responses['cc']['notifications']);
if (count($notifications)) {
if (!$this->overflow && count($this->messages) == $count) {
if (! $this->overflow && count($this->messages) == $count) {
$this->overflow = true;
}
} else {
@@ -91,7 +99,8 @@ class Mailbox extends Component
$this->initial = true;
}
public function delete($messageId) {
public function delete($messageId)
{
try {
if (config('app.beta_feature')) {
@@ -103,7 +112,7 @@ class Mailbox extends Component
$this->deleted[] = $messageId;
foreach ($this->messages as $key => $message) {
if ($message['id'] == $messageId) {
$directory = public_path('tmp/attachments/') . $messageId;
$directory = public_path('tmp/attachments/').$messageId;
$this->rrmdir($directory);
unset($this->messages[$key]);
}
@@ -127,11 +136,12 @@ class Mailbox extends Component
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (is_dir($dir . DIRECTORY_SEPARATOR . $object) && !is_link($dir . "/" . $object))
$this->rrmdir($dir . DIRECTORY_SEPARATOR . $object);
else
unlink($dir . DIRECTORY_SEPARATOR . $object);
if ($object != '.' && $object != '..') {
if (is_dir($dir.DIRECTORY_SEPARATOR.$object) && ! is_link($dir.'/'.$object)) {
$this->rrmdir($dir.DIRECTORY_SEPARATOR.$object);
} else {
unlink($dir.DIRECTORY_SEPARATOR.$object);
}
}
}
rmdir($dir);

View File

@@ -17,6 +17,7 @@ class Home extends Component
return redirect()->route('mailbox');
}
}
public function render()
{
return view('livewire.home');

View File

@@ -9,7 +9,6 @@ class Page extends Component
public $slug;
public function mount($slug)
{
$this->slug = $slug;
}
@@ -18,9 +17,10 @@ class Page extends Component
{
$page = \App\Models\Page::where('slug', $this->slug)->firstOrFail();
if ($page->is_published == false ) {
if ($page->is_published == false) {
abort(404);
}
return view('livewire.page', [
'page' => $page,
]);

View File

@@ -4,6 +4,7 @@ namespace App\Livewire\Settings;
use Livewire\Attributes\Layout;
use Livewire\Component;
#[Layout('components.layouts.dashboard')]
class Appearance extends Component

View File

@@ -6,6 +6,7 @@ use App\Livewire\Actions\Logout;
use Illuminate\Support\Facades\Auth;
use Livewire\Attributes\Layout;
use Livewire\Component;
#[Layout('components.layouts.dashboard')]
class DeleteUserForm extends Component

View File

@@ -8,6 +8,7 @@ use Illuminate\Validation\Rules\Password as PasswordRule;
use Illuminate\Validation\ValidationException;
use Livewire\Attributes\Layout;
use Livewire\Component;
#[Layout('components.layouts.dashboard')]
class Password extends Component

View File

@@ -2,13 +2,11 @@
namespace App\Mail;
use Illuminate\Mail\Mailables\Attachment;
use App\Models\Ticket;
use App\Models\TicketResponse;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Attachment;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
@@ -18,7 +16,9 @@ class TicketResponseNotification extends Mailable
use Queueable, SerializesModels;
public Ticket $ticket;
public Collection $responses;
/**
* Create a new message instance.
*/
@@ -34,7 +34,7 @@ class TicketResponseNotification extends Mailable
public function envelope(): Envelope
{
return new Envelope(
subject: 'Support Ticket Response: #'. $this->ticket->ticket_id,
subject: 'Support Ticket Response: #'.$this->ticket->ticket_id,
);
}

View File

@@ -13,14 +13,15 @@ class Category extends Model
protected $fillable = [
'name',
'slug',
'is_active'
'is_active',
];
protected $casts = [
'is_active' => 'boolean',
];
public function blogs(): HasMany {
public function blogs(): HasMany
{
return $this->hasMany(Blog::class);
}
}

View File

@@ -2,19 +2,19 @@
namespace App\Models;
use Ddeboer\Imap\ConnectionInterface;
use DateTime;
use Exception;
use Illuminate\Support\Facades\Log;
use App\ColorPicker;
use Carbon\Carbon;
use Carbon\CarbonImmutable;
use DateTime;
use Ddeboer\Imap\ConnectionInterface;
use Ddeboer\Imap\Search\Date\Since;
use Ddeboer\Imap\Search\Email\To;
use Ddeboer\Imap\Server;
use Exception;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Validator;
class Email extends Model

View File

@@ -13,7 +13,7 @@ class Menu extends Model
'name',
'url',
'new_tab',
'parent'
'parent',
];
public function parentname()

View File

@@ -2,17 +2,17 @@
namespace App\Models;
use DateTime;
use Exception;
use Illuminate\Support\Facades\Log;
use App\ColorPicker;
use Carbon\Carbon;
use DateTime;
use Ddeboer\Imap\Search\Email\Cc;
use Ddeboer\Imap\Search\Email\To;
use Ddeboer\Imap\SearchExpression;
use Exception;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
class Message extends Model

View File

@@ -5,7 +5,8 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Meta extends Model {
class Meta extends Model
{
use HasFactory;
protected $fillable = [
@@ -13,9 +14,11 @@ class Meta extends Model {
'value',
];
public function incrementMeta($value = 1) {
public function incrementMeta($value = 1)
{
$this->value = $this->value + $value;
$this->save();
return true;
}
@@ -24,8 +27,10 @@ class Meta extends Model {
$meta = Meta::where('key', 'email_ids_created')->first();
if ($meta) {
$meta->incrementMeta($value);
return true;
}
return false;
}
@@ -34,24 +39,30 @@ class Meta extends Model {
$meta = Meta::where('key', 'messages_received')->first();
if ($meta) {
$meta->incrementMeta($value);
return true;
}
return false;
}
public static function getEmailIdsCreated() {
public static function getEmailIdsCreated()
{
$meta = Meta::where('key', 'email_ids_created')->first();
if ($meta) {
return $meta->value;
}
return "NaN";
return 'NaN';
}
public static function getMessagesReceived() {
public static function getMessagesReceived()
{
$meta = Meta::where('key', 'messages_received')->first();
if ($meta) {
return $meta->value;
}
return "NaN";
return 'NaN';
}
}

View File

@@ -17,7 +17,7 @@ class Page extends Model
'meta',
'custom_header',
'page_image',
'is_published'
'is_published',
];
protected $casts = [

View File

@@ -2,23 +2,23 @@
namespace App\Models;
use Ddeboer\Imap\ConnectionInterface;
use DateTime;
use Exception;
use Log;
use App\ColorPicker;
use Carbon\Carbon;
use DateTime;
use Ddeboer\Imap\ConnectionInterface;
use Ddeboer\Imap\Search\Email\Cc;
use Ddeboer\Imap\Search\Email\To;
use Ddeboer\Imap\SearchExpression;
use Ddeboer\Imap\Server;
use Exception;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Cookie;
use Log;
class Premium extends Model
{
use ColorPicker;
public static function connectMailBox($imap = null): ConnectionInterface
{
$imapDB = json_decode(config('app.settings.imap_settings'), true);
@@ -31,7 +31,7 @@ class Premium extends Model
'password' => $imapDB['premium_password'],
'default_account' => $imapDB['premium_default_account'],
'protocol' => $imapDB['premium_protocol'],
'cc_check' => $imapDB['premium_cc_check']
'cc_check' => $imapDB['premium_cc_check'],
];
return ZEmail::connectMailBox($imap);
@@ -41,15 +41,15 @@ class Premium extends Model
{
if ($email == null) {
return [
"data" => [],
"notifications" => []
'data' => [],
'notifications' => [],
];
}
$allowed = explode(',', 'doc,docx,xls,xlsx,ppt,pptx,xps,pdf,dxf,ai,psd,eps,ps,svg,ttf,zip,rar,tar,gzip,mp3,mpeg,wav,ogg,jpeg,jpg,png,gif,bmp,tif,webm,mpeg4,3gpp,mov,avi,mpegs,wmv,flx,txt');
$connection = self::connectMailBox();
$mailbox = $connection->getMailbox('INBOX');
$search = new SearchExpression();
$search = new SearchExpression;
if ($type == 'cc') {
$search->addCondition(new Cc($email));
} else {
@@ -60,18 +60,19 @@ class Premium extends Model
$count = 1;
$response = [
'data' => [],
'notifications' => []
'notifications' => [],
];
foreach ($messages as $message) {
if (in_array($message->getNumber(), $deleted)) {
$message->delete();
continue;
}
$blocked = false;
$sender = $message->getFrom();
$date = $message->getDate();
if (!$date) {
$date = new DateTime();
if (! $date) {
$date = new DateTime;
if ($message->getHeaders()->get('udate')) {
$date->setTimestamp($message->getHeaders()->get('udate'));
}
@@ -82,12 +83,12 @@ class Premium extends Model
$html = $message->getBodyHtml();
$text = $message->getBodyText();
if ($text) {
$contentText = str_replace('<a', '<a target="blank"', str_replace(array("\r\n", "\n"), '', $text));
$contentText = str_replace('<a', '<a target="blank"', str_replace(["\r\n", "\n"], '', $text));
}
if ($html) {
$content = str_replace('<a', '<a target="blank"', $html);
} else {
$content = str_replace('<a', '<a target="blank"', str_replace(array("\r\n", "\n"), '<br/>', $text));
$content = str_replace('<a', '<a target="blank"', str_replace(["\r\n", "\n"], '<br/>', $text));
}
if (json_decode(config('app.settings.configuration_settings'))->enable_masking_external_link) {
$content = str_replace('href="', 'href="http://href.li/?', $content);
@@ -106,28 +107,28 @@ class Premium extends Model
$obj['contentText'] = $contentText;
$obj['attachments'] = [];
$obj['is_seen'] = true;
$obj['sender_photo'] = self::chooseColor(strtoupper(substr($sender->getName() ?: $sender->getAddress(), 0, 1) ));
$obj['sender_photo'] = self::chooseColor(strtoupper(substr($sender->getName() ?: $sender->getAddress(), 0, 1)));
//Checking if Sender is Blocked
// Checking if Sender is Blocked
$domain = explode('@', $obj['sender_email'])[1];
$blocked = in_array($domain, json_decode(config('app.settings.configuration_settings'))->blocked_domains);
if ($blocked) {
$obj['subject'] = __('Blocked');
$obj['content'] = __('Emails from') . ' ' . $domain . ' ' . __('are blocked by Admin');
$obj['contentText'] = __('Emails from') . ' ' . $domain . ' ' . __('are blocked by Admin');
$obj['content'] = __('Emails from').' '.$domain.' '.__('are blocked by Admin');
$obj['contentText'] = __('Emails from').' '.$domain.' '.__('are blocked by Admin');
}
if ($message->hasAttachments() && !$blocked) {
if ($message->hasAttachments() && ! $blocked) {
$attachments = $message->getAttachments();
$directory = './tmp/premium/attachments/' . $obj['id'] . '/';
$directory = './tmp/premium/attachments/'.$obj['id'].'/';
is_dir($directory) || mkdir($directory, 0777, true);
foreach ($attachments as $attachment) {
$filenameArray = explode('.', $attachment->getFilename());
$extension = $filenameArray[count($filenameArray) - 1];
if (in_array($extension, $allowed)) {
if (!file_exists($directory . $attachment->getFilename())) {
if (! file_exists($directory.$attachment->getFilename())) {
try {
file_put_contents(
$directory . $attachment->getFilename(),
$directory.$attachment->getFilename(),
$attachment->getDecodedContent()
);
} catch (Exception $e) {
@@ -135,28 +136,28 @@ class Premium extends Model
}
}
if ($attachment->getFilename() !== 'undefined') {
$url = config('app.settings.app_base_url') . str_replace('./', '/', $directory . $attachment->getFilename());
$url = config('app.settings.app_base_url').str_replace('./', '/', $directory.$attachment->getFilename());
$structure = $attachment->getStructure();
if (isset($structure->id) && str_contains($obj['content'], trim($structure->id, '<>'))) {
$obj['content'] = str_replace('cid:' . trim($structure->id, '<>'), $url, $obj['content']);
$obj['content'] = str_replace('cid:'.trim($structure->id, '<>'), $url, $obj['content']);
}
$obj['attachments'][] = [
'file' => $attachment->getFilename(),
'url' => $url
'url' => $url,
];
}
}
}
}
$response['data'][] = $obj;
if (!$message->isSeen()) {
if (! $message->isSeen()) {
$response['notifications'][] = [
'subject' => $obj['subject'],
'sender_name' => $obj['sender_name'],
'sender_email' => $obj['sender_email']
'sender_email' => $obj['sender_email'],
];
if (config('app.zemail_log')) {
file_put_contents(storage_path('logs/zemail.csv'), request()->ip() . "," . date("Y-m-d h:i:s a") . "," . $obj['sender_email'] . "," . $email . PHP_EOL, FILE_APPEND);
file_put_contents(storage_path('logs/zemail.csv'), request()->ip().','.date('Y-m-d h:i:s a').','.$obj['sender_email'].','.$email.PHP_EOL, FILE_APPEND);
}
}
$message->markAsSeen();
@@ -167,6 +168,7 @@ class Premium extends Model
$response['data'] = array_reverse($response['data']);
$connection->expunge();
return $response;
}
@@ -174,6 +176,7 @@ class Premium extends Model
{
return self::fetchMessages($email, $type, $deleted);
}
public static function deleteMessage($id): void
{
$connection = self::connectMailBox();
@@ -181,20 +184,25 @@ class Premium extends Model
$mailbox->getMessage($id)->delete();
$connection->expunge();
}
public static function getEmail($generate = false) {
public static function getEmail($generate = false)
{
if (Cookie::has('p_email')) {
return Cookie::get('p_email');
} else {
return $generate ? self::generateRandomEmail() : null;
}
}
public static function getEmails() {
public static function getEmails()
{
if (Cookie::has('p_emails')) {
return unserialize(Cookie::get('p_emails'));
} else {
return [];
}
}
public static function setEmail($email): void
{
$emails = unserialize(Cookie::get('p_emails'));
@@ -211,6 +219,7 @@ class Premium extends Model
Cookie::queue('p_email', $email, 43800);
}
}
public static function removeEmail($email): void
{
$emails = self::getEmails();
@@ -226,17 +235,20 @@ class Premium extends Model
Cookie::queue('p_emails', serialize([]), -1);
}
}
public static function createCustomEmailFull($email): string
{
$data = explode('@', $email);
$username = $data[0];
if (strlen($username) < json_decode(config('app.settings.configuration_settings'))->custom_username_length_min || strlen($username) > json_decode(config('app.settings.configuration_settings'))->custom_username_length_max) {
$zemail = new Premium();
$zemail = new Premium;
$username = $zemail->generateRandomUsername();
}
$domain = $data[1];
return self::createCustomEmail($username, $domain);
}
public static function createCustomEmail($username, $domain): string
{
$username = preg_replace('/[^a-zA-Z0-9+.]/', '', strtolower($username));
@@ -259,7 +271,7 @@ class Premium extends Model
return self::generateRandomOutlook(true);
}
$zemail = new Premium();
$zemail = new Premium;
if ($username === '' && in_array($domain, $domains)) {
return $zemail->generateRandomUsername().'@'.$domain;
@@ -270,14 +282,15 @@ class Premium extends Model
[$check_username, $post_username] = explode('+', $username, 2);
if (in_array($check_username, $outlook_usernames)) {
$email = $username . '@' . $domain;
$email = $username.'@'.$domain;
} else {
$email = $zemail->getRandomOutlookUser() . '+' . $post_username . '@' . $domain;
$email = $zemail->getRandomOutlookUser().'+'.$post_username.'@'.$domain;
}
} else {
$email = $zemail->getRandomOutlookUser() . '+' . $username . '@' . $domain;
$email = $zemail->getRandomOutlookUser().'+'.$username.'@'.$domain;
}
self::storeEmail($email);
return $email;
}
@@ -286,142 +299,152 @@ class Premium extends Model
[$check_username, $post_username] = explode('+', $username, 2);
if (in_array($check_username, $gmail_usernames)) {
$email = $username . '@' . $domain;
$email = $username.'@'.$domain;
} else {
$email = $zemail->getRandomGmailUser() . '+' . $post_username . '@' . $domain;
$email = $zemail->getRandomGmailUser().'+'.$post_username.'@'.$domain;
}
} elseif (str_contains($username, '.')) {
$check_username = str_replace('.', '', $username);
if (in_array($check_username, $gmail_usernames)) {
$email = $username . '@' . $domain;
$email = $username.'@'.$domain;
} else {
$email = $zemail->generateRandomGmail() . '@' . $domain;
$email = $zemail->generateRandomGmail().'@'.$domain;
}
} else {
$email = $zemail->getRandomGmailUser() . '+' . $username . '@' . $domain;
$email = $zemail->getRandomGmailUser().'+'.$username.'@'.$domain;
}
self::storeEmail($email);
return $email;
}
// Handle other custom domains
if (!in_array($domain, $domains)) {
if (! in_array($domain, $domains)) {
return self::generateRandomEmail(true);
}
$finalDomain = in_array($domain, $domains) ? $domain : ($domains[0] ?? 'example.com');
$email = $username . '@' . $finalDomain;
$email = $username.'@'.$finalDomain;
self::storeEmail($email);
return $email;
}
public static function generateRandomEmail($store = true): string
{
$zemail = new Premium();
$zemail = new Premium;
$domain = $zemail->getRandomDomain();
if ($domain == "gmail.com") {
$rd = mt_rand(0,1);
if ($domain == 'gmail.com') {
$rd = mt_rand(0, 1);
if ($rd == 0) {
$email = $zemail->generateRandomGmail(false);
} else {
$email = $zemail->getRandomGmailUser().'+'.$zemail->generateRandomUsername().'@gmail.com';
}
} elseif ($domain == "googlemail.com") {
$rd = mt_rand(0,1);
} elseif ($domain == 'googlemail.com') {
$rd = mt_rand(0, 1);
if ($rd == 0) {
$email = $zemail->generateRandomGmail(false);
} else {
$email = $zemail->getRandomGmailUser().'+'.$zemail->generateRandomUsername().'@googlemail.com';
}
} elseif ($domain == "outlook.com") {
} elseif ($domain == 'outlook.com') {
$email = $zemail->getRandomOutlookUser().'+'.$zemail->generateRandomUsername().'@outlook.com';
}
else {
$email = $zemail->generateRandomUsername() . '@' . $domain;
} else {
$email = $zemail->generateRandomUsername().'@'.$domain;
}
if ($store) {
self::storeEmail($email);
}
return $email;
}
public static function generateRandomGmail($store = true): string
{
$zemail = new Premium();
$zemail = new Premium;
$uname = $zemail->getRandomGmailUser();
$uname_len = strlen($uname);
$len_power = $uname_len - 1;
$combination = pow(2,$len_power);
$rand_comb = mt_rand(1,$combination);
$formatted = implode(' ',str_split($uname));
$combination = pow(2, $len_power);
$rand_comb = mt_rand(1, $combination);
$formatted = implode(' ', str_split($uname));
$uname_exp = explode(' ', $formatted);
$bin = intval("");
for($i=0; $i<$len_power; $i++) {
$bin .= mt_rand(0,1);
$bin = intval('');
for ($i = 0; $i < $len_power; $i++) {
$bin .= mt_rand(0, 1);
}
$bin = explode(' ', implode(' ',str_split(strval($bin))));
$bin = explode(' ', implode(' ', str_split(strval($bin))));
$email = "";
for($i=0; $i<$len_power; $i++) {
$email = '';
for ($i = 0; $i < $len_power; $i++) {
$email .= $uname_exp[$i];
if($bin[$i]) {
$email .= ".";
if ($bin[$i]) {
$email .= '.';
}
}
$email .= $uname_exp[$i];
$gmail_rand = mt_rand(1,10);
if($gmail_rand > 5) {
$email .= "@gmail.com";
$gmail_rand = mt_rand(1, 10);
if ($gmail_rand > 5) {
$email .= '@gmail.com';
} else {
$email .= "@googlemail.com";
$email .= '@googlemail.com';
}
if ($store) {
self::storeEmail($email);
}
return $email;
}
public static function generateRandomOutlook($store = true): string
{
$zemail = new Premium();
$zemail = new Premium;
$email = $zemail->getRandomOutlookUser().'+'.$zemail->generateRandomUsername().'@outlook.com';
if ($store) {
self::storeEmail($email);
}
return $email;
}
private static function storeEmail($email): void
{
Log::create([
'user_id' => auth()->user()->id,
'ip' => request()->ip(),
'email' => $email
'email' => $email,
]);
self::storeUsageLog($email);
Cookie::queue('p_email', $email, 43800);
$emails = Cookie::has('p_emails') ? unserialize(Cookie::get('p_emails')) : [];
if (!in_array($email, $emails)) {
if (! in_array($email, $emails)) {
self::incrementEmailStats();
$emails[] = $email;
Cookie::queue('p_emails', serialize($emails), 43800);
}
}
public static function incrementEmailStats($count = 1): void
{
Meta::incrementEmailIdsCreated($count);
self::incrementEmailIdsCreated($count);
}
public static function incrementMessagesStats($count = 1): void
{
Meta::incrementMessagesReceived($count);
self::incrementMessagesReceived($count);
}
private function generateRandomUsername(): string
{
$start = json_decode(config('app.settings.configuration_settings'))->random_username_length_min ?? 0;
@@ -429,41 +452,56 @@ class Premium extends Model
if ($start == 0 && $end == 0) {
return $this->generatePronounceableWord();
}
return $this->generatedRandomBetweenLength($start, $end);
}
protected function generatedRandomBetweenLength($start, $end): string
{
$length = rand($start, $end);
return $this->generateRandomString($length);
}
private function getRandomDomain() {
private function getRandomDomain()
{
$domains = json_decode(config('app.settings.configuration_settings'))->premium_domains ?? [];
$count = count($domains);
return $count > 0 ? $domains[rand(1, $count) - 1] : '';
}
private function getRandomGmailUser() {
private function getRandomGmailUser()
{
$gmailusername = json_decode(config('app.settings.configuration_settings'))->premium_gmailUsernames ?? [];
$count = count($gmailusername);
return $count > 0 ? $gmailusername[rand(1, $count) - 1] : '';
}
private function getRandomOutlookUser() {
private function getRandomOutlookUser()
{
$outlook_username = json_decode(config('app.settings.configuration_settings'))->premium_outlookUsernames ?? [];
$count = count($outlook_username);
return $count > 0 ? $outlook_username[rand(1, $count) - 1] : '';
}
private function generatePronounceableWord(): string
{
$c = 'bcdfghjklmnprstvwz'; //consonants except hard to speak ones
$v = 'aeiou'; //vowels
$a = $c . $v; //both
$c = 'bcdfghjklmnprstvwz'; // consonants except hard to speak ones
$v = 'aeiou'; // vowels
$a = $c.$v; // both
$random = '';
for ($j = 0; $j < 2; $j++) {
$random .= $c[rand(0, strlen($c) - 1)];
$random .= $v[rand(0, strlen($v) - 1)];
$random .= $a[rand(0, strlen($a) - 1)];
}
return $random;
}
private function generateRandomString($length = 10): string
{
$characters = '0123456789abcdefghijklmnopqrstuvwxyz';
@@ -472,18 +510,17 @@ class Premium extends Model
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
/**
* Stats Handling Functions
*/
public static function incrementEmailIdsCreated($count = 1): void
{
$user = Auth::user();
if (!$user) {
if (! $user) {
return;
}
@@ -498,7 +535,7 @@ class Premium extends Model
public static function incrementMessagesReceived($count = 1): void
{
$user = Auth::user();
if (!$user) {
if (! $user) {
return;
}
@@ -514,7 +551,7 @@ class Premium extends Model
{
try {
$user = Auth::user();
if (!$user) {
if (! $user) {
return;
}
@@ -525,9 +562,9 @@ class Premium extends Model
);
$history = $usageLog->emails_created_history ?? [];
if (!in_array($email, $history)) {
if (! in_array($email, $history)) {
$history[] = $email;
//$usageLog->emails_created_count += 1;
// $usageLog->emails_created_count += 1;
$usageLog->emails_created_history = $history;
$usageLog->save();
}

View File

@@ -9,6 +9,7 @@ use Illuminate\Support\Facades\Validator;
class RemoteEmail extends Model
{
use HasFactory;
protected $table = 'emails';
public function getConnectionName()
@@ -20,7 +21,6 @@ class RemoteEmail extends Model
return 'mysql_remote';
}
protected $fillable = [
'message_id',
'subject',
@@ -42,12 +42,13 @@ class RemoteEmail extends Model
public static function fetchEmailFromDB($email)
{
$validator = Validator::make(['email' => $email], [
'email' => 'required|email'
'email' => 'required|email',
]);
if ($validator->fails()) {
return [];
}
return self::whereJsonContains('to', $email)->orderBy('timestamp', 'desc')->get();
}
}

View File

@@ -4,7 +4,6 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Setting extends Model
{

View File

@@ -2,8 +2,8 @@
namespace App\Models;
use Exception;
use Carbon\Carbon;
use Exception;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
@@ -13,7 +13,7 @@ class Ticket extends Model
use HasFactory;
protected $fillable = [
'user_id', 'ticket_id', 'subject', 'message', 'status', 'last_response_at', 'ip_address'
'user_id', 'ticket_id', 'subject', 'message', 'status', 'last_response_at', 'ip_address',
];
protected static function boot()
@@ -22,7 +22,7 @@ class Ticket extends Model
static::creating(function ($ticket) {
if (empty($ticket->ticket_id)) {
$ticket->ticket_id = 'TICKET-' . strtoupper(Str::random(6));
$ticket->ticket_id = 'TICKET-'.strtoupper(Str::random(6));
}
});
}
@@ -61,6 +61,7 @@ class Ticket extends Model
]);
}
}
return true;
} catch (Exception $e) {
return false;

View File

@@ -10,7 +10,7 @@ class TicketResponse extends Model
use HasFactory;
protected $fillable = [
'ticket_id', 'user_id', 'response', 'ip_address'
'ticket_id', 'user_id', 'response', 'ip_address',
];
public function ticket()

View File

@@ -2,18 +2,20 @@
namespace App;
use Log;
use Http;
use Exception;
use Http;
use Log;
trait NotifyMe
{
function sendTelegramNotification($message) {
public function sendTelegramNotification($message)
{
$botToken = config('app.notify_tg_bot_token');
$chatId = config('app.notify_tg_chat_id');
if (!$botToken || !$chatId) {
if (! $botToken || ! $chatId) {
Log::error('Telegram bot token or chat ID not configured');
return false;
}
@@ -22,14 +24,16 @@ trait NotifyMe
$data = [
'chat_id' => $chatId,
'text' => $message,
'parse_mode' => 'HTML'
'parse_mode' => 'HTML',
];
try {
$response = Http::post($url, $data);
return $response->successful();
} catch (Exception $e) {
Log::error('Failed to send Telegram notification: ' . $e->getMessage());
Log::error('Failed to send Telegram notification: '.$e->getMessage());
return false;
}
}

View File

@@ -2,11 +2,11 @@
namespace App\Providers;
use Exception;
use App\Models\Blog;
use App\Models\Menu;
use App\Models\Plan;
use DB;
use Exception;
use Illuminate\Support\ServiceProvider;
use Laravel\Cashier\Cashier;

View File

@@ -2,12 +2,11 @@
namespace App\Providers\Filament;
use Filament\Pages\Dashboard;
use Filament\Http\Middleware\Authenticate;
use Filament\Http\Middleware\AuthenticateSession;
use Filament\Http\Middleware\DisableBladeIconComponents;
use Filament\Http\Middleware\DispatchServingFilamentEvent;
use Filament\Pages;
use Filament\Pages\Dashboard;
use Filament\Panel;
use Filament\PanelProvider;
use Filament\Support\Colors\Color;
@@ -39,8 +38,8 @@ class DashPanelProvider extends PanelProvider
])
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
->widgets([
//Widgets\AccountWidget::class,
//Widgets\FilamentInfoWidget::class,
// Widgets\AccountWidget::class,
// Widgets\FilamentInfoWidget::class,
])
->middleware([
EncryptCookies::class,

View File

@@ -1,10 +1,10 @@
<?php
// Adjust this path if your file location is different
require __DIR__ . '/vendor/autoload.php';
require __DIR__.'/vendor/autoload.php';
// Bootstrap the Laravel application
$app = require_once __DIR__ . '/bootstrap/app.php';
$app = require_once __DIR__.'/bootstrap/app.php';
// Make the Console Kernel instance
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
@@ -20,5 +20,5 @@ try {
echo "Output:\n$output";
} catch (\Exception $e) {
echo "Error running Artisan command: " . $e->getMessage();
echo 'Error running Artisan command: '.$e->getMessage();
}

View File

@@ -1,10 +1,10 @@
<?php
// Adjust this path if your file location is different
require __DIR__ . '/vendor/autoload.php';
require __DIR__.'/vendor/autoload.php';
// Bootstrap the Laravel application
$app = require_once __DIR__ . '/bootstrap/app.php';
$app = require_once __DIR__.'/bootstrap/app.php';
// Make the Console Kernel instance
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
@@ -20,5 +20,5 @@ try {
echo "Output:\n$output";
} catch (\Exception $e) {
echo "Error running Artisan command: " . $e->getMessage();
echo 'Error running Artisan command: '.$e->getMessage();
}

View File

@@ -38,14 +38,14 @@ return [
| Leaving it to null will allow localhost only.
*/
'storage' => [
'enabled' => true,
'open' => env('DEBUGBAR_OPEN_STORAGE'), // bool/callback.
'driver' => 'file', // redis, file, pdo, socket, custom
'path' => storage_path('debugbar'), // For file driver
'enabled' => true,
'open' => env('DEBUGBAR_OPEN_STORAGE'), // bool/callback.
'driver' => 'file', // redis, file, pdo, socket, custom
'path' => storage_path('debugbar'), // For file driver
'connection' => null, // Leave null for default connection (Redis/PDO)
'provider' => '', // Instance of StorageInterface for custom driver
'hostname' => '127.0.0.1', // Hostname to use with the "socket" driver
'port' => 2304, // Port to use with the "socket" driver
'provider' => '', // Instance of StorageInterface for custom driver
'hostname' => '127.0.0.1', // Hostname to use with the "socket" driver
'port' => 2304, // Port to use with the "socket" driver
],
/*
@@ -162,31 +162,31 @@ return [
*/
'collectors' => [
'phpinfo' => false, // Php version
'messages' => true, // Messages
'time' => true, // Time Datalogger
'memory' => true, // Memory usage
'exceptions' => true, // Exception displayer
'log' => true, // Logs from Monolog (merged in messages if enabled)
'db' => true, // Show database (PDO) queries and bindings
'views' => true, // Views with their data
'route' => false, // Current route information
'auth' => false, // Display Laravel authentication status
'gate' => true, // Display Laravel Gate checks
'session' => false, // Display session data
'phpinfo' => false, // Php version
'messages' => true, // Messages
'time' => true, // Time Datalogger
'memory' => true, // Memory usage
'exceptions' => true, // Exception displayer
'log' => true, // Logs from Monolog (merged in messages if enabled)
'db' => true, // Show database (PDO) queries and bindings
'views' => true, // Views with their data
'route' => false, // Current route information
'auth' => false, // Display Laravel authentication status
'gate' => true, // Display Laravel Gate checks
'session' => false, // Display session data
'symfony_request' => true, // Only one can be enabled..
'mail' => true, // Catch mail messages
'laravel' => true, // Laravel version and environment
'events' => false, // All events fired
'mail' => true, // Catch mail messages
'laravel' => true, // Laravel version and environment
'events' => false, // All events fired
'default_request' => false, // Regular or special Symfony request logger
'logs' => false, // Add the latest log messages
'files' => false, // Show the included files
'config' => false, // Display config settings
'cache' => false, // Display cache events
'models' => true, // Display models
'livewire' => true, // Display Livewire (when available)
'jobs' => false, // Display dispatched jobs
'pennant' => false, // Display Pennant feature flags
'logs' => false, // Add the latest log messages
'files' => false, // Show the included files
'config' => false, // Display config settings
'cache' => false, // Display cache events
'models' => true, // Display models
'livewire' => true, // Display Livewire (when available)
'jobs' => false, // Display dispatched jobs
'pennant' => false, // Display Pennant feature flags
],
/*
@@ -216,23 +216,23 @@ return [
'show_guards' => true, // Show the guards that are used
],
'db' => [
'with_params' => true, // Render SQL with the parameters substituted
'exclude_paths' => [ // Paths to exclude entirely from the collector
// 'vendor/laravel/framework/src/Illuminate/Session', // Exclude sessions queries
'with_params' => true, // Render SQL with the parameters substituted
'exclude_paths' => [ // Paths to exclude entirely from the collector
// 'vendor/laravel/framework/src/Illuminate/Session', // Exclude sessions queries
],
'backtrace' => true, // Use a backtrace to find the origin of the query in your files.
'backtrace' => true, // Use a backtrace to find the origin of the query in your files.
'backtrace_exclude_paths' => [], // Paths to exclude from backtrace. (in addition to defaults)
'timeline' => false, // Add the queries to the timeline
'duration_background' => true, // Show shaded background on each query relative to how long it took to execute.
'timeline' => false, // Add the queries to the timeline
'duration_background' => true, // Show shaded background on each query relative to how long it took to execute.
'explain' => [ // Show EXPLAIN output on queries
'enabled' => false,
],
'hints' => false, // Show hints for common mistakes
'show_copy' => true, // Show copy button next to the query,
'slow_threshold' => false, // Only track queries that last longer than this time in ms
'memory_usage' => false, // Show queries memory usage
'soft_limit' => 100, // After the soft limit, no parameters/backtrace are captured
'hard_limit' => 500, // After the hard limit, queries are ignored
'hints' => false, // Show hints for common mistakes
'show_copy' => true, // Show copy button next to the query,
'slow_threshold' => false, // Only track queries that last longer than this time in ms
'memory_usage' => false, // Show queries memory usage
'soft_limit' => 100, // After the soft limit, no parameters/backtrace are captured
'hard_limit' => 500, // After the hard limit, queries are ignored
],
'mail' => [
'timeline' => true, // Add mails to the timeline
@@ -243,7 +243,7 @@ return [
'data' => false, // True for all data, 'keys' for only names, false for no parameters.
'group' => 50, // Group duplicate views. Pass value to auto-group, or true/false to force
'exclude_paths' => [ // Add the paths which you don't want to appear in the views
'vendor/filament' // Exclude Filament components by default
'vendor/filament', // Exclude Filament components by default
],
],
'route' => [

View File

@@ -37,6 +37,6 @@ return [
'oxapay' => [
'merchant_api_key' => env('OXAPAY_MERCHANT_API_KEY', ''),
'payout_api_key' => env('OXAPAY_PAYOUT_API_KEY', ''),
]
],
];

View File

@@ -16,4 +16,4 @@ class MetaFactory extends Factory
'value' => $this->faker->word(),
];
}
}
}

View File

@@ -17,10 +17,10 @@ class RemoteEmailFactory extends Factory
'from_name' => $this->faker->name(),
'from_email' => $this->faker->email(),
'to' => [$this->faker->email()],
'body_html' => '<p>' . $this->faker->paragraph() . '</p>',
'body_html' => '<p>'.$this->faker->paragraph().'</p>',
'body_text' => $this->faker->paragraph(),
'is_seen' => $this->faker->boolean(),
'timestamp' => $this->faker->dateTime(),
];
}
}
}

View File

@@ -13,7 +13,8 @@ return new class extends Migration
{
Schema::table('plans', function (Blueprint $table) {
$table->string('oxapay_link')->nullable()->after('accept_shoppy');
$table->boolean('accept_oxapay')->default(false)->after('oxapay_link');});
$table->boolean('accept_oxapay')->default(false)->after('oxapay_link');
});
}
/**

View File

@@ -3,7 +3,6 @@
namespace Database\Seeders;
use App\Models\User;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;

View File

@@ -3,7 +3,6 @@
namespace Database\Seeders;
use App\Models\Meta;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class MetaSeeder extends Seeder
@@ -17,10 +16,10 @@ class MetaSeeder extends Seeder
$metas->email_ids_created = 0;
$metas->messages_received = 0;
foreach ($metas as $key => $meta) {
if (!Meta::where('key', $key)->exists()) {
if (! Meta::where('key', $key)->exists()) {
Meta::create([
'key' => $key,
'value' => $meta
'value' => $meta,
]);
}
}

View File

@@ -3,7 +3,6 @@
namespace Database\Seeders;
use App\Models\Plan;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class UpdatePlansTableSeeder extends Seeder

View File

@@ -1,11 +1,13 @@
<?php
function deleteFiles($dir) {
function deleteFiles($dir)
{
// Open the directory
if ($handle = opendir($dir)) {
// Loop through each file in the directory
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$filePath = $dir . DIRECTORY_SEPARATOR . $file;
if ($file != '.' && $file != '..') {
$filePath = $dir.DIRECTORY_SEPARATOR.$file;
// If it's a directory, recursively call deleteFiles
if (is_dir($filePath)) {
deleteFiles($filePath);
@@ -38,4 +40,3 @@ if (is_dir($folderPath)) {
} else {
echo "Folder '$folderPath' does not exist or is not a directory.";
}
?>

View File

@@ -1,11 +1,13 @@
<?php
function deleteFiles($dir) {
function deleteFiles($dir)
{
// Open the directory
if ($handle = opendir($dir)) {
// Loop through each file in the directory
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$filePath = $dir . DIRECTORY_SEPARATOR . $file;
if ($file != '.' && $file != '..') {
$filePath = $dir.DIRECTORY_SEPARATOR.$file;
// If it's a directory, recursively call deleteFiles
if (is_dir($filePath)) {
deleteFiles($filePath);
@@ -38,4 +40,3 @@ if (is_dir($folderPath)) {
} else {
echo "Folder '$folderPath' does not exist or is not a directory.";
}
?>

View File

@@ -1,8 +1,9 @@
<?php
// 1. Bootstrap Laravel
require __DIR__ . '/vendor/autoload.php';
$app = require_once __DIR__ . '/bootstrap/app.php';
// 1. Bootstrap Laravel
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
// 2. Start Laravel container
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
@@ -24,23 +25,23 @@ $password = $imapDB['password'];
$inbox = imap_open($hostname, $username, $password);
// Check for connection errors
if (!$inbox) {
die('Could not connect to mailbox: ' . imap_last_error());
if (! $inbox) {
exit('Could not connect to mailbox: '.imap_last_error());
}
// Get current time in Unix timestamp
$current_time = time();
// Search for messages older than one day
//$search_criteria = 'BEFORE "' . date('d-M-Y', strtotime('-3 hours', $current_time)) . '"';
//$messages = imap_search($inbox, $search_criteria);
// $search_criteria = 'BEFORE "' . date('d-M-Y', strtotime('-3 hours', $current_time)) . '"';
// $messages = imap_search($inbox, $search_criteria);
$messages = imap_search($inbox, 'ALL');
$batch_size = 10;
$deleted_count = 0;
//if ($messages) {
// if ($messages) {
// $chunks = array_chunk($messages, $batch_size);
// foreach ($chunks as $chunk) {
// foreach ($chunk as $message_number) {
@@ -50,9 +51,9 @@ $deleted_count = 0;
// $deleted_count += count($chunk);
// }
// echo $deleted_count . ' messages older than specified time have been deleted.';
//} else {
// } else {
// echo 'No messages older than specified time found in mailbox.';
//}
// }
if ($messages) {
$chunks = array_chunk($messages, $batch_size);
@@ -71,7 +72,7 @@ if ($messages) {
}
imap_expunge($inbox);
}
echo $deleted_count . ' messages older than 2 hours have been deleted.';
echo $deleted_count.' messages older than 2 hours have been deleted.';
} else {
echo 'No messages found in mailbox.';
}

View File

@@ -1,8 +1,9 @@
<?php
// 1. Bootstrap Laravel
require __DIR__ . '/vendor/autoload.php';
$app = require_once __DIR__ . '/bootstrap/app.php';
// 1. Bootstrap Laravel
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
// 2. Start Laravel container
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
@@ -24,15 +25,15 @@ $password = $imapDB['premium_password'];
$inbox = imap_open($hostname, $username, $password);
// Check for connection errors
if (!$inbox) {
die('Could not connect to mailbox: ' . imap_last_error());
if (! $inbox) {
exit('Could not connect to mailbox: '.imap_last_error());
}
// Get current time in Unix timestamp
$current_time = time();
// Search for messages older than one day
$search_criteria = 'BEFORE "' . date('d-M-Y', strtotime('-3 hours', $current_time)) . '"';
$search_criteria = 'BEFORE "'.date('d-M-Y', strtotime('-3 hours', $current_time)).'"';
$messages = imap_search($inbox, $search_criteria);
$batch_size = 10;
@@ -47,11 +48,10 @@ if ($messages) {
imap_expunge($inbox);
$deleted_count += count($chunk);
}
echo $deleted_count . ' messages older than specified time have been deleted.';
echo $deleted_count.' messages older than specified time have been deleted.';
} else {
echo 'No messages older than specified time found in mailbox.';
}
// Close mailbox connection
imap_close($inbox);

View File

@@ -1,10 +1,10 @@
<?php
// Adjust this path if your file location is different
require __DIR__ . '/vendor/autoload.php';
require __DIR__.'/vendor/autoload.php';
// Bootstrap the Laravel application
$app = require_once __DIR__ . '/bootstrap/app.php';
$app = require_once __DIR__.'/bootstrap/app.php';
// Make the Console Kernel instance
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
@@ -20,5 +20,5 @@ try {
echo "Output:\n$output";
} catch (\Exception $e) {
echo "Error running Artisan command: " . $e->getMessage();
echo 'Error running Artisan command: '.$e->getMessage();
}

View File

@@ -1,10 +1,10 @@
<?php
// Adjust this path if your file location is different
require __DIR__ . '/vendor/autoload.php';
require __DIR__.'/vendor/autoload.php';
// Bootstrap the Laravel application
$app = require_once __DIR__ . '/bootstrap/app.php';
$app = require_once __DIR__.'/bootstrap/app.php';
// Make the Console Kernel instance
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
@@ -20,5 +20,5 @@ try {
echo "Output:\n$output";
} catch (\Exception $e) {
echo "Error running Artisan command: " . $e->getMessage();
echo 'Error running Artisan command: '.$e->getMessage();
}

View File

@@ -9,17 +9,17 @@ Artisan::command('inspire', function () {
$this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote');
//Schedule::call(function () {
// Schedule::call(function () {
// Email::fetchProcessStoreEmail();
//})->everyMinute();
// })->everyMinute();
Schedule::call(function () {
Email::deleteBulkAttachments();
})->daily();
//Schedule::call(function () {
// Schedule::call(function () {
// Email::deleteBulkMailboxes();
//})->everyMinute();
// })->everyMinute();
Schedule::call(function () {
Email::deleteMessagesFromDB();
@@ -30,13 +30,13 @@ Schedule::call(function () {
})->everyThreeHours();
Schedule::call(function () {
Email::cleanMailbox();
Email::cleanMailbox();
});
Artisan::command('cleanMail', function (){
Artisan::command('cleanMail', function () {
$this->comment(Email::cleanMailbox());
});
Artisan::command('closeTicket', function (){
$this->comment(Ticket::autoClose());
Artisan::command('closeTicket', function () {
$this->comment(Ticket::autoClose());
});

View File

@@ -15,7 +15,6 @@ use App\Livewire\Frontend\Mailbox;
use App\Livewire\Home;
use App\Livewire\ListBlog;
use App\Livewire\Page;
use App\Livewire\Settings\Appearance;
use App\Livewire\Settings\Password;
use App\Livewire\Settings\Profile;
@@ -45,6 +44,7 @@ Route::post('/sync', function (Request $request) {
} catch (\Exception $e) {
\Log::error($e->getMessage());
}
return response()->noContent();
});
@@ -75,13 +75,13 @@ Route::middleware(['auth', 'verified', CheckUserBanned::class])->group(function
if (in_array($pricing_id, $pricingData)) {
return auth()->user()
->newSubscription('default', $pricing_id)
->allowPromotionCodes()
->checkout([
'billing_address_collection' => 'required',
'success_url' => route('checkout.success'),
'cancel_url' => route('checkout.cancel'),
]);
->newSubscription('default', $pricing_id)
->allowPromotionCodes()
->checkout([
'billing_address_collection' => 'required',
'success_url' => route('checkout.success'),
'cancel_url' => route('checkout.cancel'),
]);
}
abort(404);
@@ -98,7 +98,7 @@ Route::middleware(['auth', 'verified', CheckUserBanned::class])->group(function
$validUser = 'admin';
$validPass = 'admin@9608'; // 🔐 Change this to something secure
if (!isset($_SERVER['PHP_AUTH_USER']) ||
if (! isset($_SERVER['PHP_AUTH_USER']) ||
$_SERVER['PHP_AUTH_USER'] !== $validUser ||
$_SERVER['PHP_AUTH_PW'] !== $validPass) {
@@ -119,7 +119,7 @@ Route::middleware(['auth', 'verified', CheckUserBanned::class])->group(function
$validUser = 'admin';
$validPass = 'admin@9608'; // 🔐 Change this to something secure
if (!isset($_SERVER['PHP_AUTH_USER']) ||
if (! isset($_SERVER['PHP_AUTH_USER']) ||
$_SERVER['PHP_AUTH_USER'] !== $validUser ||
$_SERVER['PHP_AUTH_PW'] !== $validPass) {

View File

@@ -79,13 +79,13 @@ trait LoadsApplicationData
}
// Ensure we always have collections, even if cache is empty
if (!($menus instanceof \Illuminate\Support\Collection)) {
if (! ($menus instanceof \Illuminate\Support\Collection)) {
$menus = collect();
}
if (!($blogs instanceof \Illuminate\Support\Collection)) {
if (! ($blogs instanceof \Illuminate\Support\Collection)) {
$blogs = collect();
}
if (!($plans instanceof \Illuminate\Support\Collection)) {
if (! ($plans instanceof \Illuminate\Support\Collection)) {
$plans = collect();
}

View File

@@ -2,7 +2,6 @@
namespace Tests\Feature\Controllers;
use App\Http\Controllers\WebhookController;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
@@ -263,7 +262,6 @@ class WebhookControllerTest extends TestCase
'email' => 'test@example.com',
];
$response = $this->postJson('/webhook/oxapay', $invalidData);
$response->assertStatus(400);
@@ -284,7 +282,6 @@ class WebhookControllerTest extends TestCase
$validHmac = hash_hmac('sha512', $postData, $apiSecretKey);
$invalidHmac = 'invalid_hmac';
$response = $this->postJson('/webhook/oxapay', $validData, [
'HMAC' => $invalidHmac,
]);
@@ -349,7 +346,6 @@ class WebhookControllerTest extends TestCase
$invoicePostData = json_encode($invoiceData);
$invoiceHmac = hash_hmac('sha512', $invoicePostData, 'test_merchant_key');
$response = $this->postJson('/webhook/oxapay', $invoiceData, [
'HMAC' => $invoiceHmac,
]);
@@ -387,4 +383,4 @@ class WebhookControllerTest extends TestCase
$response->assertStatus(200);
}
}
}

View File

@@ -2,8 +2,8 @@
namespace Tests\Feature;
use Tests\TestCase;
use Tests\Concerns\LoadsApplicationData;
use Tests\TestCase;
class ExampleTest extends TestCase
{

View File

@@ -2,11 +2,8 @@
namespace Tests\Feature\Filament;
use App\Filament\Resources\BlogResource;
use App\Filament\Resources\BlogResource\Pages\CreateBlog;
use App\Filament\Resources\PlanResource;
use App\Filament\Resources\PlanResource\Pages\CreatePlan;
use App\Filament\Resources\TicketResource;
use App\Filament\Resources\TicketResource\Pages\CreateTicket;
use App\Models\Blog;
use App\Models\Category;
@@ -17,8 +14,8 @@ use App\Models\Ticket;
use App\Models\TicketResponse;
use App\Models\User;
use Filament\Facades\Filament;
use Tests\TestCase;
use Livewire\Livewire;
use Tests\TestCase;
class ResourcesTest extends TestCase
{
@@ -693,7 +690,6 @@ class ResourcesTest extends TestCase
->assertHasFormErrors(['name', 'url']);
}
/** @test */
public function it_can_delete_menu_item()
{
@@ -716,7 +712,6 @@ class ResourcesTest extends TestCase
->assertCanSeeTableRecords([$menu2, $menu1], inOrder: true);
}
/** @test */
public function it_can_handle_parent_child_relationships()
{
@@ -859,4 +854,4 @@ class ResourcesTest extends TestCase
->sortTable('name')
->assertSuccessful();
}
}
}

View File

@@ -7,12 +7,10 @@ use App\Filament\Resources\UserResource\Pages\CreateUser;
use App\Filament\Resources\UserResource\Pages\EditUser;
use App\Filament\Resources\UserResource\Pages\ListUsers;
use App\Models\Log;
use App\Models\UsageLog;
use App\Models\User;
use Filament\Facades\Filament;
use Illuminate\Support\Facades\Notification;
use Tests\TestCase;
use Livewire\Livewire;
use Tests\TestCase;
class UserResourceTest extends TestCase
{
@@ -306,8 +304,6 @@ class UserResourceTest extends TestCase
->assertTableBulkActionExists('updateLevel');
}
/** @test */
public function it_searches_across_multiple_fields()
{
@@ -342,4 +338,4 @@ class UserResourceTest extends TestCase
{
$this->assertEquals(User::class, UserResource::getModel());
}
}
}

View File

@@ -91,7 +91,7 @@ class LoginTest extends TestCase
public function it_handles_rate_limiting()
{
// Clear any existing rate limit attempts
RateLimiter::clear('login:' . request()->ip());
RateLimiter::clear('login:'.request()->ip());
// Exceed the rate limit (5 attempts by default)
for ($i = 0; $i < 6; $i++) {
@@ -124,7 +124,7 @@ class LoginTest extends TestCase
public function it_handles_lockout_event()
{
// Clear any existing rate limit attempts
RateLimiter::clear('login:' . request()->ip());
RateLimiter::clear('login:'.request()->ip());
// Exceed the rate limit to trigger lockout
for ($i = 0; $i < 6; $i++) {
@@ -170,4 +170,4 @@ class LoginTest extends TestCase
$this->assertAuthenticatedAs($this->user);
}
}
}

View File

@@ -205,4 +205,4 @@ class RegisterTest extends TestCase
->call('register')
->assertHasErrors(['password']);
}
}
}

View File

@@ -58,4 +58,4 @@ class DashboardTest extends TestCase
$component->assertSee('Purchase Subscription');
$component->assertSee('Have an Activation Key?');
}
}
}

Some files were not shown because too many files have changed in this diff Show More