chore: code styling via pint
This commit is contained in:
@@ -7,32 +7,32 @@ trait ColorPicker
|
|||||||
public static function chooseColor($letter): array
|
public static function chooseColor($letter): array
|
||||||
{
|
{
|
||||||
$colorReferences = [
|
$colorReferences = [
|
||||||
"A" => ["dark" => "dark:bg-amber-500", "light" => "bg-amber-800"],
|
'A' => ['dark' => 'dark:bg-amber-500', 'light' => 'bg-amber-800'],
|
||||||
"B" => ["dark" => "dark:bg-blue-500", "light" => "bg-blue-800"],
|
'B' => ['dark' => 'dark:bg-blue-500', 'light' => 'bg-blue-800'],
|
||||||
"C" => ["dark" => "dark:bg-cyan-500", "light" => "bg-cyan-800"],
|
'C' => ['dark' => 'dark:bg-cyan-500', 'light' => 'bg-cyan-800'],
|
||||||
"D" => ["dark" => "dark:bg-emerald-500", "light" => "bg-emerald-800"],
|
'D' => ['dark' => 'dark:bg-emerald-500', 'light' => 'bg-emerald-800'],
|
||||||
"E" => ["dark" => "dark:bg-fuchsia-500", "light" => "bg-fuchsia-800"],
|
'E' => ['dark' => 'dark:bg-fuchsia-500', 'light' => 'bg-fuchsia-800'],
|
||||||
"F" => ["dark" => "dark:bg-gray-500", "light" => "bg-gray-800"],
|
'F' => ['dark' => 'dark:bg-gray-500', 'light' => 'bg-gray-800'],
|
||||||
"G" => ["dark" => "dark:bg-green-500", "light" => "bg-green-800"],
|
'G' => ['dark' => 'dark:bg-green-500', 'light' => 'bg-green-800'],
|
||||||
"H" => ["dark" => "dark:bg-indigo-500", "light" => "bg-indigo-800"],
|
'H' => ['dark' => 'dark:bg-indigo-500', 'light' => 'bg-indigo-800'],
|
||||||
"I" => ["dark" => "dark:bg-lime-500", "light" => "bg-lime-800"],
|
'I' => ['dark' => 'dark:bg-lime-500', 'light' => 'bg-lime-800'],
|
||||||
"J" => ["dark" => "dark:bg-neutral-500", "light" => "bg-neutral-800"],
|
'J' => ['dark' => 'dark:bg-neutral-500', 'light' => 'bg-neutral-800'],
|
||||||
"K" => ["dark" => "dark:bg-orange-500", "light" => "bg-orange-800"],
|
'K' => ['dark' => 'dark:bg-orange-500', 'light' => 'bg-orange-800'],
|
||||||
"L" => ["dark" => "dark:bg-pink-500", "light" => "bg-pink-800"],
|
'L' => ['dark' => 'dark:bg-pink-500', 'light' => 'bg-pink-800'],
|
||||||
"M" => ["dark" => "dark:bg-purple-500", "light" => "bg-purple-800"],
|
'M' => ['dark' => 'dark:bg-purple-500', 'light' => 'bg-purple-800'],
|
||||||
"N" => ["dark" => "dark:bg-red-500", "light" => "bg-red-800"],
|
'N' => ['dark' => 'dark:bg-red-500', 'light' => 'bg-red-800'],
|
||||||
"O" => ["dark" => "dark:bg-rose-500", "light" => "bg-rose-800"],
|
'O' => ['dark' => 'dark:bg-rose-500', 'light' => 'bg-rose-800'],
|
||||||
"P" => ["dark" => "dark:bg-sky-500", "light" => "bg-sky-800"],
|
'P' => ['dark' => 'dark:bg-sky-500', 'light' => 'bg-sky-800'],
|
||||||
"Q" => ["dark" => "dark:bg-slate-500", "light" => "bg-slate-800"],
|
'Q' => ['dark' => 'dark:bg-slate-500', 'light' => 'bg-slate-800'],
|
||||||
"R" => ["dark" => "dark:bg-stone-500", "light" => "bg-stone-800"],
|
'R' => ['dark' => 'dark:bg-stone-500', 'light' => 'bg-stone-800'],
|
||||||
"S" => ["dark" => "dark:bg-teal-500", "light" => "bg-teal-800"],
|
'S' => ['dark' => 'dark:bg-teal-500', 'light' => 'bg-teal-800'],
|
||||||
"T" => ["dark" => "dark:bg-violet-500", "light" => "bg-violet-800"],
|
'T' => ['dark' => 'dark:bg-violet-500', 'light' => 'bg-violet-800'],
|
||||||
"U" => ["dark" => "dark:bg-yellow-500", "light" => "bg-yellow-800"],
|
'U' => ['dark' => 'dark:bg-yellow-500', 'light' => 'bg-yellow-800'],
|
||||||
"V" => ["dark" => "dark:bg-zinc-500", "light" => "bg-zinc-800"],
|
'V' => ['dark' => 'dark:bg-zinc-500', 'light' => 'bg-zinc-800'],
|
||||||
"W" => ["dark" => "dark:bg-neutral-500", "light" => "bg-neutral-800"],
|
'W' => ['dark' => 'dark:bg-neutral-500', 'light' => 'bg-neutral-800'],
|
||||||
"X" => ["dark" => "dark:bg-slate-500", "light" => "bg-slate-800"],
|
'X' => ['dark' => 'dark:bg-slate-500', 'light' => 'bg-slate-800'],
|
||||||
"Y" => ["dark" => "dark:bg-stone-500", "light" => "bg-stone-800"],
|
'Y' => ['dark' => 'dark:bg-stone-500', 'light' => 'bg-stone-800'],
|
||||||
"Z" => ["dark" => "dark:bg-teal-500", "light" => "bg-teal-800"]
|
'Z' => ['dark' => 'dark:bg-teal-500', 'light' => 'bg-teal-800'],
|
||||||
];
|
];
|
||||||
|
|
||||||
$letter = strtoupper($letter);
|
$letter = strtoupper($letter);
|
||||||
@@ -41,7 +41,7 @@ trait ColorPicker
|
|||||||
return $colorReferences[$letter];
|
return $colorReferences[$letter];
|
||||||
}
|
}
|
||||||
|
|
||||||
return ["dark" => "dark:bg-gray-500", "light" => "bg-gray-800"];
|
return ['dark' => 'dark:bg-gray-500', 'light' => 'bg-gray-800'];
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,35 +2,39 @@
|
|||||||
|
|
||||||
namespace App\Filament\Pages;
|
namespace App\Filament\Pages;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Filament\Actions\BulkAction;
|
|
||||||
use App\Models\ActivationKey;
|
use App\Models\ActivationKey;
|
||||||
use App\Models\Plan;
|
use App\Models\Plan;
|
||||||
|
use Filament\Actions\BulkAction;
|
||||||
use Filament\Forms\Components\Select;
|
use Filament\Forms\Components\Select;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Forms\Concerns\InteractsWithForms;
|
use Filament\Forms\Concerns\InteractsWithForms;
|
||||||
use Filament\Forms\Contracts\HasForms;
|
use Filament\Forms\Contracts\HasForms;
|
||||||
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Pages\Page;
|
use Filament\Pages\Page;
|
||||||
use Filament\Tables\Columns\BooleanColumn;
|
use Filament\Tables\Columns\BooleanColumn;
|
||||||
use Filament\Tables\Columns\TextColumn;
|
use Filament\Tables\Columns\TextColumn;
|
||||||
use Filament\Tables\Concerns\InteractsWithTable;
|
use Filament\Tables\Concerns\InteractsWithTable;
|
||||||
use Filament\Tables\Contracts\HasTable;
|
use Filament\Tables\Contracts\HasTable;
|
||||||
use Filament\Tables\Filters\SelectFilter;
|
use Filament\Tables\Filters\SelectFilter;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Response;
|
use Response;
|
||||||
use Str;
|
use Str;
|
||||||
use Filament\Notifications\Notification;
|
|
||||||
|
|
||||||
class GenerateActivationKeys extends Page implements HasForms, HasTable
|
class GenerateActivationKeys extends Page implements HasForms, HasTable
|
||||||
{
|
{
|
||||||
use InteractsWithForms, InteractsWithTable;
|
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 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';
|
protected static ?string $title = 'Activation Keys';
|
||||||
|
|
||||||
public $plan_id;
|
public $plan_id;
|
||||||
|
|
||||||
public $quantity = 1;
|
public $quantity = 1;
|
||||||
|
|
||||||
public function mount(): void
|
public function mount(): void
|
||||||
@@ -97,10 +101,10 @@ class GenerateActivationKeys extends Page implements HasForms, HasTable
|
|||||||
->label('Interval')
|
->label('Interval')
|
||||||
->getStateUsing(function ($record) {
|
->getStateUsing(function ($record) {
|
||||||
$isMonthly = Plan::where('pricing_id', $record->price_id)->value('monthly_billing');
|
$isMonthly = Plan::where('pricing_id', $record->price_id)->value('monthly_billing');
|
||||||
|
|
||||||
return $isMonthly ? 'Monthly' : 'Yearly';
|
return $isMonthly ? 'Monthly' : 'Yearly';
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|
||||||
TextColumn::make('created_at')
|
TextColumn::make('created_at')
|
||||||
->dateTime(),
|
->dateTime(),
|
||||||
];
|
];
|
||||||
@@ -136,12 +140,12 @@ class GenerateActivationKeys extends Page implements HasForms, HasTable
|
|||||||
{
|
{
|
||||||
$text = $records->pluck('activation_key')->implode("\n");
|
$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'
|
// Store the file in the 'public' directory or a subdirectory within 'public'
|
||||||
$path = public_path("activation/{$filename}");
|
$path = public_path("activation/{$filename}");
|
||||||
|
|
||||||
// Make sure the 'activation' folder exists, create it if it doesn't
|
// 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);
|
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 the response that allows users to download the file directly
|
||||||
return response()->download($path)->deleteFileAfterSend(true);
|
return response()->download($path)->deleteFileAfterSend(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Filament\Pages;
|
namespace App\Filament\Pages;
|
||||||
|
|
||||||
use Filament\Schemas\Schema;
|
|
||||||
use Filament\Schemas\Components\Section;
|
|
||||||
use Exception;
|
|
||||||
use App\Models\Setting;
|
use App\Models\Setting;
|
||||||
use App\Models\ZEmail;
|
use App\Models\ZEmail;
|
||||||
use Artisan;
|
use Artisan;
|
||||||
use Ddeboer\Imap\Server;
|
use Exception;
|
||||||
use Filament\Forms\Components\Checkbox;
|
use Filament\Forms\Components\Checkbox;
|
||||||
use Filament\Forms\Components\KeyValue;
|
use Filament\Forms\Components\KeyValue;
|
||||||
use Filament\Forms\Components\Repeater;
|
use Filament\Forms\Components\Repeater;
|
||||||
@@ -19,6 +16,8 @@ use Filament\Forms\Concerns\InteractsWithForms;
|
|||||||
use Filament\Forms\Contracts\HasForms;
|
use Filament\Forms\Contracts\HasForms;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Pages\Page;
|
use Filament\Pages\Page;
|
||||||
|
use Filament\Schemas\Components\Section;
|
||||||
|
use Filament\Schemas\Schema;
|
||||||
|
|
||||||
class Settings extends Page implements HasForms
|
class Settings extends Page implements HasForms
|
||||||
{
|
{
|
||||||
@@ -26,11 +25,11 @@ class Settings extends Page implements HasForms
|
|||||||
|
|
||||||
public ?array $data = [];
|
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 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
|
public function mount(): void
|
||||||
{
|
{
|
||||||
@@ -51,7 +50,7 @@ class Settings extends Page implements HasForms
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
$this->applyDefaults($configurationSettings, [
|
$this->applyDefaults($configurationSettings, [
|
||||||
'cron_password' => fn() => $this->generateRandomString(20),
|
'cron_password' => fn () => $this->generateRandomString(20),
|
||||||
'date_format' => 'd M Y h:i A',
|
'date_format' => 'd M Y h:i A',
|
||||||
'after_last_email_delete' => 'redirect_to_homepage',
|
'after_last_email_delete' => 'redirect_to_homepage',
|
||||||
]);
|
]);
|
||||||
@@ -92,7 +91,6 @@ class Settings extends Page implements HasForms
|
|||||||
'ads_settings' => $adsSettings,
|
'ads_settings' => $adsSettings,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
'app_admin' => $auth_email,
|
'app_admin' => $auth_email,
|
||||||
@@ -142,13 +140,12 @@ class Settings extends Page implements HasForms
|
|||||||
->collapsed()
|
->collapsed()
|
||||||
->schema([
|
->schema([
|
||||||
|
|
||||||
|
|
||||||
Repeater::make('app_social')
|
Repeater::make('app_social')
|
||||||
->statePath('app_social')
|
->statePath('app_social')
|
||||||
->schema([
|
->schema([
|
||||||
TextInput::make('icon')->label('Icon')->required()->maxLength(100),
|
TextInput::make('icon')->label('Icon')->required()->maxLength(100),
|
||||||
TextInput::make('url')->label('URL')->url()->required()->maxLength(255),
|
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([
|
Select::make('imap_settings.encryption')->options([
|
||||||
'none' => 'None',
|
'none' => 'None',
|
||||||
'ssl' => 'SSL',
|
'ssl' => 'SSL',
|
||||||
'tls' => 'TLS'
|
'tls' => 'TLS',
|
||||||
]),
|
]),
|
||||||
Checkbox::make('imap_settings.validate_cert')->label('Validate Encryption Certificate')->default(false),
|
Checkbox::make('imap_settings.validate_cert')->label('Validate Encryption Certificate')->default(false),
|
||||||
TextInput::make('imap_settings.username')->label('Username')->required(),
|
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([
|
Select::make('imap_settings.premium_encryption')->options([
|
||||||
'none' => 'None',
|
'none' => 'None',
|
||||||
'ssl' => 'SSL',
|
'ssl' => 'SSL',
|
||||||
'tls' => 'TLS'
|
'tls' => 'TLS',
|
||||||
]),
|
]),
|
||||||
Checkbox::make('imap_settings.premium_validate_cert')->label('Validate Encryption Certificate')->default(false),
|
Checkbox::make('imap_settings.premium_validate_cert')->label('Validate Encryption Certificate')->default(false),
|
||||||
TextInput::make('imap_settings.premium_username')->label('Username')->required(),
|
TextInput::make('imap_settings.premium_username')->label('Username')->required(),
|
||||||
@@ -220,7 +217,7 @@ class Settings extends Page implements HasForms
|
|||||||
KeyValue::make('configuration_settings.font_family')
|
KeyValue::make('configuration_settings.font_family')
|
||||||
->label('Font Family')
|
->label('Font Family')
|
||||||
->columnSpan(2)
|
->columnSpan(2)
|
||||||
->helperText('Use Google Fonts with exact name.')
|
->helperText('Use Google Fonts with exact name.'),
|
||||||
]),
|
]),
|
||||||
|
|
||||||
Select::make('configuration_settings.default_language')->options([
|
Select::make('configuration_settings.default_language')->options([
|
||||||
@@ -356,7 +353,6 @@ class Settings extends Page implements HasForms
|
|||||||
->statePath('data');
|
->statePath('data');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function flushCache(): void
|
public function flushCache(): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -378,7 +374,7 @@ class Settings extends Page implements HasForms
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
$data = $this->form->getState();
|
$data = $this->form->getState();
|
||||||
if (!$this->testIMAP($data['imap_settings'])) {
|
if (! $this->testIMAP($data['imap_settings'])) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
@@ -403,7 +399,7 @@ class Settings extends Page implements HasForms
|
|||||||
'outlookUsernames' => 'outlookUsername',
|
'outlookUsernames' => 'outlookUsername',
|
||||||
'premium_outlookUsernames' => 'premium_outlookUsername',
|
'premium_outlookUsernames' => 'premium_outlookUsername',
|
||||||
'forbidden_ids' => 'forbidden_id',
|
'forbidden_ids' => 'forbidden_id',
|
||||||
'blocked_domains' => 'blocked_domain'
|
'blocked_domains' => 'blocked_domain',
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($pluckMap as $key => $subKey) {
|
foreach ($pluckMap as $key => $subKey) {
|
||||||
@@ -423,7 +419,7 @@ class Settings extends Page implements HasForms
|
|||||||
$app_admin = $setting->app_admin;
|
$app_admin = $setting->app_admin;
|
||||||
if ($app_admin == $auth_email) {
|
if ($app_admin == $auth_email) {
|
||||||
$update_res = $setting->update($data);
|
$update_res = $setting->update($data);
|
||||||
if($update_res) {
|
if ($update_res) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Saved successfully')
|
->title('Saved successfully')
|
||||||
->success()
|
->success()
|
||||||
@@ -453,7 +449,7 @@ class Settings extends Page implements HasForms
|
|||||||
];
|
];
|
||||||
$create_res = Setting::create(array_merge($data));
|
$create_res = Setting::create(array_merge($data));
|
||||||
|
|
||||||
if($create_res) {
|
if ($create_res) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Saved successfully')
|
->title('Saved successfully')
|
||||||
->success()
|
->success()
|
||||||
@@ -476,10 +472,12 @@ class Settings extends Page implements HasForms
|
|||||||
for ($i = 0; $i < $length; $i++) {
|
for ($i = 0; $i < $length; $i++) {
|
||||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $randomString;
|
return $randomString;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function applyDefaults(array &$target, array $defaults): void {
|
private function applyDefaults(array &$target, array $defaults): void
|
||||||
|
{
|
||||||
foreach ($defaults as $key => $value) {
|
foreach ($defaults as $key => $value) {
|
||||||
$target[$key] ??= is_callable($value) ? $value() : $value;
|
$target[$key] ??= is_callable($value) ? $value() : $value;
|
||||||
}
|
}
|
||||||
@@ -489,16 +487,18 @@ class Settings extends Page implements HasForms
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
// First check if IMAP extension is available
|
// First check if IMAP extension is available
|
||||||
if (!function_exists('imap_open')) {
|
if (! function_exists('imap_open')) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('IMAP Extension Not Available')
|
->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.')
|
->body('The PHP IMAP extension is not loaded in your web server. Please check your Herd PHP configuration or restart your server.')
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZEmail::connectMailBox($imap);
|
ZEmail::connectMailBox($imap);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
$errorMessage = $exception->getMessage();
|
$errorMessage = $exception->getMessage();
|
||||||
@@ -509,9 +509,10 @@ class Settings extends Page implements HasForms
|
|||||||
}
|
}
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('IMAP Error: ' . $errorMessage)
|
->title('IMAP Error: '.$errorMessage)
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,52 +2,45 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources;
|
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\CreateBlog;
|
||||||
use App\Filament\Resources\BlogResource\Pages\EditBlog;
|
use App\Filament\Resources\BlogResource\Pages\EditBlog;
|
||||||
use App\Filament\Resources\BlogResource\Pages;
|
use App\Filament\Resources\BlogResource\Pages\ListBlogs;
|
||||||
use App\Filament\Resources\BlogResource\RelationManagers;
|
|
||||||
use App\Models\Blog;
|
use App\Models\Blog;
|
||||||
use App\Models\Category;
|
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\FileUpload;
|
||||||
use Filament\Forms\Components\KeyValue;
|
use Filament\Forms\Components\KeyValue;
|
||||||
use Filament\Forms\Components\Repeater;
|
|
||||||
use Filament\Forms\Components\RichEditor;
|
use Filament\Forms\Components\RichEditor;
|
||||||
use Filament\Forms\Components\Select;
|
use Filament\Forms\Components\Select;
|
||||||
use Filament\Forms\Components\Textarea;
|
use Filament\Forms\Components\Textarea;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Resources\RelationManagers\RelationManager;
|
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Tables;
|
use Filament\Schemas\Components\Section;
|
||||||
use Filament\Tables\Table;
|
use Filament\Schemas\Components\Utilities\Set;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Filament\Schemas\Schema;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
||||||
use Filament\Tables\Columns\IconColumn;
|
use Filament\Tables\Columns\IconColumn;
|
||||||
use Filament\Tables\Columns\TextColumn;
|
use Filament\Tables\Columns\TextColumn;
|
||||||
use Filament\Tables\Filters\SelectFilter;
|
use Filament\Tables\Filters\SelectFilter;
|
||||||
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class BlogResource extends Resource
|
class BlogResource extends Resource
|
||||||
{
|
{
|
||||||
protected static ?string $model = Blog::class;
|
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
|
public static function form(Schema $schema): Schema
|
||||||
{
|
{
|
||||||
$categories = Category::pluck('name', 'id')->toArray();
|
$categories = Category::pluck('name', 'id')->toArray();
|
||||||
|
|
||||||
return $schema
|
return $schema
|
||||||
->components([
|
->components([
|
||||||
Section::make('Post Information')
|
Section::make('Post Information')
|
||||||
@@ -74,7 +67,7 @@ class BlogResource extends Resource
|
|||||||
Select::make('is_published')
|
Select::make('is_published')
|
||||||
->options([
|
->options([
|
||||||
0 => 'Draft',
|
0 => 'Draft',
|
||||||
1 => 'Published'
|
1 => 'Published',
|
||||||
])
|
])
|
||||||
->searchable()
|
->searchable()
|
||||||
->default(1)
|
->default(1)
|
||||||
@@ -107,7 +100,6 @@ class BlogResource extends Resource
|
|||||||
->valuePlaceholder('Content'),
|
->valuePlaceholder('Content'),
|
||||||
Textarea::make('custom_header')->rows(6)->label('Custom Header (Optional)'),
|
Textarea::make('custom_header')->rows(6)->label('Custom Header (Optional)'),
|
||||||
|
|
||||||
|
|
||||||
]),
|
]),
|
||||||
|
|
||||||
]);
|
]);
|
||||||
@@ -141,7 +133,7 @@ class BlogResource extends Resource
|
|||||||
->label('Toggle Published')
|
->label('Toggle Published')
|
||||||
->icon('heroicon-o-eye')
|
->icon('heroicon-o-eye')
|
||||||
->action(function (Blog $record) {
|
->action(function (Blog $record) {
|
||||||
$record->update(['is_published' => !$record->is_published]);
|
$record->update(['is_published' => ! $record->is_published]);
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
->toolbarActions([
|
->toolbarActions([
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace App\Filament\Resources\BlogResource\Pages;
|
namespace App\Filament\Resources\BlogResource\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\BlogResource;
|
use App\Filament\Resources\BlogResource;
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources\BlogResource\Pages;
|
namespace App\Filament\Resources\BlogResource\Pages;
|
||||||
|
|
||||||
use Filament\Actions\DeleteAction;
|
|
||||||
use App\Filament\Resources\BlogResource;
|
use App\Filament\Resources\BlogResource;
|
||||||
use Filament\Actions;
|
use Filament\Actions\DeleteAction;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Resources\Pages\EditRecord;
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
@@ -18,6 +17,7 @@ class EditBlog extends EditRecord
|
|||||||
DeleteAction::make(),
|
DeleteAction::make(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getRedirectUrl(): ?string
|
protected function getRedirectUrl(): ?string
|
||||||
{
|
{
|
||||||
return $this->getResource()::getUrl('index');
|
return $this->getResource()::getUrl('index');
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources\BlogResource\Pages;
|
namespace App\Filament\Resources\BlogResource\Pages;
|
||||||
|
|
||||||
use Filament\Actions\CreateAction;
|
|
||||||
use App\Filament\Resources\BlogResource;
|
use App\Filament\Resources\BlogResource;
|
||||||
use Filament\Actions;
|
use Filament\Actions\CreateAction;
|
||||||
use Filament\Resources\Pages\ListRecords;
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
class ListBlogs extends ListRecords
|
class ListBlogs extends ListRecords
|
||||||
|
|||||||
@@ -2,39 +2,33 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources;
|
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\CreateCategory;
|
||||||
use App\Filament\Resources\CategoryResource\Pages\EditCategory;
|
use App\Filament\Resources\CategoryResource\Pages\EditCategory;
|
||||||
use App\Filament\Resources\CategoryResource\Pages;
|
use App\Filament\Resources\CategoryResource\Pages\ListCategories;
|
||||||
use App\Filament\Resources\CategoryResource\RelationManagers;
|
|
||||||
use App\Models\Category;
|
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\Select;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Tables;
|
use Filament\Schemas\Components\Utilities\Set;
|
||||||
use Filament\Tables\Table;
|
use Filament\Schemas\Schema;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
||||||
use Filament\Tables\Columns\IconColumn;
|
use Filament\Tables\Columns\IconColumn;
|
||||||
use Filament\Tables\Columns\TextColumn;
|
use Filament\Tables\Columns\TextColumn;
|
||||||
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class CategoryResource extends Resource
|
class CategoryResource extends Resource
|
||||||
{
|
{
|
||||||
protected static ?string $model = Category::class;
|
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
|
public static function form(Schema $schema): Schema
|
||||||
{
|
{
|
||||||
@@ -52,7 +46,7 @@ class CategoryResource extends Resource
|
|||||||
])
|
])
|
||||||
->columnSpanFull()
|
->columnSpanFull()
|
||||||
->required()
|
->required()
|
||||||
->default(1)
|
->default(1),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,7 +74,7 @@ class CategoryResource extends Resource
|
|||||||
->label('Toggle Status')
|
->label('Toggle Status')
|
||||||
->icon('heroicon-o-power')
|
->icon('heroicon-o-power')
|
||||||
->action(function (Category $record) {
|
->action(function (Category $record) {
|
||||||
$record->update(['is_active' => !$record->is_active]);
|
$record->update(['is_active' => ! $record->is_active]);
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
->toolbarActions([
|
->toolbarActions([
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace App\Filament\Resources\CategoryResource\Pages;
|
namespace App\Filament\Resources\CategoryResource\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\CategoryResource;
|
use App\Filament\Resources\CategoryResource;
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
class CreateCategory extends CreateRecord
|
class CreateCategory extends CreateRecord
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources\CategoryResource\Pages;
|
namespace App\Filament\Resources\CategoryResource\Pages;
|
||||||
|
|
||||||
use Filament\Actions\DeleteAction;
|
|
||||||
use App\Filament\Resources\CategoryResource;
|
use App\Filament\Resources\CategoryResource;
|
||||||
use Filament\Actions;
|
use Filament\Actions\DeleteAction;
|
||||||
use Filament\Resources\Pages\EditRecord;
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
class EditCategory extends EditRecord
|
class EditCategory extends EditRecord
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources\CategoryResource\Pages;
|
namespace App\Filament\Resources\CategoryResource\Pages;
|
||||||
|
|
||||||
use Filament\Actions\CreateAction;
|
|
||||||
use App\Filament\Resources\CategoryResource;
|
use App\Filament\Resources\CategoryResource;
|
||||||
use Filament\Actions;
|
use Filament\Actions\CreateAction;
|
||||||
use Filament\Resources\Pages\ListRecords;
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
class ListCategories extends ListRecords
|
class ListCategories extends ListRecords
|
||||||
|
|||||||
@@ -2,41 +2,36 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources;
|
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\CreateMenu;
|
||||||
use App\Filament\Resources\MenuResource\Pages\EditMenu;
|
use App\Filament\Resources\MenuResource\Pages\EditMenu;
|
||||||
use App\Filament\Resources\MenuResource\Pages;
|
use App\Filament\Resources\MenuResource\Pages\ListMenus;
|
||||||
use App\Filament\Resources\MenuResource\RelationManagers;
|
|
||||||
use App\Models\Menu;
|
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\Select;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Forms\Components\Toggle;
|
use Filament\Forms\Components\Toggle;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Tables;
|
use Filament\Schemas\Schema;
|
||||||
use Filament\Tables\Columns\IconColumn;
|
use Filament\Tables\Columns\IconColumn;
|
||||||
use Filament\Tables\Columns\TextColumn;
|
use Filament\Tables\Columns\TextColumn;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
||||||
|
|
||||||
class MenuResource extends Resource
|
class MenuResource extends Resource
|
||||||
{
|
{
|
||||||
protected static ?string $model = Menu::class;
|
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
|
public static function form(Schema $schema): Schema
|
||||||
{
|
{
|
||||||
$menus = Menu::Pluck('name', 'id')->toArray();
|
$menus = Menu::Pluck('name', 'id')->toArray();
|
||||||
|
|
||||||
return $schema
|
return $schema
|
||||||
->components([
|
->components([
|
||||||
TextInput::make('name')
|
TextInput::make('name')
|
||||||
@@ -65,7 +60,7 @@ class MenuResource extends Resource
|
|||||||
TextColumn::make('name')->sortable(),
|
TextColumn::make('name')->sortable(),
|
||||||
TextColumn::make('url')->label('URL'),
|
TextColumn::make('url')->label('URL'),
|
||||||
TextColumn::make('parentname.name')->label('Parent Name'),
|
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([
|
->filters([
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace App\Filament\Resources\MenuResource\Pages;
|
namespace App\Filament\Resources\MenuResource\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\MenuResource;
|
use App\Filament\Resources\MenuResource;
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources\MenuResource\Pages;
|
namespace App\Filament\Resources\MenuResource\Pages;
|
||||||
|
|
||||||
use Filament\Actions\DeleteAction;
|
|
||||||
use App\Filament\Resources\MenuResource;
|
use App\Filament\Resources\MenuResource;
|
||||||
use Filament\Actions;
|
use Filament\Actions\DeleteAction;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Resources\Pages\EditRecord;
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
@@ -18,6 +17,7 @@ class EditMenu extends EditRecord
|
|||||||
DeleteAction::make(),
|
DeleteAction::make(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getRedirectUrl(): ?string
|
protected function getRedirectUrl(): ?string
|
||||||
{
|
{
|
||||||
return $this->getResource()::getUrl('index');
|
return $this->getResource()::getUrl('index');
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources\MenuResource\Pages;
|
namespace App\Filament\Resources\MenuResource\Pages;
|
||||||
|
|
||||||
use Filament\Actions\CreateAction;
|
|
||||||
use App\Filament\Resources\MenuResource;
|
use App\Filament\Resources\MenuResource;
|
||||||
use Filament\Actions;
|
use Filament\Actions\CreateAction;
|
||||||
use Filament\Resources\Pages\ListRecords;
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
class ListMenus extends ListRecords
|
class ListMenus extends ListRecords
|
||||||
|
|||||||
@@ -2,48 +2,39 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources;
|
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\CreatePage;
|
||||||
use App\Filament\Resources\PageResource\Pages\EditPage;
|
use App\Filament\Resources\PageResource\Pages\EditPage;
|
||||||
use App\Filament\Resources\PageResource\Pages;
|
use App\Filament\Resources\PageResource\Pages\ListPages;
|
||||||
use App\Filament\Resources\PageResource\RelationManagers;
|
|
||||||
use App\Models\Page;
|
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\FileUpload;
|
||||||
use Filament\Forms\Components\KeyValue;
|
use Filament\Forms\Components\KeyValue;
|
||||||
use Filament\Forms\Components\Repeater;
|
|
||||||
use Filament\Forms\Components\RichEditor;
|
use Filament\Forms\Components\RichEditor;
|
||||||
use Filament\Forms\Components\Select;
|
use Filament\Forms\Components\Select;
|
||||||
use Filament\Forms\Components\Textarea;
|
use Filament\Forms\Components\Textarea;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Forms\Components\Toggle;
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
use Filament\Resources\Resource;
|
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\IconColumn;
|
||||||
use Filament\Tables\Columns\TextColumn;
|
use Filament\Tables\Columns\TextColumn;
|
||||||
|
use Filament\Tables\Filters\SelectFilter;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Support\Str;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
||||||
use Symfony\Contracts\Service\Attribute\Required;
|
|
||||||
|
|
||||||
class PageResource extends Resource
|
class PageResource extends Resource
|
||||||
{
|
{
|
||||||
protected static ?string $model = Page::class;
|
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
|
public static function form(Schema $schema): Schema
|
||||||
{
|
{
|
||||||
@@ -64,7 +55,7 @@ class PageResource extends Resource
|
|||||||
Select::make('is_published')
|
Select::make('is_published')
|
||||||
->options([
|
->options([
|
||||||
0 => 'Draft',
|
0 => 'Draft',
|
||||||
1 => 'Published'
|
1 => 'Published',
|
||||||
])
|
])
|
||||||
->default(1)
|
->default(1)
|
||||||
->required()
|
->required()
|
||||||
@@ -94,8 +85,6 @@ class PageResource extends Resource
|
|||||||
Textarea::make('custom_header')->rows(6)->label('Custom Header (Optional)'),
|
Textarea::make('custom_header')->rows(6)->label('Custom Header (Optional)'),
|
||||||
]),
|
]),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +115,7 @@ class PageResource extends Resource
|
|||||||
->label('Toggle Published')
|
->label('Toggle Published')
|
||||||
->icon('heroicon-o-eye')
|
->icon('heroicon-o-eye')
|
||||||
->action(function (Page $record) {
|
->action(function (Page $record) {
|
||||||
$record->update(['is_published' => !$record->is_published]);
|
$record->update(['is_published' => ! $record->is_published]);
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
->toolbarActions([
|
->toolbarActions([
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace App\Filament\Resources\PageResource\Pages;
|
namespace App\Filament\Resources\PageResource\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\PageResource;
|
use App\Filament\Resources\PageResource;
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources\PageResource\Pages;
|
namespace App\Filament\Resources\PageResource\Pages;
|
||||||
|
|
||||||
use Filament\Actions\DeleteAction;
|
|
||||||
use App\Filament\Resources\PageResource;
|
use App\Filament\Resources\PageResource;
|
||||||
use Filament\Actions;
|
use Filament\Actions\DeleteAction;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Resources\Pages\EditRecord;
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
@@ -18,6 +17,7 @@ class EditPage extends EditRecord
|
|||||||
DeleteAction::make(),
|
DeleteAction::make(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getRedirectUrl(): ?string
|
protected function getRedirectUrl(): ?string
|
||||||
{
|
{
|
||||||
return $this->getResource()::getUrl('index');
|
return $this->getResource()::getUrl('index');
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources\PageResource\Pages;
|
namespace App\Filament\Resources\PageResource\Pages;
|
||||||
|
|
||||||
use Filament\Actions\CreateAction;
|
|
||||||
use App\Filament\Resources\PageResource;
|
use App\Filament\Resources\PageResource;
|
||||||
use Filament\Actions;
|
use Filament\Actions\CreateAction;
|
||||||
use Filament\Resources\Pages\ListRecords;
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
class ListPages extends ListRecords
|
class ListPages extends ListRecords
|
||||||
|
|||||||
@@ -2,45 +2,33 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources;
|
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\CreatePlan;
|
||||||
use App\Filament\Resources\PlanResource\Pages\EditPlan;
|
use App\Filament\Resources\PlanResource\Pages\EditPlan;
|
||||||
use App\Filament\Resources\PlanResource\Pages;
|
use App\Filament\Resources\PlanResource\Pages\ListPlans;
|
||||||
use App\Filament\Resources\PlanResource\RelationManagers;
|
|
||||||
use App\Models\Plan;
|
use App\Models\Plan;
|
||||||
use Filament\Forms;
|
use Filament\Actions\BulkActionGroup;
|
||||||
use Filament\Forms\Components\FileUpload;
|
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\KeyValue;
|
||||||
use Filament\Forms\Components\RichEditor;
|
|
||||||
use Filament\Forms\Components\Select;
|
use Filament\Forms\Components\Select;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Forms\Set;
|
|
||||||
use Filament\Resources\Resource;
|
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\BooleanColumn;
|
||||||
use Filament\Tables\Columns\TextColumn;
|
use Filament\Tables\Columns\TextColumn;
|
||||||
|
use Filament\Tables\Filters\SelectFilter;
|
||||||
use Filament\Tables\Table;
|
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
|
class PlanResource extends Resource
|
||||||
{
|
{
|
||||||
protected static ?string $model = Plan::class;
|
protected static ?string $model = Plan::class;
|
||||||
|
|
||||||
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-rectangle-stack';
|
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||||
|
|
||||||
protected static string | \UnitEnum | null $navigationGroup = 'Web Master';
|
|
||||||
|
|
||||||
|
protected static string|\UnitEnum|null $navigationGroup = 'Web Master';
|
||||||
|
|
||||||
public static function form(Schema $schema): Schema
|
public static function form(Schema $schema): Schema
|
||||||
{
|
{
|
||||||
@@ -114,6 +102,7 @@ class PlanResource extends Resource
|
|||||||
return $query->where('accept_oxapay', true);
|
return $query->where('accept_oxapay', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace App\Filament\Resources\PlanResource\Pages;
|
namespace App\Filament\Resources\PlanResource\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\PlanResource;
|
use App\Filament\Resources\PlanResource;
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources\PlanResource\Pages;
|
namespace App\Filament\Resources\PlanResource\Pages;
|
||||||
|
|
||||||
use Filament\Actions\DeleteAction;
|
|
||||||
use App\Filament\Resources\PlanResource;
|
use App\Filament\Resources\PlanResource;
|
||||||
use Filament\Actions;
|
use Filament\Actions\DeleteAction;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Resources\Pages\EditRecord;
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
@@ -18,6 +17,7 @@ class EditPlan extends EditRecord
|
|||||||
DeleteAction::make(),
|
DeleteAction::make(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getRedirectUrl(): ?string
|
protected function getRedirectUrl(): ?string
|
||||||
{
|
{
|
||||||
return $this->getResource()::getUrl('index');
|
return $this->getResource()::getUrl('index');
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources\PlanResource\Pages;
|
namespace App\Filament\Resources\PlanResource\Pages;
|
||||||
|
|
||||||
use Filament\Actions\CreateAction;
|
|
||||||
use App\Filament\Resources\PlanResource;
|
use App\Filament\Resources\PlanResource;
|
||||||
use Filament\Actions;
|
use Filament\Actions\CreateAction;
|
||||||
use Filament\Resources\Pages\ListRecords;
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
class ListPlans extends ListRecords
|
class ListPlans extends ListRecords
|
||||||
|
|||||||
@@ -2,50 +2,44 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources;
|
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\CreateTicket;
|
||||||
use App\Filament\Resources\TicketResource\Pages\EditTicket;
|
use App\Filament\Resources\TicketResource\Pages\EditTicket;
|
||||||
use App\Filament\Resources\TicketResource\Pages;
|
use App\Filament\Resources\TicketResource\Pages\ListTickets;
|
||||||
use App\Filament\Resources\TicketResource\RelationManagers;
|
use App\Filament\Resources\TicketResource\RelationManagers\ResponsesRelationManager;
|
||||||
|
use App\Mail\TicketResponseNotification;
|
||||||
use App\Models\Ticket;
|
use App\Models\Ticket;
|
||||||
use App\Models\TicketResponse;
|
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\DatePicker;
|
||||||
use Filament\Forms\Components\Repeater;
|
|
||||||
use Filament\Forms\Components\Select;
|
use Filament\Forms\Components\Select;
|
||||||
use Filament\Forms\Components\Textarea;
|
use Filament\Forms\Components\Textarea;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
|
use Filament\Schemas\Schema;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
use Filament\Tables\Columns\BadgeColumn;
|
use Filament\Tables\Columns\BadgeColumn;
|
||||||
use Filament\Tables\Columns\TextColumn;
|
use Filament\Tables\Columns\TextColumn;
|
||||||
use Filament\Tables\Filters\Filter;
|
use Filament\Tables\Filters\Filter;
|
||||||
use Filament\Tables\Filters\SelectFilter;
|
use Filament\Tables\Filters\SelectFilter;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
use Illuminate\Support\Facades\Mail;
|
||||||
use Illuminate\Support\HtmlString;
|
use Illuminate\Support\HtmlString;
|
||||||
|
|
||||||
class TicketResource extends Resource
|
class TicketResource extends Resource
|
||||||
{
|
{
|
||||||
|
|
||||||
protected static ?string $model = Ticket::class;
|
protected static ?string $model = Ticket::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 = 'Support';
|
|
||||||
|
protected static string|\UnitEnum|null $navigationGroup = 'Support';
|
||||||
|
|
||||||
public static function form(Schema $schema): Schema
|
public static function form(Schema $schema): Schema
|
||||||
{
|
{
|
||||||
@@ -165,8 +159,8 @@ class TicketResource extends Resource
|
|||||||
|
|
||||||
// Ticket Subject & Message
|
// Ticket Subject & Message
|
||||||
$html .= '<div class="bg-gray-100 dark:bg-gray-900 border p-2 rounded-md">';
|
$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 .= '<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 .= '<p class="mt-1 text-gray-700 dark:text-gray-300">Message: '.nl2br(e($ticket->message)).'</p>';
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
|
|
||||||
// Responses Section
|
// Responses Section
|
||||||
@@ -175,10 +169,10 @@ class TicketResource extends Resource
|
|||||||
foreach ($ticket->responses as $response) {
|
foreach ($ticket->responses as $response) {
|
||||||
$html .= '<div class="rounded-md border p-2 bg-gray-50 dark:bg-gray-800">';
|
$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 .= '<div class="text-xs text-gray-600 dark:text-gray-300">';
|
||||||
$html .= '<strong>' . e($response->user->name) . '</strong>';
|
$html .= '<strong>'.e($response->user->name).'</strong>';
|
||||||
$html .= '<span class="ml-2 text-[11px] text-gray-500">' . e($response->created_at->diffForHumans()) . '</span>';
|
$html .= '<span class="ml-2 text-[11px] text-gray-500">'.e($response->created_at->diffForHumans()).'</span>';
|
||||||
$html .= '</div>';
|
$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>';
|
$html .= '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace App\Filament\Resources\TicketResource\Pages;
|
namespace App\Filament\Resources\TicketResource\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\TicketResource;
|
use App\Filament\Resources\TicketResource;
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
class CreateTicket extends CreateRecord
|
class CreateTicket extends CreateRecord
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources\TicketResource\Pages;
|
namespace App\Filament\Resources\TicketResource\Pages;
|
||||||
|
|
||||||
use Filament\Actions\DeleteAction;
|
|
||||||
use App\Filament\Resources\TicketResource;
|
use App\Filament\Resources\TicketResource;
|
||||||
use Filament\Actions;
|
use Filament\Actions\DeleteAction;
|
||||||
use Filament\Resources\Pages\EditRecord;
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
class EditTicket extends EditRecord
|
class EditTicket extends EditRecord
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources\TicketResource\Pages;
|
namespace App\Filament\Resources\TicketResource\Pages;
|
||||||
|
|
||||||
use Filament\Actions\CreateAction;
|
|
||||||
use App\Filament\Resources\TicketResource;
|
use App\Filament\Resources\TicketResource;
|
||||||
use Filament\Actions;
|
use Filament\Actions\CreateAction;
|
||||||
use Filament\Resources\Pages\ListRecords;
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
class ListTickets extends ListRecords
|
class ListTickets extends ListRecords
|
||||||
|
|||||||
@@ -2,22 +2,17 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources\TicketResource\RelationManagers;
|
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\BulkActionGroup;
|
||||||
|
use Filament\Actions\CreateAction;
|
||||||
|
use Filament\Actions\DeleteAction;
|
||||||
use Filament\Actions\DeleteBulkAction;
|
use Filament\Actions\DeleteBulkAction;
|
||||||
use Filament\Forms;
|
use Filament\Actions\EditAction;
|
||||||
use Filament\Forms\Components\Select;
|
use Filament\Forms\Components\Select;
|
||||||
use Filament\Forms\Components\Textarea;
|
use Filament\Forms\Components\Textarea;
|
||||||
use Filament\Forms\Components\TextInput;
|
|
||||||
use Filament\Resources\RelationManagers\RelationManager;
|
use Filament\Resources\RelationManagers\RelationManager;
|
||||||
use Filament\Tables;
|
use Filament\Schemas\Schema;
|
||||||
use Filament\Tables\Columns\TextColumn;
|
use Filament\Tables\Columns\TextColumn;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
||||||
|
|
||||||
class ResponsesRelationManager extends RelationManager
|
class ResponsesRelationManager extends RelationManager
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,45 +2,38 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources;
|
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\CreateUser;
|
||||||
use App\Filament\Resources\UserResource\Pages\EditUser;
|
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\LogsRelationManager;
|
||||||
use App\Filament\Resources\UserResource\RelationManagers\UsageLogsRelationManager;
|
use App\Filament\Resources\UserResource\RelationManagers\UsageLogsRelationManager;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use DB;
|
use DB;
|
||||||
use Filament\Actions\Action;
|
use Exception;
|
||||||
use Filament\Forms;
|
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\DatePicker;
|
||||||
use Filament\Forms\Components\Select;
|
use Filament\Forms\Components\Select;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Tables;
|
use Filament\Schemas\Schema;
|
||||||
use Filament\Tables\Columns\BadgeColumn;
|
use Filament\Tables\Columns\BadgeColumn;
|
||||||
use Filament\Tables\Columns\IconColumn;
|
use Filament\Tables\Columns\IconColumn;
|
||||||
use Filament\Tables\Columns\TextColumn;
|
use Filament\Tables\Columns\TextColumn;
|
||||||
use Filament\Tables\Filters\SelectFilter;
|
use Filament\Tables\Filters\SelectFilter;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
||||||
use Illuminate\Support\Facades\Response;
|
|
||||||
|
|
||||||
class UserResource extends Resource
|
class UserResource extends Resource
|
||||||
{
|
{
|
||||||
protected static ?string $model = User::class;
|
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
|
public static function form(Schema $schema): Schema
|
||||||
{
|
{
|
||||||
@@ -58,7 +51,7 @@ class UserResource extends Resource
|
|||||||
->label('Email Verification Status')
|
->label('Email Verification Status')
|
||||||
->disabled()
|
->disabled()
|
||||||
->formatStateUsing(fn ($record) => $record->email_verified_at ?? ''
|
->formatStateUsing(fn ($record) => $record->email_verified_at ?? ''
|
||||||
? 'Verified at ' . $record->email_verified_at->toDateTimeString()
|
? 'Verified at '.$record->email_verified_at->toDateTimeString()
|
||||||
: 'Not Verified')
|
: 'Not Verified')
|
||||||
->helperText('Shows whether the user has verified their email address.'),
|
->helperText('Shows whether the user has verified their email address.'),
|
||||||
TextInput::make('stripe_id')
|
TextInput::make('stripe_id')
|
||||||
@@ -103,7 +96,7 @@ class UserResource extends Resource
|
|||||||
->falseIcon('heroicon-o-x-circle')
|
->falseIcon('heroicon-o-x-circle')
|
||||||
->trueColor('success')
|
->trueColor('success')
|
||||||
->falseColor('danger')
|
->falseColor('danger')
|
||||||
->getStateUsing(fn ($record) => !is_null($record->email_verified_at))
|
->getStateUsing(fn ($record) => ! is_null($record->email_verified_at))
|
||||||
->sortable(),
|
->sortable(),
|
||||||
BadgeColumn::make('level')
|
BadgeColumn::make('level')
|
||||||
->label('User Level')
|
->label('User Level')
|
||||||
@@ -179,7 +172,6 @@ class UserResource extends Resource
|
|||||||
->whereIn('id', $records->pluck('id'))
|
->whereIn('id', $records->pluck('id'))
|
||||||
->update(['level' => $newLevel]);
|
->update(['level' => $newLevel]);
|
||||||
|
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('User Level Updated')
|
->title('User Level Updated')
|
||||||
->body('The selected users\' levels have been updated successfully.')
|
->body('The selected users\' levels have been updated successfully.')
|
||||||
@@ -219,6 +211,4 @@ class UserResource extends Resource
|
|||||||
'edit' => EditUser::route('/{record}/edit'),
|
'edit' => EditUser::route('/{record}/edit'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace App\Filament\Resources\UserResource\Pages;
|
namespace App\Filament\Resources\UserResource\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\UserResource;
|
use App\Filament\Resources\UserResource;
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
class CreateUser extends CreateRecord
|
class CreateUser extends CreateRecord
|
||||||
|
|||||||
@@ -2,11 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources\UserResource\Pages;
|
namespace App\Filament\Resources\UserResource\Pages;
|
||||||
|
|
||||||
use Filament\Actions\DeleteAction;
|
|
||||||
use App\Filament\Resources\UserResource;
|
use App\Filament\Resources\UserResource;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Filament\Actions;
|
|
||||||
use Filament\Actions\Action;
|
use Filament\Actions\Action;
|
||||||
|
use Filament\Actions\DeleteAction;
|
||||||
use Filament\Resources\Pages\EditRecord;
|
use Filament\Resources\Pages\EditRecord;
|
||||||
use Illuminate\Support\Facades\Response;
|
use Illuminate\Support\Facades\Response;
|
||||||
|
|
||||||
@@ -79,7 +78,7 @@ class EditUser extends EditRecord
|
|||||||
function () use ($csvContent) {
|
function () use ($csvContent) {
|
||||||
echo $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']
|
['Content-Type' => 'text/csv']
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources\UserResource\Pages;
|
namespace App\Filament\Resources\UserResource\Pages;
|
||||||
|
|
||||||
use Filament\Actions\CreateAction;
|
|
||||||
use App\Filament\Resources\UserResource;
|
use App\Filament\Resources\UserResource;
|
||||||
use Filament\Actions;
|
use Filament\Actions\CreateAction;
|
||||||
use Filament\Resources\Pages\ListRecords;
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
class ListUsers extends ListRecords
|
class ListUsers extends ListRecords
|
||||||
|
|||||||
@@ -2,19 +2,16 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources\UserResource\RelationManagers;
|
namespace App\Filament\Resources\UserResource\RelationManagers;
|
||||||
|
|
||||||
use Filament\Tables\Columns\TextColumn;
|
|
||||||
use Filament\Actions\BulkActionGroup;
|
use Filament\Actions\BulkActionGroup;
|
||||||
use Filament\Forms;
|
|
||||||
use Filament\Forms\Form;
|
|
||||||
use Filament\Resources\RelationManagers\RelationManager;
|
use Filament\Resources\RelationManagers\RelationManager;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
|
use Filament\Tables\Columns\TextColumn;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
||||||
|
|
||||||
class LogsRelationManager extends RelationManager
|
class LogsRelationManager extends RelationManager
|
||||||
{
|
{
|
||||||
protected static string $relationship = 'logs';
|
protected static string $relationship = 'logs';
|
||||||
|
|
||||||
protected static ?string $title = 'General Logs';
|
protected static ?string $title = 'General Logs';
|
||||||
|
|
||||||
public function table(Table $table): Table
|
public function table(Table $table): Table
|
||||||
@@ -37,15 +34,15 @@ class LogsRelationManager extends RelationManager
|
|||||||
//
|
//
|
||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
//Tables\Actions\CreateAction::make(),
|
// Tables\Actions\CreateAction::make(),
|
||||||
])
|
])
|
||||||
->recordActions([
|
->recordActions([
|
||||||
//Tables\Actions\EditAction::make(),
|
// Tables\Actions\EditAction::make(),
|
||||||
//Tables\Actions\DeleteAction::make(),
|
// Tables\Actions\DeleteAction::make(),
|
||||||
])
|
])
|
||||||
->toolbarActions([
|
->toolbarActions([
|
||||||
BulkActionGroup::make([
|
BulkActionGroup::make([
|
||||||
//Tables\Actions\DeleteBulkAction::make(),
|
// Tables\Actions\DeleteBulkAction::make(),
|
||||||
]),
|
]),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,15 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources\UserResource\RelationManagers;
|
namespace App\Filament\Resources\UserResource\RelationManagers;
|
||||||
|
|
||||||
use Filament\Tables\Columns\TextColumn;
|
|
||||||
use Filament\Actions\BulkActionGroup;
|
use Filament\Actions\BulkActionGroup;
|
||||||
use Filament\Forms;
|
|
||||||
use Filament\Forms\Form;
|
|
||||||
use Filament\Resources\RelationManagers\RelationManager;
|
use Filament\Resources\RelationManagers\RelationManager;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
|
use Filament\Tables\Columns\TextColumn;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
||||||
|
|
||||||
class UsageLogsRelationManager extends RelationManager
|
class UsageLogsRelationManager extends RelationManager
|
||||||
{
|
{
|
||||||
@@ -42,15 +38,15 @@ class UsageLogsRelationManager extends RelationManager
|
|||||||
//
|
//
|
||||||
])
|
])
|
||||||
->headerActions([
|
->headerActions([
|
||||||
//Tables\Actions\CreateAction::make(),
|
// Tables\Actions\CreateAction::make(),
|
||||||
])
|
])
|
||||||
->recordActions([
|
->recordActions([
|
||||||
//Tables\Actions\EditAction::make(),
|
// Tables\Actions\EditAction::make(),
|
||||||
//Tables\Actions\DeleteAction::make(),
|
// Tables\Actions\DeleteAction::make(),
|
||||||
])
|
])
|
||||||
->toolbarActions([
|
->toolbarActions([
|
||||||
BulkActionGroup::make([
|
BulkActionGroup::make([
|
||||||
//Tables\Actions\DeleteBulkAction::make(),
|
// Tables\Actions\DeleteBulkAction::make(),
|
||||||
]),
|
]),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ class StatsOverview extends BaseWidget
|
|||||||
if ($today == $yesterday) {
|
if ($today == $yesterday) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $today > $yesterday ? 'heroicon-o-arrow-up' : 'heroicon-o-arrow-down';
|
return $today > $yesterday ? 'heroicon-o-arrow-up' : 'heroicon-o-arrow-down';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,6 +88,7 @@ class StatsOverview extends BaseWidget
|
|||||||
if ($today == $yesterday) {
|
if ($today == $yesterday) {
|
||||||
return 'gray';
|
return 'gray';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $today > $yesterday ? 'success' : 'danger';
|
return $today > $yesterday ? 'success' : 'danger';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,6 +97,7 @@ class StatsOverview extends BaseWidget
|
|||||||
if ($period === 'yesterday') {
|
if ($period === 'yesterday') {
|
||||||
return User::where('created_at', '<', Carbon::today('UTC')->startOfDay())->count();
|
return User::where('created_at', '<', Carbon::today('UTC')->startOfDay())->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
return User::count();
|
return User::count();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,6 +114,7 @@ class StatsOverview extends BaseWidget
|
|||||||
if ($period === 'yesterday') {
|
if ($period === 'yesterday') {
|
||||||
return Log::where('created_at', '<', Carbon::today('UTC')->startOfDay())->count();
|
return Log::where('created_at', '<', Carbon::today('UTC')->startOfDay())->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Log::count();
|
return Log::count();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,6 +135,7 @@ class StatsOverview extends BaseWidget
|
|||||||
->where('created_at', '<', Carbon::today('UTC')->startOfDay())
|
->where('created_at', '<', Carbon::today('UTC')->startOfDay())
|
||||||
->count();
|
->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
return User::whereNotNull('stripe_id')->count();
|
return User::whereNotNull('stripe_id')->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,6 +144,7 @@ class StatsOverview extends BaseWidget
|
|||||||
if ($period === 'yesterday') {
|
if ($period === 'yesterday') {
|
||||||
return PremiumEmail::where('created_at', '<', Carbon::today('UTC')->startOfDay())->count();
|
return PremiumEmail::where('created_at', '<', Carbon::today('UTC')->startOfDay())->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
return PremiumEmail::count();
|
return PremiumEmail::count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ namespace App\Http\Controllers;
|
|||||||
|
|
||||||
use App\Models\Premium;
|
use App\Models\Premium;
|
||||||
use App\Models\ZEmail;
|
use App\Models\ZEmail;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Session;
|
use Session;
|
||||||
|
|
||||||
class AppController extends Controller
|
class AppController extends Controller
|
||||||
{
|
{
|
||||||
public function mailbox($email = null) {
|
public function mailbox($email = null)
|
||||||
|
{
|
||||||
if ($email) {
|
if ($email) {
|
||||||
$validatedData = validator(['email' => $email], [
|
$validatedData = validator(['email' => $email], [
|
||||||
'email' => 'required|email',
|
'email' => 'required|email',
|
||||||
@@ -18,39 +18,48 @@ class AppController extends Controller
|
|||||||
if (json_decode(config('app.settings.configuration_settings'))->enable_create_from_url) {
|
if (json_decode(config('app.settings.configuration_settings'))->enable_create_from_url) {
|
||||||
ZEmail::createCustomEmailFull($email);
|
ZEmail::createCustomEmailFull($email);
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->route('mailbox');
|
return redirect()->route('mailbox');
|
||||||
}
|
}
|
||||||
if (!ZEmail::getEmail()) {
|
if (! ZEmail::getEmail()) {
|
||||||
return redirect()->route('home');
|
return redirect()->route('home');
|
||||||
}
|
}
|
||||||
if (json_decode(config('app.settings.configuration_settings'))->disable_mailbox_slug) {
|
if (json_decode(config('app.settings.configuration_settings'))->disable_mailbox_slug) {
|
||||||
return redirect()->route('home');
|
return redirect()->route('home');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->app();
|
return $this->app();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function app() {
|
public function app()
|
||||||
|
{
|
||||||
return redirect()->route('home');
|
return redirect()->route('home');
|
||||||
}
|
}
|
||||||
public function switch($email) {
|
|
||||||
|
public function switch($email)
|
||||||
|
{
|
||||||
ZEmail::setEmail($email);
|
ZEmail::setEmail($email);
|
||||||
if (json_decode(config('app.settings.configuration_settings'))->disable_mailbox_slug) {
|
if (json_decode(config('app.settings.configuration_settings'))->disable_mailbox_slug) {
|
||||||
return redirect()->route('home');
|
return redirect()->route('home');
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->route('mailbox');
|
return redirect()->route('mailbox');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete($email = null) {
|
public function delete($email = null)
|
||||||
|
{
|
||||||
if ($email) {
|
if ($email) {
|
||||||
$emails = ZEmail::getEmails();
|
$emails = ZEmail::getEmails();
|
||||||
ZEmail::removeEmail($email);
|
ZEmail::removeEmail($email);
|
||||||
|
|
||||||
return redirect()->route('mailbox');
|
return redirect()->route('mailbox');
|
||||||
} else {
|
} else {
|
||||||
return redirect()->route('home');
|
return redirect()->route('home');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function switchP($email) {
|
public function switchP($email)
|
||||||
|
{
|
||||||
if (Session::get('isInboxTypePremium')) {
|
if (Session::get('isInboxTypePremium')) {
|
||||||
Premium::setEmailP($email);
|
Premium::setEmailP($email);
|
||||||
} else {
|
} else {
|
||||||
@@ -59,10 +68,12 @@ class AppController extends Controller
|
|||||||
if (json_decode(config('app.settings.configuration_settings'))->disable_mailbox_slug) {
|
if (json_decode(config('app.settings.configuration_settings'))->disable_mailbox_slug) {
|
||||||
return redirect()->route('dashboard');
|
return redirect()->route('dashboard');
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->route('dashboard.premium');
|
return redirect()->route('dashboard.premium');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteP($email = null) {
|
public function deleteP($email = null)
|
||||||
|
{
|
||||||
if ($email) {
|
if ($email) {
|
||||||
if (Session::get('isInboxTypePremium')) {
|
if (Session::get('isInboxTypePremium')) {
|
||||||
$emails = Premium::getEmails();
|
$emails = Premium::getEmails();
|
||||||
@@ -71,43 +82,50 @@ class AppController extends Controller
|
|||||||
$emails = ZEmail::getEmails();
|
$emails = ZEmail::getEmails();
|
||||||
ZEmail::removeEmail($email);
|
ZEmail::removeEmail($email);
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->route('dashboard.premium');
|
return redirect()->route('dashboard.premium');
|
||||||
} else {
|
} else {
|
||||||
return redirect()->route('dashboard');
|
return redirect()->route('dashboard');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function locale($locale) {
|
public function locale($locale)
|
||||||
|
{
|
||||||
if (in_array($locale, config('app.locales'))) {
|
if (in_array($locale, config('app.locales'))) {
|
||||||
session(['locale' => $locale]);
|
session(['locale' => $locale]);
|
||||||
|
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
abort(400);
|
abort(400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getStringBetween($string, $start, $end)
|
||||||
private function getStringBetween($string, $start, $end) {
|
{
|
||||||
$string = ' ' . $string;
|
$string = ' '.$string;
|
||||||
$ini = strpos($string, $start);
|
$ini = strpos($string, $start);
|
||||||
if ($ini == 0) return '';
|
if ($ini == 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
$ini += strlen($start);
|
$ini += strlen($start);
|
||||||
$len = strpos($string, $end, $ini) - $ini;
|
$len = strpos($string, $end, $ini) - $ini;
|
||||||
|
|
||||||
return substr($string, $ini, $len);
|
return substr($string, $ini, $len);
|
||||||
}
|
}
|
||||||
private function setHeaders($page) {
|
|
||||||
|
private function setHeaders($page)
|
||||||
|
{
|
||||||
$header = $page->header;
|
$header = $page->header;
|
||||||
foreach ($page->meta ? unserialize($page->meta) : [] as $meta) {
|
foreach ($page->meta ? unserialize($page->meta) : [] as $meta) {
|
||||||
if ($meta['name'] == 'canonical') {
|
if ($meta['name'] == 'canonical') {
|
||||||
$header .= '<link rel="canonical" href="' . $meta['content'] . '" />';
|
$header .= '<link rel="canonical" href="'.$meta['content'].'" />';
|
||||||
} else if (str_contains($meta['name'], 'og:')) {
|
} elseif (str_contains($meta['name'], 'og:')) {
|
||||||
$header .= '<meta property="' . $meta['name'] . '" content="' . $meta['content'] . '" />';
|
$header .= '<meta property="'.$meta['name'].'" content="'.$meta['content'].'" />';
|
||||||
} else {
|
} else {
|
||||||
$header .= '<meta name="' . $meta['name'] . '" content="' . $meta['content'] . '" />';
|
$header .= '<meta name="'.$meta['name'].'" content="'.$meta['content'].'" />';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$page->header = $header;
|
$page->header = $header;
|
||||||
|
|
||||||
return $page;
|
return $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Auth;
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Auth\Events\Verified;
|
use Illuminate\Auth\Events\Verified;
|
||||||
|
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
use Illuminate\Foundation\Auth\EmailVerificationRequest;
|
use Illuminate\Foundation\Auth\EmailVerificationRequest;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
|
||||||
|
|||||||
@@ -2,15 +2,16 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Log;
|
|
||||||
use Exception;
|
|
||||||
use App\NotifyMe;
|
use App\NotifyMe;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Exception;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Log;
|
||||||
|
|
||||||
class WebhookController extends Controller
|
class WebhookController extends Controller
|
||||||
{
|
{
|
||||||
use NotifyMe;
|
use NotifyMe;
|
||||||
|
|
||||||
public function oxapay(Request $request)
|
public function oxapay(Request $request)
|
||||||
{
|
{
|
||||||
// Get the request data
|
// Get the request data
|
||||||
@@ -18,8 +19,9 @@ class WebhookController extends Controller
|
|||||||
$data = json_decode($postData, true);
|
$data = json_decode($postData, true);
|
||||||
|
|
||||||
// Validate request data
|
// 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]);
|
Log::warning('Invalid Oxapay webhook data', ['data' => $data]);
|
||||||
|
|
||||||
return response('Invalid data.type', 400);
|
return response('Invalid data.type', 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,11 +55,11 @@ class WebhookController extends Controller
|
|||||||
'date' => $date,
|
'date' => $date,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$message = "✅ Oxapay Invoice Payment Success\n" .
|
$message = "✅ Oxapay Invoice Payment Success\n".
|
||||||
"Track ID: {$trackId}\n" .
|
"Track ID: {$trackId}\n".
|
||||||
"Email: {$email}\n" .
|
"Email: {$email}\n".
|
||||||
"Amount: {$amount} {$currency}\n" .
|
"Amount: {$amount} {$currency}\n".
|
||||||
"Order ID: {$orderId}\n" .
|
"Order ID: {$orderId}\n".
|
||||||
"Time: {$date}";
|
"Time: {$date}";
|
||||||
self::sendTelegramNotification($message);
|
self::sendTelegramNotification($message);
|
||||||
} elseif ($data['type'] === 'payout') {
|
} elseif ($data['type'] === 'payout') {
|
||||||
@@ -83,13 +85,13 @@ class WebhookController extends Controller
|
|||||||
'date' => $date,
|
'date' => $date,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$message = "📤 Oxapay Payout Confirmed\n" .
|
$message = "📤 Oxapay Payout Confirmed\n".
|
||||||
"Track ID: {$trackId}\n" .
|
"Track ID: {$trackId}\n".
|
||||||
"Amount: {$amount} {$currency}\n" .
|
"Amount: {$amount} {$currency}\n".
|
||||||
"Network: {$network}\n" .
|
"Network: {$network}\n".
|
||||||
"Address: {$address}\n" .
|
"Address: {$address}\n".
|
||||||
"Transaction Hash: {$txHash}\n" .
|
"Transaction Hash: {$txHash}\n".
|
||||||
"Description: {$description}\n" .
|
"Description: {$description}\n".
|
||||||
"Date: {$date}";
|
"Date: {$date}";
|
||||||
self::sendTelegramNotification($message);
|
self::sendTelegramNotification($message);
|
||||||
}
|
}
|
||||||
@@ -100,13 +102,15 @@ class WebhookController extends Controller
|
|||||||
self::sendTelegramNotification("
|
self::sendTelegramNotification("
|
||||||
Failed to process Oxapay webhook\n
|
Failed to process Oxapay webhook\n
|
||||||
Type: {$data['type']}\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()}
|
Error: {$e->getMessage()}
|
||||||
");
|
");
|
||||||
|
|
||||||
return response('Processing error', 400);
|
return response('Processing error', 400);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log::warning('Invalid Oxapay HMAC signature', ['hmac_header' => $hmacHeader, 'calculated_hmac' => $calculatedHmac]);
|
Log::warning('Invalid Oxapay HMAC signature', ['hmac_header' => $hmacHeader, 'calculated_hmac' => $calculatedHmac]);
|
||||||
|
|
||||||
return response('Invalid HMAC signature', 400);
|
return response('Invalid HMAC signature', 400);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,9 +21,10 @@ class CheckPageSlug
|
|||||||
|
|
||||||
if (file_exists($publicPath) && is_file($publicPath) && pathinfo($slug, PATHINFO_EXTENSION) === 'php') {
|
if (file_exists($publicPath) && is_file($publicPath) && pathinfo($slug, PATHINFO_EXTENSION) === 'php') {
|
||||||
ob_start();
|
ob_start();
|
||||||
include($publicPath);
|
include $publicPath;
|
||||||
$content = ob_get_clean();
|
$content = ob_get_clean();
|
||||||
ob_flush();
|
ob_flush();
|
||||||
|
|
||||||
return response($content);
|
return response($content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ class CheckUserBanned
|
|||||||
// Return the banned page instead of proceeding with the request
|
// Return the banned page instead of proceeding with the request
|
||||||
return response()->view('banned');
|
return response()->view('banned');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Http\Middleware;
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use Closure;
|
use Closure;
|
||||||
|
use Exception;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
@@ -24,6 +24,7 @@ class Locale
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
}
|
}
|
||||||
app()->setLocale(session('locale', session('browser-locale', config('app.settings.language', config('app.locale', 'en')))));
|
app()->setLocale(session('locale', session('browser-locale', config('app.settings.language', config('app.locale', 'en')))));
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,16 +3,13 @@
|
|||||||
namespace App\Listeners;
|
namespace App\Listeners;
|
||||||
|
|
||||||
use App\NotifyMe;
|
use App\NotifyMe;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Laravel\Cashier\Events\WebhookReceived;
|
use Laravel\Cashier\Events\WebhookReceived;
|
||||||
use Livewire\Livewire;
|
|
||||||
|
|
||||||
class StripeEventListener
|
class StripeEventListener
|
||||||
{
|
{
|
||||||
use NotifyMe;
|
use NotifyMe;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the event listener.
|
* Create the event listener.
|
||||||
*/
|
*/
|
||||||
@@ -32,10 +29,10 @@ class StripeEventListener
|
|||||||
$amount = $event->payload['data']['object']['amount_paid'] / 100 ?? 'Unknown'; // Convert cents to dollars
|
$amount = $event->payload['data']['object']['amount_paid'] / 100 ?? 'Unknown'; // Convert cents to dollars
|
||||||
$email = $event->payload['data']['object']['customer_email'] ?? 'Unknown';
|
$email = $event->payload['data']['object']['customer_email'] ?? 'Unknown';
|
||||||
|
|
||||||
$message = "✅ Payment Success\n" .
|
$message = "✅ Payment Success\n".
|
||||||
"Email: {$email}\n" .
|
"Email: {$email}\n".
|
||||||
"Amount: $" . number_format($amount, 2) . "\n" .
|
'Amount: $'.number_format($amount, 2)."\n".
|
||||||
"Time: " . now()->toDateTimeString();
|
'Time: '.now()->toDateTimeString();
|
||||||
self::sendTelegramNotification($message);
|
self::sendTelegramNotification($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,9 +42,9 @@ class StripeEventListener
|
|||||||
|
|
||||||
$email = $event->payload['data']['object']['customer_email'] ?? 'Unknown';
|
$email = $event->payload['data']['object']['customer_email'] ?? 'Unknown';
|
||||||
|
|
||||||
$message = "❌ Subscription Canceled\n" .
|
$message = "❌ Subscription Canceled\n".
|
||||||
"Email: {$email}\n" .
|
"Email: {$email}\n".
|
||||||
"Time: " . now()->toDateTimeString();
|
'Time: '.now()->toDateTimeString();
|
||||||
self::sendTelegramNotification($message);
|
self::sendTelegramNotification($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,17 +4,22 @@ namespace App\Livewire;
|
|||||||
|
|
||||||
use App\Models\ZEmail;
|
use App\Models\ZEmail;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use Request;
|
|
||||||
use Session;
|
use Session;
|
||||||
|
|
||||||
class AddOn extends Component
|
class AddOn extends Component
|
||||||
{
|
{
|
||||||
public $title = "";
|
public $title = '';
|
||||||
public $description = "";
|
|
||||||
public $keywords = "";
|
public $description = '';
|
||||||
public $route = "";
|
|
||||||
|
public $keywords = '';
|
||||||
|
|
||||||
|
public $route = '';
|
||||||
|
|
||||||
public $faqs = [];
|
public $faqs = [];
|
||||||
|
|
||||||
public $faqSchema;
|
public $faqSchema;
|
||||||
|
|
||||||
protected $listeners = ['fetchMessages' => 'checkIfAnyMessage'];
|
protected $listeners = ['fetchMessages' => 'checkIfAnyMessage'];
|
||||||
|
|
||||||
public function checkIfAnyMessage()
|
public function checkIfAnyMessage()
|
||||||
@@ -38,18 +43,18 @@ class AddOn extends Component
|
|||||||
$this->route = $route;
|
$this->route = $route;
|
||||||
$this->faqs = $this->faqs[$route];
|
$this->faqs = $this->faqs[$route];
|
||||||
$this->faqSchema = [
|
$this->faqSchema = [
|
||||||
"@context" => "https://schema.org",
|
'@context' => 'https://schema.org',
|
||||||
"@type" => "FAQPage",
|
'@type' => 'FAQPage',
|
||||||
"mainEntity" => collect($this->faqs)->map(function ($faq) {
|
'mainEntity' => collect($this->faqs)->map(function ($faq) {
|
||||||
return [
|
return [
|
||||||
"@type" => "Question",
|
'@type' => 'Question',
|
||||||
"name" => $faq['title'],
|
'name' => $faq['title'],
|
||||||
"acceptedAnswer" => [
|
'acceptedAnswer' => [
|
||||||
"@type" => "Answer",
|
'@type' => 'Answer',
|
||||||
"text" => $faq['content']
|
'text' => $faq['content'],
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
})->toArray()
|
})->toArray(),
|
||||||
];
|
];
|
||||||
} elseif ($route == 'disposable-gmail') {
|
} elseif ($route == 'disposable-gmail') {
|
||||||
$this->title = 'Disposable Gmail Email | Free Temporary Gmail Inbox Online';
|
$this->title = 'Disposable Gmail Email | Free Temporary Gmail Inbox Online';
|
||||||
@@ -58,18 +63,18 @@ class AddOn extends Component
|
|||||||
$this->route = $route;
|
$this->route = $route;
|
||||||
$this->faqs = $this->faqs[$route];
|
$this->faqs = $this->faqs[$route];
|
||||||
$this->faqSchema = [
|
$this->faqSchema = [
|
||||||
"@context" => "https://schema.org",
|
'@context' => 'https://schema.org',
|
||||||
"@type" => "FAQPage",
|
'@type' => 'FAQPage',
|
||||||
"mainEntity" => collect($this->faqs)->map(function ($faq) {
|
'mainEntity' => collect($this->faqs)->map(function ($faq) {
|
||||||
return [
|
return [
|
||||||
"@type" => "Question",
|
'@type' => 'Question',
|
||||||
"name" => $faq['title'],
|
'name' => $faq['title'],
|
||||||
"acceptedAnswer" => [
|
'acceptedAnswer' => [
|
||||||
"@type" => "Answer",
|
'@type' => 'Answer',
|
||||||
"text" => $faq['content']
|
'text' => $faq['content'],
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
})->toArray()
|
})->toArray(),
|
||||||
];
|
];
|
||||||
|
|
||||||
} elseif ($route == 'disposable-outlook') {
|
} elseif ($route == 'disposable-outlook') {
|
||||||
@@ -79,18 +84,18 @@ class AddOn extends Component
|
|||||||
$this->route = $route;
|
$this->route = $route;
|
||||||
$this->faqs = $this->faqs[$route];
|
$this->faqs = $this->faqs[$route];
|
||||||
$this->faqSchema = [
|
$this->faqSchema = [
|
||||||
"@context" => "https://schema.org",
|
'@context' => 'https://schema.org',
|
||||||
"@type" => "FAQPage",
|
'@type' => 'FAQPage',
|
||||||
"mainEntity" => collect($this->faqs)->map(function ($faq) {
|
'mainEntity' => collect($this->faqs)->map(function ($faq) {
|
||||||
return [
|
return [
|
||||||
"@type" => "Question",
|
'@type' => 'Question',
|
||||||
"name" => $faq['title'],
|
'name' => $faq['title'],
|
||||||
"acceptedAnswer" => [
|
'acceptedAnswer' => [
|
||||||
"@type" => "Answer",
|
'@type' => 'Answer',
|
||||||
"text" => $faq['content']
|
'text' => $faq['content'],
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
})->toArray()
|
})->toArray(),
|
||||||
];
|
];
|
||||||
} elseif ($route == 'disposable-yahoo') {
|
} elseif ($route == 'disposable-yahoo') {
|
||||||
$this->title = 'Disposable Yahoo Mail | Free Temporary Yahoo Inbox';
|
$this->title = 'Disposable Yahoo Mail | Free Temporary Yahoo Inbox';
|
||||||
@@ -99,18 +104,18 @@ class AddOn extends Component
|
|||||||
$this->route = $route;
|
$this->route = $route;
|
||||||
$this->faqs = $this->faqs[$route];
|
$this->faqs = $this->faqs[$route];
|
||||||
$this->faqSchema = [
|
$this->faqSchema = [
|
||||||
"@context" => "https://schema.org",
|
'@context' => 'https://schema.org',
|
||||||
"@type" => "FAQPage",
|
'@type' => 'FAQPage',
|
||||||
"mainEntity" => collect($this->faqs)->map(function ($faq) {
|
'mainEntity' => collect($this->faqs)->map(function ($faq) {
|
||||||
return [
|
return [
|
||||||
"@type" => "Question",
|
'@type' => 'Question',
|
||||||
"name" => $faq['title'],
|
'name' => $faq['title'],
|
||||||
"acceptedAnswer" => [
|
'acceptedAnswer' => [
|
||||||
"@type" => "Answer",
|
'@type' => 'Answer',
|
||||||
"text" => $faq['content']
|
'text' => $faq['content'],
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
})->toArray()
|
})->toArray(),
|
||||||
];
|
];
|
||||||
} elseif ($route == 'gmailnator') {
|
} elseif ($route == 'gmailnator') {
|
||||||
$this->title = 'Gmailnator - Free Temporary Gmail Email Address Generator';
|
$this->title = 'Gmailnator - Free Temporary Gmail Email Address Generator';
|
||||||
@@ -119,18 +124,18 @@ class AddOn extends Component
|
|||||||
$this->route = $route;
|
$this->route = $route;
|
||||||
$this->faqs = $this->faqs[$route];
|
$this->faqs = $this->faqs[$route];
|
||||||
$this->faqSchema = [
|
$this->faqSchema = [
|
||||||
"@context" => "https://schema.org",
|
'@context' => 'https://schema.org',
|
||||||
"@type" => "FAQPage",
|
'@type' => 'FAQPage',
|
||||||
"mainEntity" => collect($this->faqs)->map(function ($faq) {
|
'mainEntity' => collect($this->faqs)->map(function ($faq) {
|
||||||
return [
|
return [
|
||||||
"@type" => "Question",
|
'@type' => 'Question',
|
||||||
"name" => $faq['title'],
|
'name' => $faq['title'],
|
||||||
"acceptedAnswer" => [
|
'acceptedAnswer' => [
|
||||||
"@type" => "Answer",
|
'@type' => 'Answer',
|
||||||
"text" => $faq['content']
|
'text' => $faq['content'],
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
})->toArray()
|
})->toArray(),
|
||||||
];
|
];
|
||||||
} elseif ($route == 'emailnator') {
|
} elseif ($route == 'emailnator') {
|
||||||
$this->title = 'Emailnator - Free Disposable Temporary Email Service';
|
$this->title = 'Emailnator - Free Disposable Temporary Email Service';
|
||||||
@@ -139,18 +144,18 @@ class AddOn extends Component
|
|||||||
$this->route = $route;
|
$this->route = $route;
|
||||||
$this->faqs = $this->faqs[$route];
|
$this->faqs = $this->faqs[$route];
|
||||||
$this->faqSchema = [
|
$this->faqSchema = [
|
||||||
"@context" => "https://schema.org",
|
'@context' => 'https://schema.org',
|
||||||
"@type" => "FAQPage",
|
'@type' => 'FAQPage',
|
||||||
"mainEntity" => collect($this->faqs)->map(function ($faq) {
|
'mainEntity' => collect($this->faqs)->map(function ($faq) {
|
||||||
return [
|
return [
|
||||||
"@type" => "Question",
|
'@type' => 'Question',
|
||||||
"name" => $faq['title'],
|
'name' => $faq['title'],
|
||||||
"acceptedAnswer" => [
|
'acceptedAnswer' => [
|
||||||
"@type" => "Answer",
|
'@type' => 'Answer',
|
||||||
"text" => $faq['content']
|
'text' => $faq['content'],
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
})->toArray()
|
})->toArray(),
|
||||||
];
|
];
|
||||||
} elseif ($route == 'temp-gmail') {
|
} elseif ($route == 'temp-gmail') {
|
||||||
$this->title = 'Temp Gmail | Free Temporary Gmail Inbox for Instant Use';
|
$this->title = 'Temp Gmail | Free Temporary Gmail Inbox for Instant Use';
|
||||||
@@ -159,18 +164,18 @@ class AddOn extends Component
|
|||||||
$this->route = $route;
|
$this->route = $route;
|
||||||
$this->faqs = $this->faqs[$route];
|
$this->faqs = $this->faqs[$route];
|
||||||
$this->faqSchema = [
|
$this->faqSchema = [
|
||||||
"@context" => "https://schema.org",
|
'@context' => 'https://schema.org',
|
||||||
"@type" => "FAQPage",
|
'@type' => 'FAQPage',
|
||||||
"mainEntity" => collect($this->faqs)->map(function ($faq) {
|
'mainEntity' => collect($this->faqs)->map(function ($faq) {
|
||||||
return [
|
return [
|
||||||
"@type" => "Question",
|
'@type' => 'Question',
|
||||||
"name" => $faq['title'],
|
'name' => $faq['title'],
|
||||||
"acceptedAnswer" => [
|
'acceptedAnswer' => [
|
||||||
"@type" => "Answer",
|
'@type' => 'Answer',
|
||||||
"text" => $faq['content']
|
'text' => $faq['content'],
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
})->toArray()
|
})->toArray(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Livewire\Auth;
|
namespace App\Livewire\Auth;
|
||||||
|
|
||||||
use Illuminate\Validation\Rules\Password;
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Auth\Events\Registered;
|
use Illuminate\Auth\Events\Registered;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Illuminate\Validation\Rules;
|
use Illuminate\Validation\Rules\Password;
|
||||||
use Livewire\Attributes\Layout;
|
use Livewire\Attributes\Layout;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,11 @@ use Livewire\Component;
|
|||||||
class Blog extends Component
|
class Blog extends Component
|
||||||
{
|
{
|
||||||
public $postDetail;
|
public $postDetail;
|
||||||
|
|
||||||
public $category;
|
public $category;
|
||||||
|
|
||||||
public function mount($slug) {
|
public function mount($slug)
|
||||||
|
{
|
||||||
$this->postDetail = \App\Models\Blog::where('slug', $slug)->firstOrFail();
|
$this->postDetail = \App\Models\Blog::where('slug', $slug)->firstOrFail();
|
||||||
$this->category = Category::where('id', $this->postDetail->category_id)->first();
|
$this->category = Category::where('id', $this->postDetail->category_id)->first();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,14 +8,17 @@ use Session;
|
|||||||
class Bulk extends Component
|
class Bulk extends Component
|
||||||
{
|
{
|
||||||
public $bulkEmails = [];
|
public $bulkEmails = [];
|
||||||
|
|
||||||
public $bulkCount = 1;
|
public $bulkCount = 1;
|
||||||
|
|
||||||
private $isSubscribed = false;
|
private $isSubscribed = false;
|
||||||
|
|
||||||
public function mount() {
|
public function mount()
|
||||||
|
{
|
||||||
$subscriptionCheck = auth()->user()->subscribedToProduct(config('app.plans')[0]['product_id']);
|
$subscriptionCheck = auth()->user()->subscribedToProduct(config('app.plans')[0]['product_id']);
|
||||||
Session::put('isSubscribed', $subscriptionCheck);
|
Session::put('isSubscribed', $subscriptionCheck);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generateBulk()
|
public function generateBulk()
|
||||||
{
|
{
|
||||||
$this->validate([
|
$this->validate([
|
||||||
@@ -34,11 +37,11 @@ class Bulk extends Component
|
|||||||
public function downloadBulk()
|
public function downloadBulk()
|
||||||
{
|
{
|
||||||
// Ensure there's something to download
|
// Ensure there's something to download
|
||||||
if (empty($this->bulkEmails) || !is_array($this->bulkEmails)) {
|
if (empty($this->bulkEmails) || ! is_array($this->bulkEmails)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$filename = 'bulk_emails_' . now()->format('Ymd_His') . '.txt';
|
$filename = 'bulk_emails_'.now()->format('Ymd_His').'.txt';
|
||||||
$content = implode(PHP_EOL, $this->bulkEmails);
|
$content = implode(PHP_EOL, $this->bulkEmails);
|
||||||
|
|
||||||
return response()->streamDownload(function () use ($content) {
|
return response()->streamDownload(function () use ($content) {
|
||||||
@@ -49,40 +52,42 @@ class Bulk extends Component
|
|||||||
private function randomEmail(): string
|
private function randomEmail(): string
|
||||||
{
|
{
|
||||||
$domain = $this->getRandomDomain();
|
$domain = $this->getRandomDomain();
|
||||||
if ($domain == "gmail.com" || $domain == "googlemail.com") {
|
if ($domain == 'gmail.com' || $domain == 'googlemail.com') {
|
||||||
$uname = $this->getRandomGmailUser();
|
$uname = $this->getRandomGmailUser();
|
||||||
$uname_len = strlen($uname);
|
$uname_len = strlen($uname);
|
||||||
$len_power = $uname_len - 1;
|
$len_power = $uname_len - 1;
|
||||||
$combination = pow(2,$len_power);
|
$combination = pow(2, $len_power);
|
||||||
$rand_comb = mt_rand(1,$combination);
|
$rand_comb = mt_rand(1, $combination);
|
||||||
$formatted = implode(' ',str_split($uname));
|
$formatted = implode(' ', str_split($uname));
|
||||||
$uname_exp = explode(' ', $formatted);
|
$uname_exp = explode(' ', $formatted);
|
||||||
|
|
||||||
$bin = intval("");
|
$bin = intval('');
|
||||||
for($i=0; $i<$len_power; $i++) {
|
for ($i = 0; $i < $len_power; $i++) {
|
||||||
$bin .= mt_rand(0,1);
|
$bin .= mt_rand(0, 1);
|
||||||
}
|
}
|
||||||
$bin = explode(' ', implode(' ',str_split(strval($bin))));
|
$bin = explode(' ', implode(' ', str_split(strval($bin))));
|
||||||
|
|
||||||
$email = "";
|
$email = '';
|
||||||
for($i=0; $i<$len_power; $i++) {
|
for ($i = 0; $i < $len_power; $i++) {
|
||||||
$email .= $uname_exp[$i];
|
$email .= $uname_exp[$i];
|
||||||
if($bin[$i]) {
|
if ($bin[$i]) {
|
||||||
$email .= ".";
|
$email .= '.';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$email .= $uname_exp[$i];
|
$email .= $uname_exp[$i];
|
||||||
$gmail_rand = mt_rand(1,10);
|
$gmail_rand = mt_rand(1, 10);
|
||||||
if($gmail_rand > 5) {
|
if ($gmail_rand > 5) {
|
||||||
$email .= "@gmail.com";
|
$email .= '@gmail.com';
|
||||||
} else {
|
} else {
|
||||||
$email .= "@googlemail.com";
|
$email .= '@googlemail.com';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $email;
|
return $email;
|
||||||
} else {
|
} else {
|
||||||
return $this->generateRandomUsername().'@'.$domain;
|
return $this->generateRandomUsername().'@'.$domain;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function generateRandomUsername(): string
|
private function generateRandomUsername(): string
|
||||||
{
|
{
|
||||||
$start = json_decode(config('app.settings.configuration_settings'))->random_username_length_min ?? 0;
|
$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) {
|
if ($start == 0 && $end == 0) {
|
||||||
return $this->generatePronounceableWord();
|
return $this->generatePronounceableWord();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->generatedRandomBetweenLength($start, $end);
|
return $this->generatedRandomBetweenLength($start, $end);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function generatedRandomBetweenLength($start, $end): string
|
private function generatedRandomBetweenLength($start, $end): string
|
||||||
{
|
{
|
||||||
$length = rand($start, $end);
|
$length = rand($start, $end);
|
||||||
|
|
||||||
return $this->generateRandomString($length);
|
return $this->generateRandomString($length);
|
||||||
}
|
}
|
||||||
private function getRandomDomain() {
|
|
||||||
|
private function getRandomDomain()
|
||||||
|
{
|
||||||
$domains = json_decode(config('app.settings.configuration_settings'))->premium_domains ?? [];
|
$domains = json_decode(config('app.settings.configuration_settings'))->premium_domains ?? [];
|
||||||
$count = count($domains);
|
$count = count($domains);
|
||||||
|
|
||||||
return $count > 0 ? $domains[rand(1, $count) - 1] : '';
|
return $count > 0 ? $domains[rand(1, $count) - 1] : '';
|
||||||
}
|
}
|
||||||
private function getRandomGmailUser() {
|
|
||||||
|
private function getRandomGmailUser()
|
||||||
|
{
|
||||||
$gmailusername = json_decode(config('app.settings.configuration_settings'))->premium_gmailUsernames ?? [];
|
$gmailusername = json_decode(config('app.settings.configuration_settings'))->premium_gmailUsernames ?? [];
|
||||||
$count = count($gmailusername);
|
$count = count($gmailusername);
|
||||||
|
|
||||||
return $count > 0 ? $gmailusername[rand(1, $count) - 1] : '';
|
return $count > 0 ? $gmailusername[rand(1, $count) - 1] : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
private function generatePronounceableWord(): string
|
private function generatePronounceableWord(): string
|
||||||
{
|
{
|
||||||
$c = 'bcdfghjklmnprstvwz'; //consonants except hard to speak ones
|
$c = 'bcdfghjklmnprstvwz'; // consonants except hard to speak ones
|
||||||
$v = 'aeiou'; //vowels
|
$v = 'aeiou'; // vowels
|
||||||
$a = $c . $v; //both
|
$a = $c.$v; // both
|
||||||
$random = '';
|
$random = '';
|
||||||
for ($j = 0; $j < 2; $j++) {
|
for ($j = 0; $j < 2; $j++) {
|
||||||
$random .= $c[rand(0, strlen($c) - 1)];
|
$random .= $c[rand(0, strlen($c) - 1)];
|
||||||
$random .= $v[rand(0, strlen($v) - 1)];
|
$random .= $v[rand(0, strlen($v) - 1)];
|
||||||
$random .= $a[rand(0, strlen($a) - 1)];
|
$random .= $a[rand(0, strlen($a) - 1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $random;
|
return $random;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function generateRandomString($length = 10): string
|
private function generateRandomString($length = 10): string
|
||||||
{
|
{
|
||||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyz';
|
$characters = '0123456789abcdefghijklmnopqrstuvwxyz';
|
||||||
@@ -128,6 +145,7 @@ class Bulk extends Component
|
|||||||
for ($i = 0; $i < $length; $i++) {
|
for ($i = 0; $i < $length; $i++) {
|
||||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $randomString;
|
return $randomString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,15 +4,17 @@ namespace App\Livewire\Dashboard;
|
|||||||
|
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use Session;
|
use Session;
|
||||||
use function Pest\Laravel\withoutMockingConsoleOutput;
|
|
||||||
|
|
||||||
class BulkGmail extends Component
|
class BulkGmail extends Component
|
||||||
{
|
{
|
||||||
public $email;
|
public $email;
|
||||||
|
|
||||||
public int $quantity = 10;
|
public int $quantity = 10;
|
||||||
|
|
||||||
public $bulkEmails = [];
|
public $bulkEmails = [];
|
||||||
|
|
||||||
public function mount() {
|
public function mount()
|
||||||
|
{
|
||||||
$subscriptionCheck = auth()->user()->subscribedToProduct(config('app.plans')[0]['product_id']);
|
$subscriptionCheck = auth()->user()->subscribedToProduct(config('app.plans')[0]['product_id']);
|
||||||
Session::put('isSubscribed', $subscriptionCheck);
|
Session::put('isSubscribed', $subscriptionCheck);
|
||||||
}
|
}
|
||||||
@@ -32,17 +34,17 @@ class BulkGmail extends Component
|
|||||||
$this->bulkEmails = [];
|
$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()
|
public function downloadBulk()
|
||||||
{
|
{
|
||||||
// Ensure there's something to download
|
// Ensure there's something to download
|
||||||
if (empty($this->bulkEmails) || !is_array($this->bulkEmails)) {
|
if (empty($this->bulkEmails) || ! is_array($this->bulkEmails)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$filename = 'bulk_gmails_' . now()->format('Ymd_His') . '.txt';
|
$filename = 'bulk_gmails_'.now()->format('Ymd_His').'.txt';
|
||||||
$content = implode(PHP_EOL, $this->bulkEmails);
|
$content = implode(PHP_EOL, $this->bulkEmails);
|
||||||
|
|
||||||
return response()->streamDownload(function () use ($content) {
|
return response()->streamDownload(function () use ($content) {
|
||||||
@@ -66,11 +68,11 @@ class BulkGmail extends Component
|
|||||||
$lastPos = 0;
|
$lastPos = 0;
|
||||||
|
|
||||||
foreach ($combo as $pos) {
|
foreach ($combo as $pos) {
|
||||||
$dotted .= substr($uname, $lastPos, $pos - $lastPos) . '.';
|
$dotted .= substr($uname, $lastPos, $pos - $lastPos).'.';
|
||||||
$lastPos = $pos;
|
$lastPos = $pos;
|
||||||
}
|
}
|
||||||
$dotted .= substr($uname, $lastPos);
|
$dotted .= substr($uname, $lastPos);
|
||||||
$results[] = $dotted . '@gmail.com';
|
$results[] = $dotted.'@gmail.com';
|
||||||
|
|
||||||
if (count($results) >= $quantity) {
|
if (count($results) >= $quantity) {
|
||||||
return $results;
|
return $results;
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Livewire\Dashboard;
|
namespace App\Livewire\Dashboard;
|
||||||
|
|
||||||
use Stripe\StripeClient;
|
|
||||||
use Log;
|
|
||||||
use App\Models\UsageLog;
|
use App\Models\UsageLog;
|
||||||
use Cache;
|
use Cache;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
@@ -11,13 +9,19 @@ use DB;
|
|||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
use Log;
|
||||||
|
use Stripe\StripeClient;
|
||||||
|
|
||||||
class Dashboard extends Component
|
class Dashboard extends Component
|
||||||
{
|
{
|
||||||
public $message;
|
public $message;
|
||||||
|
|
||||||
public $usageLog;
|
public $usageLog;
|
||||||
|
|
||||||
public $subscription;
|
public $subscription;
|
||||||
|
|
||||||
public $plans;
|
public $plans;
|
||||||
|
|
||||||
public $showStripeBilling = false;
|
public $showStripeBilling = false;
|
||||||
|
|
||||||
public function paymentStatus(Request $request)
|
public function paymentStatus(Request $request)
|
||||||
@@ -26,6 +30,7 @@ class Dashboard extends Component
|
|||||||
$currentUrl = $request->fullUrl();
|
$currentUrl = $request->fullUrl();
|
||||||
if ($status == 'success') {
|
if ($status == 'success') {
|
||||||
$this->syncSubscription();
|
$this->syncSubscription();
|
||||||
|
|
||||||
return redirect()->route('dashboard')->with('status', 'success');
|
return redirect()->route('dashboard')->with('status', 'success');
|
||||||
} elseif ($status == 'cancel') {
|
} elseif ($status == 'cancel') {
|
||||||
return redirect()->route('dashboard')->with('status', 'cancel');
|
return redirect()->route('dashboard')->with('status', 'cancel');
|
||||||
@@ -39,13 +44,13 @@ class Dashboard extends Component
|
|||||||
$userId = $user->id;
|
$userId = $user->id;
|
||||||
if ($user->subscribed()) {
|
if ($user->subscribed()) {
|
||||||
$subscription = $user->subscriptions()
|
$subscription = $user->subscriptions()
|
||||||
//->where(['stripe_status' => 'active'])
|
// ->where(['stripe_status' => 'active'])
|
||||||
->orderByDesc('updated_at')
|
->orderByDesc('updated_at')
|
||||||
->first();
|
->first();
|
||||||
if ($subscription !== null) {
|
if ($subscription !== null) {
|
||||||
$subscriptionId = $subscription->stripe_id;
|
$subscriptionId = $subscription->stripe_id;
|
||||||
$cacheKey = "stripe_check_executed_user_{$userId}_{$subscriptionId}";
|
$cacheKey = "stripe_check_executed_user_{$userId}_{$subscriptionId}";
|
||||||
if (!Cache::has($cacheKey)) {
|
if (! Cache::has($cacheKey)) {
|
||||||
try {
|
try {
|
||||||
$stripe = new StripeClient(config('cashier.secret'));
|
$stripe = new StripeClient(config('cashier.secret'));
|
||||||
$subscriptionData = $stripe->subscriptions->retrieve($subscriptionId, []);
|
$subscriptionData = $stripe->subscriptions->retrieve($subscriptionId, []);
|
||||||
@@ -60,11 +65,11 @@ class Dashboard extends Component
|
|||||||
if ($cancel_at_period_end) {
|
if ($cancel_at_period_end) {
|
||||||
$final_ends_at = Carbon::createFromTimestamp($cancel_at)->toDateTimeString();
|
$final_ends_at = Carbon::createFromTimestamp($cancel_at)->toDateTimeString();
|
||||||
} else {
|
} else {
|
||||||
if ($cancel_at === null && $canceled_at !== null && $status === "canceled" && $cancel_at_period_end === false) {
|
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::createFromTimestamp($canceled_at)->toDateTimeString();
|
||||||
$final_ends_at = Carbon::now()->subDays(2)->toDateTimeString();
|
$final_ends_at = Carbon::now()->subDays(2)->toDateTimeString();
|
||||||
$redirect = true;
|
$redirect = true;
|
||||||
} elseif($status === "active" && $cancel_at !== null) {
|
} elseif ($status === 'active' && $cancel_at !== null) {
|
||||||
$final_ends_at = Carbon::createFromTimestamp($cancel_at)->toDateTimeString();
|
$final_ends_at = Carbon::createFromTimestamp($cancel_at)->toDateTimeString();
|
||||||
} else {
|
} else {
|
||||||
$final_ends_at = null;
|
$final_ends_at = null;
|
||||||
@@ -88,6 +93,7 @@ class Dashboard extends Component
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $redirect;
|
return $redirect;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +104,7 @@ class Dashboard extends Component
|
|||||||
if ($user->hasStripeId()) {
|
if ($user->hasStripeId()) {
|
||||||
$stripe = new StripeClient(config('cashier.secret'));
|
$stripe = new StripeClient(config('cashier.secret'));
|
||||||
$subscriptions = $stripe->subscriptions->all(['limit' => 1]);
|
$subscriptions = $stripe->subscriptions->all(['limit' => 1]);
|
||||||
if (!$subscriptions->isEmpty()) {
|
if (! $subscriptions->isEmpty()) {
|
||||||
$data = $subscriptions->data[0];
|
$data = $subscriptions->data[0];
|
||||||
$items = $subscriptions->data[0]->items->data[0];
|
$items = $subscriptions->data[0]->items->data[0];
|
||||||
|
|
||||||
@@ -118,7 +124,7 @@ class Dashboard extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($status === "active") {
|
if ($status === 'active') {
|
||||||
$subscriptionsTable = DB::table('subscriptions')->where(['stripe_id' => $subscriptionId])->first();
|
$subscriptionsTable = DB::table('subscriptions')->where(['stripe_id' => $subscriptionId])->first();
|
||||||
if ($subscriptionsTable == null) {
|
if ($subscriptionsTable == null) {
|
||||||
$subscriptionsTable = DB::table('subscriptions')->insert([
|
$subscriptionsTable = DB::table('subscriptions')->insert([
|
||||||
@@ -158,9 +164,9 @@ class Dashboard extends Component
|
|||||||
|
|
||||||
public function mount(Request $request)
|
public function mount(Request $request)
|
||||||
{
|
{
|
||||||
if($this->checkForSubscriptionStatus()) {
|
if ($this->checkForSubscriptionStatus()) {
|
||||||
return redirect()->route('dashboard');
|
return redirect()->route('dashboard');
|
||||||
};
|
}
|
||||||
try {
|
try {
|
||||||
$status = $request->session()->get('status');
|
$status = $request->session()->get('status');
|
||||||
if (isset($status)) {
|
if (isset($status)) {
|
||||||
@@ -176,7 +182,7 @@ class Dashboard extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
$plans = config('app.plans', []);
|
$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 {
|
try {
|
||||||
$result = auth()->user()->subscriptions()->where(['stripe_status' => 'active'])->orderByDesc('updated_at')->first();
|
$result = auth()->user()->subscriptions()->where(['stripe_status' => 'active'])->orderByDesc('updated_at')->first();
|
||||||
if ($result != null) {
|
if ($result != null) {
|
||||||
|
|||||||
@@ -2,44 +2,62 @@
|
|||||||
|
|
||||||
namespace App\Livewire\Dashboard\Mailbox;
|
namespace App\Livewire\Dashboard\Mailbox;
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use App\ColorPicker;
|
use App\ColorPicker;
|
||||||
use App\Models\Log;
|
use App\Models\Log;
|
||||||
use App\Models\Premium;
|
use App\Models\Premium;
|
||||||
use App\Models\PremiumEmail;
|
use App\Models\PremiumEmail;
|
||||||
use App\Models\UsageLog;
|
use App\Models\UsageLog;
|
||||||
use App\Models\ZEmail;
|
use App\Models\ZEmail;
|
||||||
use Artisan;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Exception;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Cookie;
|
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use Session;
|
use Session;
|
||||||
|
|
||||||
class Inbox extends Component
|
class Inbox extends Component
|
||||||
{
|
{
|
||||||
use ColorPicker;
|
use ColorPicker;
|
||||||
|
|
||||||
public $messages = [];
|
public $messages = [];
|
||||||
|
|
||||||
public $deleted = [];
|
public $deleted = [];
|
||||||
|
|
||||||
public $error = '';
|
public $error = '';
|
||||||
|
|
||||||
public $email;
|
public $email;
|
||||||
|
|
||||||
public $initial = false;
|
public $initial = false;
|
||||||
|
|
||||||
public $type;
|
public $type;
|
||||||
|
|
||||||
public $overflow = false;
|
public $overflow = false;
|
||||||
|
|
||||||
public $messageId;
|
public $messageId;
|
||||||
|
|
||||||
public $list = false;
|
public $list = false;
|
||||||
|
|
||||||
public $emails;
|
public $emails;
|
||||||
|
|
||||||
public $mailboxHistory;
|
public $mailboxHistory;
|
||||||
|
|
||||||
public $emailsHistory;
|
public $emailsHistory;
|
||||||
public $username, $domain, $domains, $action;
|
|
||||||
|
public $username;
|
||||||
|
|
||||||
|
public $domain;
|
||||||
|
|
||||||
|
public $domains;
|
||||||
|
|
||||||
|
public $action;
|
||||||
|
|
||||||
public $email_limit = 20;
|
public $email_limit = 20;
|
||||||
|
|
||||||
public bool $premium = true;
|
public bool $premium = true;
|
||||||
|
|
||||||
private $isSubscribed;
|
private $isSubscribed;
|
||||||
|
|
||||||
protected $listeners = ['updateEmail' => 'syncEmail', 'getEmail' => 'generateEmail', 'fetchMessages' => 'fetch', 'setMessageId' => 'setMessageId'];
|
protected $listeners = ['updateEmail' => 'syncEmail', 'getEmail' => 'generateEmail', 'fetchMessages' => 'fetch', 'setMessageId' => 'setMessageId'];
|
||||||
|
|
||||||
|
|
||||||
public function mount(): void
|
public function mount(): void
|
||||||
{
|
{
|
||||||
$this->premium = Session::get('isInboxTypePremium', true);
|
$this->premium = Session::get('isInboxTypePremium', true);
|
||||||
@@ -64,7 +82,7 @@ class Inbox extends Component
|
|||||||
|
|
||||||
$subscriptionCheck = auth()->user()->subscribedToProduct(config('app.plans')[0]['product_id']);
|
$subscriptionCheck = auth()->user()->subscribedToProduct(config('app.plans')[0]['product_id']);
|
||||||
Session::put('isSubscribed', $subscriptionCheck);
|
Session::put('isSubscribed', $subscriptionCheck);
|
||||||
if($subscriptionCheck) {
|
if ($subscriptionCheck) {
|
||||||
try {
|
try {
|
||||||
$result = auth()->user()->subscriptions()->where(['stripe_status' => 'active'])->orderByDesc('updated_at')->first();
|
$result = auth()->user()->subscriptions()->where(['stripe_status' => 'active'])->orderByDesc('updated_at')->first();
|
||||||
$userPriceID = $result['items'][0]['stripe_price'];
|
$userPriceID = $result['items'][0]['stripe_price'];
|
||||||
@@ -116,7 +134,7 @@ class Inbox extends Component
|
|||||||
} else {
|
} else {
|
||||||
$domains = json_decode(config('app.settings.configuration_settings'))->domains ?? [];
|
$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.'));
|
return $this->showAlert('error', __('This mailbox can not be recovered.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -150,24 +168,25 @@ class Inbox extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Actions */
|
/* Actions */
|
||||||
public function create() {
|
public function create()
|
||||||
if (!$this->username) {
|
{
|
||||||
|
if (! $this->username) {
|
||||||
return $this->showAlert('error', __('Please enter Username'));
|
return $this->showAlert('error', __('Please enter Username'));
|
||||||
}
|
}
|
||||||
$this->checkDomainInUsername();
|
$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) {
|
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'));
|
return $this->showAlert('error', __('Please Select a Domain'));
|
||||||
}
|
}
|
||||||
if (in_array($this->username, json_decode(config('app.settings.configuration_settings'))->forbidden_ids)) {
|
if (in_array($this->username, json_decode(config('app.settings.configuration_settings'))->forbidden_ids)) {
|
||||||
return $this->showAlert('error', __('Username not allowed'));
|
return $this->showAlert('error', __('Username not allowed'));
|
||||||
}
|
}
|
||||||
if (!$this->checkEmailLimit()) {
|
if (! $this->checkEmailLimit()) {
|
||||||
return $this->showAlert('error', __('You have reached daily limit of MAX ') . $this->email_limit . __(' temp mail'));
|
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.'));
|
return $this->showAlert('error', __('Sorry! That email is already been used by someone else. Please try a different email address.'));
|
||||||
}
|
}
|
||||||
if ($this->premium) {
|
if ($this->premium) {
|
||||||
@@ -175,42 +194,51 @@ class Inbox extends Component
|
|||||||
} else {
|
} else {
|
||||||
$this->email = ZEmail::createCustomEmail($this->username, $this->domain);
|
$this->email = ZEmail::createCustomEmail($this->username, $this->domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->route('dashboard.premium');
|
return redirect()->route('dashboard.premium');
|
||||||
|
|
||||||
}
|
}
|
||||||
public function random() {
|
|
||||||
|
|
||||||
if (!$this->checkEmailLimit()) {
|
public function random()
|
||||||
return $this->showAlert('error', __('You have reached daily limit of maximum ') . $this->email_limit . __(' temp mail addresses.'));
|
{
|
||||||
|
|
||||||
|
if (! $this->checkEmailLimit()) {
|
||||||
|
return $this->showAlert('error', __('You have reached daily limit of maximum ').$this->email_limit.__(' temp mail addresses.'));
|
||||||
}
|
}
|
||||||
if ($this->premium) {
|
if ($this->premium) {
|
||||||
$this->email = Premium::generateRandomEmail();
|
$this->email = Premium::generateRandomEmail();
|
||||||
} else {
|
} else {
|
||||||
$this->email = ZEmail::generateRandomEmail();
|
$this->email = ZEmail::generateRandomEmail();
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->route('dashboard.premium');
|
return redirect()->route('dashboard.premium');
|
||||||
}
|
}
|
||||||
public function gmail() {
|
|
||||||
if (!$this->checkEmailLimit()) {
|
public function gmail()
|
||||||
return $this->showAlert('error', __('You have reached daily limit of maximum ') . $this->email_limit . __(' temp mail addresses.'));
|
{
|
||||||
|
if (! $this->checkEmailLimit()) {
|
||||||
|
return $this->showAlert('error', __('You have reached daily limit of maximum ').$this->email_limit.__(' temp mail addresses.'));
|
||||||
}
|
}
|
||||||
if ($this->premium) {
|
if ($this->premium) {
|
||||||
$this->email = Premium::generateRandomGmail();
|
$this->email = Premium::generateRandomGmail();
|
||||||
} else {
|
} else {
|
||||||
$this->email = ZEmail::generateRandomGmail();
|
$this->email = ZEmail::generateRandomGmail();
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->route('dashboard.premium');
|
return redirect()->route('dashboard.premium');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function outlook() {
|
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->checkEmailLimit()) {
|
||||||
|
return $this->showAlert('error', __('You have reached daily limit of maximum ').$this->email_limit.__(' temp mail addresses.'));
|
||||||
}
|
}
|
||||||
if ($this->premium) {
|
if ($this->premium) {
|
||||||
$this->email = Premium::generateRandomOutlook();
|
$this->email = Premium::generateRandomOutlook();
|
||||||
} else {
|
} else {
|
||||||
$this->email = ZEmail::generateRandomOutlook();
|
$this->email = ZEmail::generateRandomOutlook();
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->route('dashboard.premium');
|
return redirect()->route('dashboard.premium');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,18 +258,21 @@ class Inbox extends Component
|
|||||||
if (count($logs) >= $this->email_limit) {
|
if (count($logs) >= $this->email_limit) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function checkUsedEmail(): bool
|
private function checkUsedEmail(): bool
|
||||||
{
|
{
|
||||||
if (json_decode(config('app.settings.configuration_settings'))->disable_used_email) {
|
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) {
|
if ($check > 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,7 +299,7 @@ class Inbox extends Component
|
|||||||
} else {
|
} else {
|
||||||
$domains = json_decode(config('app.settings.configuration_settings'))->domains ?? [];
|
$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);
|
$key = array_search($this->email, $this->emails);
|
||||||
if ($this->premium) {
|
if ($this->premium) {
|
||||||
Premium::removeEmail($this->email);
|
Premium::removeEmail($this->email);
|
||||||
@@ -290,7 +321,6 @@ class Inbox extends Component
|
|||||||
|
|
||||||
/* Mailbox */
|
/* Mailbox */
|
||||||
|
|
||||||
|
|
||||||
public function fetch(): void
|
public function fetch(): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -300,33 +330,33 @@ class Inbox extends Component
|
|||||||
}
|
}
|
||||||
$responses = [];
|
$responses = [];
|
||||||
if ($this->premium) {
|
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 = [
|
$responses = [
|
||||||
'to' => Premium::getMessages($this->email, 'to', $this->deleted),
|
'to' => Premium::getMessages($this->email, 'to', $this->deleted),
|
||||||
'cc' => [
|
'cc' => [
|
||||||
'data' => [],
|
'data' => [],
|
||||||
'notifications' => []
|
'notifications' => [],
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
$responses = [
|
$responses = [
|
||||||
'to' => Premium::getMessages($this->email, 'to', $this->deleted),
|
'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 {
|
} 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 = [
|
$responses = [
|
||||||
'to' => ZEmail::getMessages($this->email, 'to', $this->deleted),
|
'to' => ZEmail::getMessages($this->email, 'to', $this->deleted),
|
||||||
'cc' => [
|
'cc' => [
|
||||||
'data' => [],
|
'data' => [],
|
||||||
'notifications' => []
|
'notifications' => [],
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
$responses = [
|
$responses = [
|
||||||
'to' => ZEmail::getMessages($this->email, 'to', $this->deleted),
|
'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']);
|
$notifications = array_merge($responses['to']['notifications'], $responses['cc']['notifications']);
|
||||||
|
|
||||||
if (count($notifications)) {
|
if (count($notifications)) {
|
||||||
if (!$this->overflow && count($this->messages) == $count) {
|
if (! $this->overflow && count($this->messages) == $count) {
|
||||||
$this->overflow = true;
|
$this->overflow = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -367,16 +397,17 @@ class Inbox extends Component
|
|||||||
$this->initial = true;
|
$this->initial = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete($messageId) {
|
public function delete($messageId)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->deleted[] = $messageId;
|
$this->deleted[] = $messageId;
|
||||||
foreach ($this->messages as $key => $message) {
|
foreach ($this->messages as $key => $message) {
|
||||||
if ($message['id'] == $messageId) {
|
if ($message['id'] == $messageId) {
|
||||||
if ($this->premium) {
|
if ($this->premium) {
|
||||||
$directory = public_path('tmp/premium/attachments/') . $messageId;
|
$directory = public_path('tmp/premium/attachments/').$messageId;
|
||||||
} else {
|
} else {
|
||||||
$directory = public_path('tmp/attachments/') . $messageId;
|
$directory = public_path('tmp/attachments/').$messageId;
|
||||||
}
|
}
|
||||||
$this->rrmdir($directory);
|
$this->rrmdir($directory);
|
||||||
unset($this->messages[$key]);
|
unset($this->messages[$key]);
|
||||||
@@ -393,7 +424,7 @@ class Inbox extends Component
|
|||||||
|
|
||||||
public function toggleMode()
|
public function toggleMode()
|
||||||
{
|
{
|
||||||
$this->premium = !$this->premium;
|
$this->premium = ! $this->premium;
|
||||||
Session::put('isInboxTypePremium', $this->premium);
|
Session::put('isInboxTypePremium', $this->premium);
|
||||||
if ($this->premium) {
|
if ($this->premium) {
|
||||||
$this->domains = json_decode(config('app.settings.configuration_settings'))->premium_domains ?? [];
|
$this->domains = json_decode(config('app.settings.configuration_settings'))->premium_domains ?? [];
|
||||||
@@ -432,11 +463,12 @@ class Inbox extends Component
|
|||||||
if (is_dir($dir)) {
|
if (is_dir($dir)) {
|
||||||
$objects = scandir($dir);
|
$objects = scandir($dir);
|
||||||
foreach ($objects as $object) {
|
foreach ($objects as $object) {
|
||||||
if ($object != "." && $object != "..") {
|
if ($object != '.' && $object != '..') {
|
||||||
if (is_dir($dir . DIRECTORY_SEPARATOR . $object) && !is_link($dir . "/" . $object))
|
if (is_dir($dir.DIRECTORY_SEPARATOR.$object) && ! is_link($dir.'/'.$object)) {
|
||||||
$this->rrmdir($dir . DIRECTORY_SEPARATOR . $object);
|
$this->rrmdir($dir.DIRECTORY_SEPARATOR.$object);
|
||||||
else
|
} else {
|
||||||
unlink($dir . DIRECTORY_SEPARATOR . $object);
|
unlink($dir.DIRECTORY_SEPARATOR.$object);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rmdir($dir);
|
rmdir($dir);
|
||||||
|
|||||||
@@ -2,15 +2,16 @@
|
|||||||
|
|
||||||
namespace App\Livewire\Dashboard;
|
namespace App\Livewire\Dashboard;
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use Log;
|
|
||||||
use App\Models\ActivationKey;
|
use App\Models\ActivationKey;
|
||||||
use App\Models\Plan;
|
use App\Models\Plan;
|
||||||
|
use Exception;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
use Log;
|
||||||
|
|
||||||
class Pricing extends Component
|
class Pricing extends Component
|
||||||
{
|
{
|
||||||
public $plans;
|
public $plans;
|
||||||
|
|
||||||
public $activation_key;
|
public $activation_key;
|
||||||
|
|
||||||
public function mount(): void
|
public function mount(): void
|
||||||
@@ -71,7 +72,7 @@ class Pricing extends Component
|
|||||||
'name' => $user->name,
|
'name' => $user->name,
|
||||||
'email' => $user->email,
|
'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();
|
$balance = $user->balance();
|
||||||
$user->newSubscription('default', $plan->pricing_id)->create();
|
$user->newSubscription('default', $plan->pricing_id)->create();
|
||||||
|
|
||||||
@@ -81,12 +82,15 @@ class Pricing extends Component
|
|||||||
$ends_at = now()->addYear();
|
$ends_at = now()->addYear();
|
||||||
}
|
}
|
||||||
$user->subscription('default')->cancelAt($ends_at);
|
$user->subscription('default')->cancelAt($ends_at);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
return view('livewire.dashboard.pricing');
|
return view('livewire.dashboard.pricing');
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
namespace App\Livewire\Dashboard;
|
namespace App\Livewire\Dashboard;
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use App\Models\Ticket;
|
use App\Models\Ticket;
|
||||||
use App\Models\TicketResponse;
|
use App\Models\TicketResponse;
|
||||||
|
use Exception;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use Request;
|
use Request;
|
||||||
use Str;
|
use Str;
|
||||||
@@ -12,11 +12,17 @@ use Str;
|
|||||||
class Support extends Component
|
class Support extends Component
|
||||||
{
|
{
|
||||||
public $tickets = [];
|
public $tickets = [];
|
||||||
|
|
||||||
public $subject;
|
public $subject;
|
||||||
|
|
||||||
public $message;
|
public $message;
|
||||||
|
|
||||||
public $response;
|
public $response;
|
||||||
|
|
||||||
public $list = false;
|
public $list = false;
|
||||||
|
|
||||||
public $open = 0;
|
public $open = 0;
|
||||||
|
|
||||||
public $closed = 0;
|
public $closed = 0;
|
||||||
|
|
||||||
public function store()
|
public function store()
|
||||||
@@ -37,7 +43,7 @@ class Support extends Component
|
|||||||
]);
|
]);
|
||||||
$this->dispatch('showAlert', ['type' => 'success', 'message' => 'Your ticket has been created successfully!']);
|
$this->dispatch('showAlert', ['type' => 'success', 'message' => 'Your ticket has been created successfully!']);
|
||||||
$this->dispatch('closeModal');
|
$this->dispatch('closeModal');
|
||||||
$this->reset(['subject','message']);
|
$this->reset(['subject', 'message']);
|
||||||
$this->tickets = Ticket::with('responses')
|
$this->tickets = Ticket::with('responses')
|
||||||
->where('user_id', auth()->id())
|
->where('user_id', auth()->id())
|
||||||
->get();
|
->get();
|
||||||
@@ -45,7 +51,6 @@ class Support extends Component
|
|||||||
$this->dispatch('showAlert', ['type' => 'error', 'message' => 'Something went wrong!']);
|
$this->dispatch('showAlert', ['type' => 'error', 'message' => 'Something went wrong!']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reply($ticket_id)
|
public function reply($ticket_id)
|
||||||
@@ -56,14 +61,16 @@ class Support extends Component
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (!is_numeric($ticket_id)) {
|
if (! is_numeric($ticket_id)) {
|
||||||
$this->dispatch('showAlert', ['type' => 'error', 'message' => 'Invalid ticket ID.']);
|
$this->dispatch('showAlert', ['type' => 'error', 'message' => 'Invalid ticket ID.']);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ticket = Ticket::find($ticket_id);
|
$ticket = Ticket::find($ticket_id);
|
||||||
if (!$ticket) {
|
if (! $ticket) {
|
||||||
$this->dispatch('showAlert', ['type' => 'error', 'message' => 'Ticket not found.']);
|
$this->dispatch('showAlert', ['type' => 'error', 'message' => 'Ticket not found.']);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,13 +98,15 @@ class Support extends Component
|
|||||||
|
|
||||||
public function close($ticket_id)
|
public function close($ticket_id)
|
||||||
{
|
{
|
||||||
if (!is_numeric($ticket_id)) {
|
if (! is_numeric($ticket_id)) {
|
||||||
$this->dispatch('showAlert', ['type' => 'error', 'message' => 'Invalid ticket ID.']);
|
$this->dispatch('showAlert', ['type' => 'error', 'message' => 'Invalid ticket ID.']);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$ticket = Ticket::find($ticket_id);
|
$ticket = Ticket::find($ticket_id);
|
||||||
if (!$ticket) {
|
if (! $ticket) {
|
||||||
$this->dispatch('showAlert', ['type' => 'error', 'message' => 'Ticket not found.']);
|
$this->dispatch('showAlert', ['type' => 'error', 'message' => 'Ticket not found.']);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,61 +9,83 @@ use Livewire\Component;
|
|||||||
|
|
||||||
class Action extends Component
|
class Action extends Component
|
||||||
{
|
{
|
||||||
public $username, $email, $emails, $domain, $domains, $action, $initial;
|
public $username;
|
||||||
public function mount() {
|
|
||||||
|
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->domains = json_decode(config('app.settings.configuration_settings'))->domains ?? [];
|
||||||
$this->email = ZEmail::getEmail();
|
$this->email = ZEmail::getEmail();
|
||||||
$this->emails = ZEmail::getEmails();
|
$this->emails = ZEmail::getEmails();
|
||||||
$this->validateDomainInEmail();
|
$this->validateDomainInEmail();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create() {
|
public function create()
|
||||||
if (!$this->username) {
|
{
|
||||||
|
if (! $this->username) {
|
||||||
return $this->showAlert('error', __('Please enter Username'));
|
return $this->showAlert('error', __('Please enter Username'));
|
||||||
}
|
}
|
||||||
$this->checkDomainInUsername();
|
$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) {
|
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'));
|
return $this->showAlert('error', __('Please Select a Domain'));
|
||||||
}
|
}
|
||||||
if (in_array($this->username, json_decode(config('app.settings.configuration_settings'))->forbidden_ids)) {
|
if (in_array($this->username, json_decode(config('app.settings.configuration_settings'))->forbidden_ids)) {
|
||||||
return $this->showAlert('error', __('Username not allowed'));
|
return $this->showAlert('error', __('Username not allowed'));
|
||||||
}
|
}
|
||||||
if (!$this->checkEmailLimit()) {
|
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'));
|
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.'));
|
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);
|
$this->email = ZEmail::createCustomEmail($this->username, $this->domain);
|
||||||
|
|
||||||
return redirect()->route('mailbox');
|
return redirect()->route('mailbox');
|
||||||
|
|
||||||
}
|
}
|
||||||
public function random() {
|
|
||||||
if (!$this->checkEmailLimit()) {
|
public function random()
|
||||||
return $this->showAlert('error', __('You have reached daily limit of maximum ') . json_decode(config('app.settings.configuration_settings'))->email_limit . __(' temp mail addresses.'));
|
{
|
||||||
|
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();
|
$this->email = ZEmail::generateRandomEmail();
|
||||||
|
|
||||||
return redirect()->route('mailbox');
|
return redirect()->route('mailbox');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function gmail() {
|
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.'));
|
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();
|
$this->email = ZEmail::generateRandomGmail();
|
||||||
|
|
||||||
return redirect()->route('mailbox');
|
return redirect()->route('mailbox');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function outlook() {
|
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.'));
|
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();
|
$this->email = ZEmail::generateRandomOutlook();
|
||||||
|
|
||||||
return redirect()->route('mailbox');
|
return redirect()->route('mailbox');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,22 +109,26 @@ class Action extends Component
|
|||||||
if (count($logs) >= json_decode(config('app.settings.configuration_settings'))->email_limit) {
|
if (count($logs) >= json_decode(config('app.settings.configuration_settings'))->email_limit) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function checkUsedEmail(): bool
|
private function checkUsedEmail(): bool
|
||||||
{
|
{
|
||||||
if (json_decode(config('app.settings.configuration_settings'))->disable_used_email) {
|
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) {
|
if ($check > 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function checkDomainInUsername() {
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkDomainInUsername()
|
||||||
|
{
|
||||||
$parts = explode('@', $this->username);
|
$parts = explode('@', $this->username);
|
||||||
if (isset($parts[1])) {
|
if (isset($parts[1])) {
|
||||||
if (in_array($parts[1], $this->domains)) {
|
if (in_array($parts[1], $this->domains)) {
|
||||||
@@ -118,7 +144,7 @@ class Action extends Component
|
|||||||
if (isset($data[1])) {
|
if (isset($data[1])) {
|
||||||
$domain = $data[1];
|
$domain = $data[1];
|
||||||
$domains = json_decode(config('app.settings.configuration_settings'))->domains ?? [];
|
$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);
|
$key = array_search($this->email, $this->emails);
|
||||||
ZEmail::removeEmail($this->email);
|
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') {
|
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');
|
return view('livewire.frontend.action');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,14 @@ use Livewire\Component;
|
|||||||
class Email extends Component
|
class Email extends Component
|
||||||
{
|
{
|
||||||
public $list = false;
|
public $list = false;
|
||||||
public $type, $email, $emails, $initial;
|
|
||||||
|
public $type;
|
||||||
|
|
||||||
|
public $email;
|
||||||
|
|
||||||
|
public $emails;
|
||||||
|
|
||||||
|
public $initial;
|
||||||
|
|
||||||
protected $listeners = ['updateEmail' => 'syncEmail', 'getEmail' => 'generateEmail'];
|
protected $listeners = ['updateEmail' => 'syncEmail', 'getEmail' => 'generateEmail'];
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Livewire\Frontend;
|
namespace App\Livewire\Frontend;
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use App\Models\Email;
|
|
||||||
use App\ColorPicker;
|
use App\ColorPicker;
|
||||||
|
use App\Models\Email;
|
||||||
use App\Models\Message;
|
use App\Models\Message;
|
||||||
use App\Models\ZEmail;
|
use App\Models\ZEmail;
|
||||||
|
use Exception;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
@@ -16,12 +16,19 @@ class Mailbox extends Component
|
|||||||
use ColorPicker;
|
use ColorPicker;
|
||||||
|
|
||||||
public $messages = [];
|
public $messages = [];
|
||||||
|
|
||||||
public $deleted = [];
|
public $deleted = [];
|
||||||
|
|
||||||
public $error = '';
|
public $error = '';
|
||||||
|
|
||||||
public $email;
|
public $email;
|
||||||
|
|
||||||
public $initial = false;
|
public $initial = false;
|
||||||
|
|
||||||
public $type;
|
public $type;
|
||||||
|
|
||||||
public $overflow = false;
|
public $overflow = false;
|
||||||
|
|
||||||
public $messageId;
|
public $messageId;
|
||||||
|
|
||||||
protected $listeners = ['fetchMessages' => 'fetch', 'syncMailbox' => 'syncEmail', 'setMessageId' => 'setMessageId'];
|
protected $listeners = ['fetchMessages' => 'fetch', 'syncMailbox' => 'syncEmail', 'setMessageId' => 'setMessageId'];
|
||||||
@@ -30,10 +37,11 @@ class Mailbox extends Component
|
|||||||
{
|
{
|
||||||
$this->email = ZEmail::getEmail();
|
$this->email = ZEmail::getEmail();
|
||||||
$this->initial = false;
|
$this->initial = false;
|
||||||
if (!ZEmail::getEmail()) {
|
if (! ZEmail::getEmail()) {
|
||||||
return redirect()->route('home');
|
return redirect()->route('home');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function syncEmail($email): void
|
public function syncEmail($email): void
|
||||||
{
|
{
|
||||||
$this->email = $email;
|
$this->email = $email;
|
||||||
@@ -49,18 +57,18 @@ class Mailbox extends Component
|
|||||||
$this->messages = [];
|
$this->messages = [];
|
||||||
}
|
}
|
||||||
$responses = [];
|
$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 = [
|
$responses = [
|
||||||
'to' => ZEmail::getMessages($this->email, 'to', $this->deleted),
|
'to' => ZEmail::getMessages($this->email, 'to', $this->deleted),
|
||||||
'cc' => [
|
'cc' => [
|
||||||
'data' => [],
|
'data' => [],
|
||||||
'notifications' => []
|
'notifications' => [],
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
$responses = [
|
$responses = [
|
||||||
'to' => ZEmail::getMessages($this->email, 'to', $this->deleted),
|
'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']);
|
$notifications = array_merge($responses['to']['notifications'], $responses['cc']['notifications']);
|
||||||
|
|
||||||
if (count($notifications)) {
|
if (count($notifications)) {
|
||||||
if (!$this->overflow && count($this->messages) == $count) {
|
if (! $this->overflow && count($this->messages) == $count) {
|
||||||
$this->overflow = true;
|
$this->overflow = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -91,7 +99,8 @@ class Mailbox extends Component
|
|||||||
$this->initial = true;
|
$this->initial = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete($messageId) {
|
public function delete($messageId)
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (config('app.beta_feature')) {
|
if (config('app.beta_feature')) {
|
||||||
@@ -103,7 +112,7 @@ class Mailbox extends Component
|
|||||||
$this->deleted[] = $messageId;
|
$this->deleted[] = $messageId;
|
||||||
foreach ($this->messages as $key => $message) {
|
foreach ($this->messages as $key => $message) {
|
||||||
if ($message['id'] == $messageId) {
|
if ($message['id'] == $messageId) {
|
||||||
$directory = public_path('tmp/attachments/') . $messageId;
|
$directory = public_path('tmp/attachments/').$messageId;
|
||||||
$this->rrmdir($directory);
|
$this->rrmdir($directory);
|
||||||
unset($this->messages[$key]);
|
unset($this->messages[$key]);
|
||||||
}
|
}
|
||||||
@@ -127,11 +136,12 @@ class Mailbox extends Component
|
|||||||
if (is_dir($dir)) {
|
if (is_dir($dir)) {
|
||||||
$objects = scandir($dir);
|
$objects = scandir($dir);
|
||||||
foreach ($objects as $object) {
|
foreach ($objects as $object) {
|
||||||
if ($object != "." && $object != "..") {
|
if ($object != '.' && $object != '..') {
|
||||||
if (is_dir($dir . DIRECTORY_SEPARATOR . $object) && !is_link($dir . "/" . $object))
|
if (is_dir($dir.DIRECTORY_SEPARATOR.$object) && ! is_link($dir.'/'.$object)) {
|
||||||
$this->rrmdir($dir . DIRECTORY_SEPARATOR . $object);
|
$this->rrmdir($dir.DIRECTORY_SEPARATOR.$object);
|
||||||
else
|
} else {
|
||||||
unlink($dir . DIRECTORY_SEPARATOR . $object);
|
unlink($dir.DIRECTORY_SEPARATOR.$object);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rmdir($dir);
|
rmdir($dir);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ class Home extends Component
|
|||||||
return redirect()->route('mailbox');
|
return redirect()->route('mailbox');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
return view('livewire.home');
|
return view('livewire.home');
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ class Page extends Component
|
|||||||
public $slug;
|
public $slug;
|
||||||
|
|
||||||
public function mount($slug)
|
public function mount($slug)
|
||||||
|
|
||||||
{
|
{
|
||||||
$this->slug = $slug;
|
$this->slug = $slug;
|
||||||
}
|
}
|
||||||
@@ -18,9 +17,10 @@ class Page extends Component
|
|||||||
{
|
{
|
||||||
$page = \App\Models\Page::where('slug', $this->slug)->firstOrFail();
|
$page = \App\Models\Page::where('slug', $this->slug)->firstOrFail();
|
||||||
|
|
||||||
if ($page->is_published == false ) {
|
if ($page->is_published == false) {
|
||||||
abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('livewire.page', [
|
return view('livewire.page', [
|
||||||
'page' => $page,
|
'page' => $page,
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Livewire\Settings;
|
|||||||
|
|
||||||
use Livewire\Attributes\Layout;
|
use Livewire\Attributes\Layout;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
#[Layout('components.layouts.dashboard')]
|
#[Layout('components.layouts.dashboard')]
|
||||||
|
|
||||||
class Appearance extends Component
|
class Appearance extends Component
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use App\Livewire\Actions\Logout;
|
|||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Livewire\Attributes\Layout;
|
use Livewire\Attributes\Layout;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
#[Layout('components.layouts.dashboard')]
|
#[Layout('components.layouts.dashboard')]
|
||||||
|
|
||||||
class DeleteUserForm extends Component
|
class DeleteUserForm extends Component
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use Illuminate\Validation\Rules\Password as PasswordRule;
|
|||||||
use Illuminate\Validation\ValidationException;
|
use Illuminate\Validation\ValidationException;
|
||||||
use Livewire\Attributes\Layout;
|
use Livewire\Attributes\Layout;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
#[Layout('components.layouts.dashboard')]
|
#[Layout('components.layouts.dashboard')]
|
||||||
|
|
||||||
class Password extends Component
|
class Password extends Component
|
||||||
|
|||||||
@@ -2,13 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Mail;
|
namespace App\Mail;
|
||||||
|
|
||||||
use Illuminate\Mail\Mailables\Attachment;
|
|
||||||
use App\Models\Ticket;
|
use App\Models\Ticket;
|
||||||
use App\Models\TicketResponse;
|
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Mail\Mailable;
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Mail\Mailables\Attachment;
|
||||||
use Illuminate\Mail\Mailables\Content;
|
use Illuminate\Mail\Mailables\Content;
|
||||||
use Illuminate\Mail\Mailables\Envelope;
|
use Illuminate\Mail\Mailables\Envelope;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
@@ -18,7 +16,9 @@ class TicketResponseNotification extends Mailable
|
|||||||
use Queueable, SerializesModels;
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
public Ticket $ticket;
|
public Ticket $ticket;
|
||||||
|
|
||||||
public Collection $responses;
|
public Collection $responses;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new message instance.
|
* Create a new message instance.
|
||||||
*/
|
*/
|
||||||
@@ -34,7 +34,7 @@ class TicketResponseNotification extends Mailable
|
|||||||
public function envelope(): Envelope
|
public function envelope(): Envelope
|
||||||
{
|
{
|
||||||
return new Envelope(
|
return new Envelope(
|
||||||
subject: 'Support Ticket Response: #'. $this->ticket->ticket_id,
|
subject: 'Support Ticket Response: #'.$this->ticket->ticket_id,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,14 +13,15 @@ class Category extends Model
|
|||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name',
|
'name',
|
||||||
'slug',
|
'slug',
|
||||||
'is_active'
|
'is_active',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'is_active' => 'boolean',
|
'is_active' => 'boolean',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function blogs(): HasMany {
|
public function blogs(): HasMany
|
||||||
|
{
|
||||||
return $this->hasMany(Blog::class);
|
return $this->hasMany(Blog::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,19 +2,19 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Ddeboer\Imap\ConnectionInterface;
|
|
||||||
use DateTime;
|
|
||||||
use Exception;
|
|
||||||
use Illuminate\Support\Facades\Log;
|
|
||||||
use App\ColorPicker;
|
use App\ColorPicker;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Carbon\CarbonImmutable;
|
use Carbon\CarbonImmutable;
|
||||||
|
use DateTime;
|
||||||
|
use Ddeboer\Imap\ConnectionInterface;
|
||||||
use Ddeboer\Imap\Search\Date\Since;
|
use Ddeboer\Imap\Search\Date\Since;
|
||||||
use Ddeboer\Imap\Search\Email\To;
|
use Ddeboer\Imap\Search\Email\To;
|
||||||
use Ddeboer\Imap\Server;
|
use Ddeboer\Imap\Server;
|
||||||
|
use Exception;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Support\Facades\File;
|
use Illuminate\Support\Facades\File;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
|
||||||
class Email extends Model
|
class Email extends Model
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class Menu extends Model
|
|||||||
'name',
|
'name',
|
||||||
'url',
|
'url',
|
||||||
'new_tab',
|
'new_tab',
|
||||||
'parent'
|
'parent',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function parentname()
|
public function parentname()
|
||||||
|
|||||||
@@ -2,17 +2,17 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use DateTime;
|
|
||||||
use Exception;
|
|
||||||
use Illuminate\Support\Facades\Log;
|
|
||||||
use App\ColorPicker;
|
use App\ColorPicker;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use DateTime;
|
||||||
use Ddeboer\Imap\Search\Email\Cc;
|
use Ddeboer\Imap\Search\Email\Cc;
|
||||||
use Ddeboer\Imap\Search\Email\To;
|
use Ddeboer\Imap\Search\Email\To;
|
||||||
use Ddeboer\Imap\SearchExpression;
|
use Ddeboer\Imap\SearchExpression;
|
||||||
|
use Exception;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
class Message extends Model
|
class Message extends Model
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ namespace App\Models;
|
|||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Meta extends Model {
|
class Meta extends Model
|
||||||
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
@@ -13,9 +14,11 @@ class Meta extends Model {
|
|||||||
'value',
|
'value',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function incrementMeta($value = 1) {
|
public function incrementMeta($value = 1)
|
||||||
|
{
|
||||||
$this->value = $this->value + $value;
|
$this->value = $this->value + $value;
|
||||||
$this->save();
|
$this->save();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,8 +27,10 @@ class Meta extends Model {
|
|||||||
$meta = Meta::where('key', 'email_ids_created')->first();
|
$meta = Meta::where('key', 'email_ids_created')->first();
|
||||||
if ($meta) {
|
if ($meta) {
|
||||||
$meta->incrementMeta($value);
|
$meta->incrementMeta($value);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,24 +39,30 @@ class Meta extends Model {
|
|||||||
$meta = Meta::where('key', 'messages_received')->first();
|
$meta = Meta::where('key', 'messages_received')->first();
|
||||||
if ($meta) {
|
if ($meta) {
|
||||||
$meta->incrementMeta($value);
|
$meta->incrementMeta($value);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getEmailIdsCreated() {
|
public static function getEmailIdsCreated()
|
||||||
|
{
|
||||||
$meta = Meta::where('key', 'email_ids_created')->first();
|
$meta = Meta::where('key', 'email_ids_created')->first();
|
||||||
if ($meta) {
|
if ($meta) {
|
||||||
return $meta->value;
|
return $meta->value;
|
||||||
}
|
}
|
||||||
return "NaN";
|
|
||||||
|
return 'NaN';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getMessagesReceived() {
|
public static function getMessagesReceived()
|
||||||
|
{
|
||||||
$meta = Meta::where('key', 'messages_received')->first();
|
$meta = Meta::where('key', 'messages_received')->first();
|
||||||
if ($meta) {
|
if ($meta) {
|
||||||
return $meta->value;
|
return $meta->value;
|
||||||
}
|
}
|
||||||
return "NaN";
|
|
||||||
|
return 'NaN';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class Page extends Model
|
|||||||
'meta',
|
'meta',
|
||||||
'custom_header',
|
'custom_header',
|
||||||
'page_image',
|
'page_image',
|
||||||
'is_published'
|
'is_published',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
|
|||||||
@@ -2,23 +2,23 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Ddeboer\Imap\ConnectionInterface;
|
|
||||||
use DateTime;
|
|
||||||
use Exception;
|
|
||||||
use Log;
|
|
||||||
use App\ColorPicker;
|
use App\ColorPicker;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use DateTime;
|
||||||
|
use Ddeboer\Imap\ConnectionInterface;
|
||||||
use Ddeboer\Imap\Search\Email\Cc;
|
use Ddeboer\Imap\Search\Email\Cc;
|
||||||
use Ddeboer\Imap\Search\Email\To;
|
use Ddeboer\Imap\Search\Email\To;
|
||||||
use Ddeboer\Imap\SearchExpression;
|
use Ddeboer\Imap\SearchExpression;
|
||||||
use Ddeboer\Imap\Server;
|
use Exception;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Cookie;
|
use Illuminate\Support\Facades\Cookie;
|
||||||
|
use Log;
|
||||||
|
|
||||||
class Premium extends Model
|
class Premium extends Model
|
||||||
{
|
{
|
||||||
use ColorPicker;
|
use ColorPicker;
|
||||||
|
|
||||||
public static function connectMailBox($imap = null): ConnectionInterface
|
public static function connectMailBox($imap = null): ConnectionInterface
|
||||||
{
|
{
|
||||||
$imapDB = json_decode(config('app.settings.imap_settings'), true);
|
$imapDB = json_decode(config('app.settings.imap_settings'), true);
|
||||||
@@ -31,7 +31,7 @@ class Premium extends Model
|
|||||||
'password' => $imapDB['premium_password'],
|
'password' => $imapDB['premium_password'],
|
||||||
'default_account' => $imapDB['premium_default_account'],
|
'default_account' => $imapDB['premium_default_account'],
|
||||||
'protocol' => $imapDB['premium_protocol'],
|
'protocol' => $imapDB['premium_protocol'],
|
||||||
'cc_check' => $imapDB['premium_cc_check']
|
'cc_check' => $imapDB['premium_cc_check'],
|
||||||
];
|
];
|
||||||
|
|
||||||
return ZEmail::connectMailBox($imap);
|
return ZEmail::connectMailBox($imap);
|
||||||
@@ -41,15 +41,15 @@ class Premium extends Model
|
|||||||
{
|
{
|
||||||
if ($email == null) {
|
if ($email == null) {
|
||||||
return [
|
return [
|
||||||
"data" => [],
|
'data' => [],
|
||||||
"notifications" => []
|
'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');
|
$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();
|
$connection = self::connectMailBox();
|
||||||
|
|
||||||
$mailbox = $connection->getMailbox('INBOX');
|
$mailbox = $connection->getMailbox('INBOX');
|
||||||
$search = new SearchExpression();
|
$search = new SearchExpression;
|
||||||
if ($type == 'cc') {
|
if ($type == 'cc') {
|
||||||
$search->addCondition(new Cc($email));
|
$search->addCondition(new Cc($email));
|
||||||
} else {
|
} else {
|
||||||
@@ -60,18 +60,19 @@ class Premium extends Model
|
|||||||
$count = 1;
|
$count = 1;
|
||||||
$response = [
|
$response = [
|
||||||
'data' => [],
|
'data' => [],
|
||||||
'notifications' => []
|
'notifications' => [],
|
||||||
];
|
];
|
||||||
foreach ($messages as $message) {
|
foreach ($messages as $message) {
|
||||||
if (in_array($message->getNumber(), $deleted)) {
|
if (in_array($message->getNumber(), $deleted)) {
|
||||||
$message->delete();
|
$message->delete();
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$blocked = false;
|
$blocked = false;
|
||||||
$sender = $message->getFrom();
|
$sender = $message->getFrom();
|
||||||
$date = $message->getDate();
|
$date = $message->getDate();
|
||||||
if (!$date) {
|
if (! $date) {
|
||||||
$date = new DateTime();
|
$date = new DateTime;
|
||||||
if ($message->getHeaders()->get('udate')) {
|
if ($message->getHeaders()->get('udate')) {
|
||||||
$date->setTimestamp($message->getHeaders()->get('udate'));
|
$date->setTimestamp($message->getHeaders()->get('udate'));
|
||||||
}
|
}
|
||||||
@@ -82,12 +83,12 @@ class Premium extends Model
|
|||||||
$html = $message->getBodyHtml();
|
$html = $message->getBodyHtml();
|
||||||
$text = $message->getBodyText();
|
$text = $message->getBodyText();
|
||||||
if ($text) {
|
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) {
|
if ($html) {
|
||||||
$content = str_replace('<a', '<a target="blank"', $html);
|
$content = str_replace('<a', '<a target="blank"', $html);
|
||||||
} else {
|
} 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) {
|
if (json_decode(config('app.settings.configuration_settings'))->enable_masking_external_link) {
|
||||||
$content = str_replace('href="', 'href="http://href.li/?', $content);
|
$content = str_replace('href="', 'href="http://href.li/?', $content);
|
||||||
@@ -106,28 +107,28 @@ class Premium extends Model
|
|||||||
$obj['contentText'] = $contentText;
|
$obj['contentText'] = $contentText;
|
||||||
$obj['attachments'] = [];
|
$obj['attachments'] = [];
|
||||||
$obj['is_seen'] = true;
|
$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];
|
$domain = explode('@', $obj['sender_email'])[1];
|
||||||
$blocked = in_array($domain, json_decode(config('app.settings.configuration_settings'))->blocked_domains);
|
$blocked = in_array($domain, json_decode(config('app.settings.configuration_settings'))->blocked_domains);
|
||||||
if ($blocked) {
|
if ($blocked) {
|
||||||
$obj['subject'] = __('Blocked');
|
$obj['subject'] = __('Blocked');
|
||||||
$obj['content'] = __('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');
|
$obj['contentText'] = __('Emails from').' '.$domain.' '.__('are blocked by Admin');
|
||||||
}
|
}
|
||||||
if ($message->hasAttachments() && !$blocked) {
|
if ($message->hasAttachments() && ! $blocked) {
|
||||||
$attachments = $message->getAttachments();
|
$attachments = $message->getAttachments();
|
||||||
$directory = './tmp/premium/attachments/' . $obj['id'] . '/';
|
$directory = './tmp/premium/attachments/'.$obj['id'].'/';
|
||||||
is_dir($directory) || mkdir($directory, 0777, true);
|
is_dir($directory) || mkdir($directory, 0777, true);
|
||||||
foreach ($attachments as $attachment) {
|
foreach ($attachments as $attachment) {
|
||||||
$filenameArray = explode('.', $attachment->getFilename());
|
$filenameArray = explode('.', $attachment->getFilename());
|
||||||
$extension = $filenameArray[count($filenameArray) - 1];
|
$extension = $filenameArray[count($filenameArray) - 1];
|
||||||
if (in_array($extension, $allowed)) {
|
if (in_array($extension, $allowed)) {
|
||||||
if (!file_exists($directory . $attachment->getFilename())) {
|
if (! file_exists($directory.$attachment->getFilename())) {
|
||||||
try {
|
try {
|
||||||
file_put_contents(
|
file_put_contents(
|
||||||
$directory . $attachment->getFilename(),
|
$directory.$attachment->getFilename(),
|
||||||
$attachment->getDecodedContent()
|
$attachment->getDecodedContent()
|
||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
@@ -135,28 +136,28 @@ class Premium extends Model
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($attachment->getFilename() !== 'undefined') {
|
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();
|
$structure = $attachment->getStructure();
|
||||||
if (isset($structure->id) && str_contains($obj['content'], trim($structure->id, '<>'))) {
|
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'][] = [
|
$obj['attachments'][] = [
|
||||||
'file' => $attachment->getFilename(),
|
'file' => $attachment->getFilename(),
|
||||||
'url' => $url
|
'url' => $url,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$response['data'][] = $obj;
|
$response['data'][] = $obj;
|
||||||
if (!$message->isSeen()) {
|
if (! $message->isSeen()) {
|
||||||
$response['notifications'][] = [
|
$response['notifications'][] = [
|
||||||
'subject' => $obj['subject'],
|
'subject' => $obj['subject'],
|
||||||
'sender_name' => $obj['sender_name'],
|
'sender_name' => $obj['sender_name'],
|
||||||
'sender_email' => $obj['sender_email']
|
'sender_email' => $obj['sender_email'],
|
||||||
];
|
];
|
||||||
if (config('app.zemail_log')) {
|
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();
|
$message->markAsSeen();
|
||||||
@@ -167,6 +168,7 @@ class Premium extends Model
|
|||||||
|
|
||||||
$response['data'] = array_reverse($response['data']);
|
$response['data'] = array_reverse($response['data']);
|
||||||
$connection->expunge();
|
$connection->expunge();
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,6 +176,7 @@ class Premium extends Model
|
|||||||
{
|
{
|
||||||
return self::fetchMessages($email, $type, $deleted);
|
return self::fetchMessages($email, $type, $deleted);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function deleteMessage($id): void
|
public static function deleteMessage($id): void
|
||||||
{
|
{
|
||||||
$connection = self::connectMailBox();
|
$connection = self::connectMailBox();
|
||||||
@@ -181,20 +184,25 @@ class Premium extends Model
|
|||||||
$mailbox->getMessage($id)->delete();
|
$mailbox->getMessage($id)->delete();
|
||||||
$connection->expunge();
|
$connection->expunge();
|
||||||
}
|
}
|
||||||
public static function getEmail($generate = false) {
|
|
||||||
|
public static function getEmail($generate = false)
|
||||||
|
{
|
||||||
if (Cookie::has('p_email')) {
|
if (Cookie::has('p_email')) {
|
||||||
return Cookie::get('p_email');
|
return Cookie::get('p_email');
|
||||||
} else {
|
} else {
|
||||||
return $generate ? self::generateRandomEmail() : null;
|
return $generate ? self::generateRandomEmail() : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static function getEmails() {
|
|
||||||
|
public static function getEmails()
|
||||||
|
{
|
||||||
if (Cookie::has('p_emails')) {
|
if (Cookie::has('p_emails')) {
|
||||||
return unserialize(Cookie::get('p_emails'));
|
return unserialize(Cookie::get('p_emails'));
|
||||||
} else {
|
} else {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setEmail($email): void
|
public static function setEmail($email): void
|
||||||
{
|
{
|
||||||
$emails = unserialize(Cookie::get('p_emails'));
|
$emails = unserialize(Cookie::get('p_emails'));
|
||||||
@@ -211,6 +219,7 @@ class Premium extends Model
|
|||||||
Cookie::queue('p_email', $email, 43800);
|
Cookie::queue('p_email', $email, 43800);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function removeEmail($email): void
|
public static function removeEmail($email): void
|
||||||
{
|
{
|
||||||
$emails = self::getEmails();
|
$emails = self::getEmails();
|
||||||
@@ -226,17 +235,20 @@ class Premium extends Model
|
|||||||
Cookie::queue('p_emails', serialize([]), -1);
|
Cookie::queue('p_emails', serialize([]), -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function createCustomEmailFull($email): string
|
public static function createCustomEmailFull($email): string
|
||||||
{
|
{
|
||||||
$data = explode('@', $email);
|
$data = explode('@', $email);
|
||||||
$username = $data[0];
|
$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) {
|
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();
|
$username = $zemail->generateRandomUsername();
|
||||||
}
|
}
|
||||||
$domain = $data[1];
|
$domain = $data[1];
|
||||||
|
|
||||||
return self::createCustomEmail($username, $domain);
|
return self::createCustomEmail($username, $domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function createCustomEmail($username, $domain): string
|
public static function createCustomEmail($username, $domain): string
|
||||||
{
|
{
|
||||||
$username = preg_replace('/[^a-zA-Z0-9+.]/', '', strtolower($username));
|
$username = preg_replace('/[^a-zA-Z0-9+.]/', '', strtolower($username));
|
||||||
@@ -259,7 +271,7 @@ class Premium extends Model
|
|||||||
return self::generateRandomOutlook(true);
|
return self::generateRandomOutlook(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$zemail = new Premium();
|
$zemail = new Premium;
|
||||||
|
|
||||||
if ($username === '' && in_array($domain, $domains)) {
|
if ($username === '' && in_array($domain, $domains)) {
|
||||||
return $zemail->generateRandomUsername().'@'.$domain;
|
return $zemail->generateRandomUsername().'@'.$domain;
|
||||||
@@ -270,14 +282,15 @@ class Premium extends Model
|
|||||||
[$check_username, $post_username] = explode('+', $username, 2);
|
[$check_username, $post_username] = explode('+', $username, 2);
|
||||||
|
|
||||||
if (in_array($check_username, $outlook_usernames)) {
|
if (in_array($check_username, $outlook_usernames)) {
|
||||||
$email = $username . '@' . $domain;
|
$email = $username.'@'.$domain;
|
||||||
} else {
|
} else {
|
||||||
$email = $zemail->getRandomOutlookUser() . '+' . $post_username . '@' . $domain;
|
$email = $zemail->getRandomOutlookUser().'+'.$post_username.'@'.$domain;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$email = $zemail->getRandomOutlookUser() . '+' . $username . '@' . $domain;
|
$email = $zemail->getRandomOutlookUser().'+'.$username.'@'.$domain;
|
||||||
}
|
}
|
||||||
self::storeEmail($email);
|
self::storeEmail($email);
|
||||||
|
|
||||||
return $email;
|
return $email;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,142 +299,152 @@ class Premium extends Model
|
|||||||
[$check_username, $post_username] = explode('+', $username, 2);
|
[$check_username, $post_username] = explode('+', $username, 2);
|
||||||
|
|
||||||
if (in_array($check_username, $gmail_usernames)) {
|
if (in_array($check_username, $gmail_usernames)) {
|
||||||
$email = $username . '@' . $domain;
|
$email = $username.'@'.$domain;
|
||||||
} else {
|
} else {
|
||||||
$email = $zemail->getRandomGmailUser() . '+' . $post_username . '@' . $domain;
|
$email = $zemail->getRandomGmailUser().'+'.$post_username.'@'.$domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
} elseif (str_contains($username, '.')) {
|
} elseif (str_contains($username, '.')) {
|
||||||
$check_username = str_replace('.', '', $username);
|
$check_username = str_replace('.', '', $username);
|
||||||
|
|
||||||
if (in_array($check_username, $gmail_usernames)) {
|
if (in_array($check_username, $gmail_usernames)) {
|
||||||
$email = $username . '@' . $domain;
|
$email = $username.'@'.$domain;
|
||||||
} else {
|
} else {
|
||||||
$email = $zemail->generateRandomGmail() . '@' . $domain;
|
$email = $zemail->generateRandomGmail().'@'.$domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$email = $zemail->getRandomGmailUser() . '+' . $username . '@' . $domain;
|
$email = $zemail->getRandomGmailUser().'+'.$username.'@'.$domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
self::storeEmail($email);
|
self::storeEmail($email);
|
||||||
|
|
||||||
return $email;
|
return $email;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle other custom domains
|
// Handle other custom domains
|
||||||
if (!in_array($domain, $domains)) {
|
if (! in_array($domain, $domains)) {
|
||||||
return self::generateRandomEmail(true);
|
return self::generateRandomEmail(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$finalDomain = in_array($domain, $domains) ? $domain : ($domains[0] ?? 'example.com');
|
$finalDomain = in_array($domain, $domains) ? $domain : ($domains[0] ?? 'example.com');
|
||||||
$email = $username . '@' . $finalDomain;
|
$email = $username.'@'.$finalDomain;
|
||||||
|
|
||||||
self::storeEmail($email);
|
self::storeEmail($email);
|
||||||
|
|
||||||
return $email;
|
return $email;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function generateRandomEmail($store = true): string
|
public static function generateRandomEmail($store = true): string
|
||||||
{
|
{
|
||||||
$zemail = new Premium();
|
$zemail = new Premium;
|
||||||
$domain = $zemail->getRandomDomain();
|
$domain = $zemail->getRandomDomain();
|
||||||
if ($domain == "gmail.com") {
|
if ($domain == 'gmail.com') {
|
||||||
$rd = mt_rand(0,1);
|
$rd = mt_rand(0, 1);
|
||||||
if ($rd == 0) {
|
if ($rd == 0) {
|
||||||
$email = $zemail->generateRandomGmail(false);
|
$email = $zemail->generateRandomGmail(false);
|
||||||
} else {
|
} else {
|
||||||
$email = $zemail->getRandomGmailUser().'+'.$zemail->generateRandomUsername().'@gmail.com';
|
$email = $zemail->getRandomGmailUser().'+'.$zemail->generateRandomUsername().'@gmail.com';
|
||||||
}
|
}
|
||||||
} elseif ($domain == "googlemail.com") {
|
} elseif ($domain == 'googlemail.com') {
|
||||||
$rd = mt_rand(0,1);
|
$rd = mt_rand(0, 1);
|
||||||
if ($rd == 0) {
|
if ($rd == 0) {
|
||||||
$email = $zemail->generateRandomGmail(false);
|
$email = $zemail->generateRandomGmail(false);
|
||||||
} else {
|
} else {
|
||||||
$email = $zemail->getRandomGmailUser().'+'.$zemail->generateRandomUsername().'@googlemail.com';
|
$email = $zemail->getRandomGmailUser().'+'.$zemail->generateRandomUsername().'@googlemail.com';
|
||||||
}
|
}
|
||||||
} elseif ($domain == "outlook.com") {
|
} elseif ($domain == 'outlook.com') {
|
||||||
$email = $zemail->getRandomOutlookUser().'+'.$zemail->generateRandomUsername().'@outlook.com';
|
$email = $zemail->getRandomOutlookUser().'+'.$zemail->generateRandomUsername().'@outlook.com';
|
||||||
}
|
} else {
|
||||||
else {
|
$email = $zemail->generateRandomUsername().'@'.$domain;
|
||||||
$email = $zemail->generateRandomUsername() . '@' . $domain;
|
|
||||||
}
|
}
|
||||||
if ($store) {
|
if ($store) {
|
||||||
self::storeEmail($email);
|
self::storeEmail($email);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $email;
|
return $email;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function generateRandomGmail($store = true): string
|
public static function generateRandomGmail($store = true): string
|
||||||
{
|
{
|
||||||
$zemail = new Premium();
|
$zemail = new Premium;
|
||||||
$uname = $zemail->getRandomGmailUser();
|
$uname = $zemail->getRandomGmailUser();
|
||||||
$uname_len = strlen($uname);
|
$uname_len = strlen($uname);
|
||||||
$len_power = $uname_len - 1;
|
$len_power = $uname_len - 1;
|
||||||
$combination = pow(2,$len_power);
|
$combination = pow(2, $len_power);
|
||||||
$rand_comb = mt_rand(1,$combination);
|
$rand_comb = mt_rand(1, $combination);
|
||||||
$formatted = implode(' ',str_split($uname));
|
$formatted = implode(' ', str_split($uname));
|
||||||
$uname_exp = explode(' ', $formatted);
|
$uname_exp = explode(' ', $formatted);
|
||||||
|
|
||||||
$bin = intval("");
|
$bin = intval('');
|
||||||
for($i=0; $i<$len_power; $i++) {
|
for ($i = 0; $i < $len_power; $i++) {
|
||||||
$bin .= mt_rand(0,1);
|
$bin .= mt_rand(0, 1);
|
||||||
}
|
}
|
||||||
$bin = explode(' ', implode(' ',str_split(strval($bin))));
|
$bin = explode(' ', implode(' ', str_split(strval($bin))));
|
||||||
|
|
||||||
$email = "";
|
$email = '';
|
||||||
for($i=0; $i<$len_power; $i++) {
|
for ($i = 0; $i < $len_power; $i++) {
|
||||||
$email .= $uname_exp[$i];
|
$email .= $uname_exp[$i];
|
||||||
if($bin[$i]) {
|
if ($bin[$i]) {
|
||||||
$email .= ".";
|
$email .= '.';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$email .= $uname_exp[$i];
|
$email .= $uname_exp[$i];
|
||||||
$gmail_rand = mt_rand(1,10);
|
$gmail_rand = mt_rand(1, 10);
|
||||||
if($gmail_rand > 5) {
|
if ($gmail_rand > 5) {
|
||||||
$email .= "@gmail.com";
|
$email .= '@gmail.com';
|
||||||
} else {
|
} else {
|
||||||
$email .= "@googlemail.com";
|
$email .= '@googlemail.com';
|
||||||
}
|
}
|
||||||
if ($store) {
|
if ($store) {
|
||||||
self::storeEmail($email);
|
self::storeEmail($email);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $email;
|
return $email;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function generateRandomOutlook($store = true): string
|
public static function generateRandomOutlook($store = true): string
|
||||||
{
|
{
|
||||||
$zemail = new Premium();
|
$zemail = new Premium;
|
||||||
$email = $zemail->getRandomOutlookUser().'+'.$zemail->generateRandomUsername().'@outlook.com';
|
$email = $zemail->getRandomOutlookUser().'+'.$zemail->generateRandomUsername().'@outlook.com';
|
||||||
if ($store) {
|
if ($store) {
|
||||||
self::storeEmail($email);
|
self::storeEmail($email);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $email;
|
return $email;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function storeEmail($email): void
|
private static function storeEmail($email): void
|
||||||
{
|
{
|
||||||
Log::create([
|
Log::create([
|
||||||
'user_id' => auth()->user()->id,
|
'user_id' => auth()->user()->id,
|
||||||
'ip' => request()->ip(),
|
'ip' => request()->ip(),
|
||||||
'email' => $email
|
'email' => $email,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
self::storeUsageLog($email);
|
self::storeUsageLog($email);
|
||||||
|
|
||||||
Cookie::queue('p_email', $email, 43800);
|
Cookie::queue('p_email', $email, 43800);
|
||||||
$emails = Cookie::has('p_emails') ? unserialize(Cookie::get('p_emails')) : [];
|
$emails = Cookie::has('p_emails') ? unserialize(Cookie::get('p_emails')) : [];
|
||||||
if (!in_array($email, $emails)) {
|
if (! in_array($email, $emails)) {
|
||||||
self::incrementEmailStats();
|
self::incrementEmailStats();
|
||||||
$emails[] = $email;
|
$emails[] = $email;
|
||||||
Cookie::queue('p_emails', serialize($emails), 43800);
|
Cookie::queue('p_emails', serialize($emails), 43800);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function incrementEmailStats($count = 1): void
|
public static function incrementEmailStats($count = 1): void
|
||||||
{
|
{
|
||||||
Meta::incrementEmailIdsCreated($count);
|
Meta::incrementEmailIdsCreated($count);
|
||||||
self::incrementEmailIdsCreated($count);
|
self::incrementEmailIdsCreated($count);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function incrementMessagesStats($count = 1): void
|
public static function incrementMessagesStats($count = 1): void
|
||||||
{
|
{
|
||||||
Meta::incrementMessagesReceived($count);
|
Meta::incrementMessagesReceived($count);
|
||||||
self::incrementMessagesReceived($count);
|
self::incrementMessagesReceived($count);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function generateRandomUsername(): string
|
private function generateRandomUsername(): string
|
||||||
{
|
{
|
||||||
$start = json_decode(config('app.settings.configuration_settings'))->random_username_length_min ?? 0;
|
$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) {
|
if ($start == 0 && $end == 0) {
|
||||||
return $this->generatePronounceableWord();
|
return $this->generatePronounceableWord();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->generatedRandomBetweenLength($start, $end);
|
return $this->generatedRandomBetweenLength($start, $end);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function generatedRandomBetweenLength($start, $end): string
|
protected function generatedRandomBetweenLength($start, $end): string
|
||||||
{
|
{
|
||||||
$length = rand($start, $end);
|
$length = rand($start, $end);
|
||||||
|
|
||||||
return $this->generateRandomString($length);
|
return $this->generateRandomString($length);
|
||||||
}
|
}
|
||||||
private function getRandomDomain() {
|
|
||||||
|
private function getRandomDomain()
|
||||||
|
{
|
||||||
$domains = json_decode(config('app.settings.configuration_settings'))->premium_domains ?? [];
|
$domains = json_decode(config('app.settings.configuration_settings'))->premium_domains ?? [];
|
||||||
$count = count($domains);
|
$count = count($domains);
|
||||||
|
|
||||||
return $count > 0 ? $domains[rand(1, $count) - 1] : '';
|
return $count > 0 ? $domains[rand(1, $count) - 1] : '';
|
||||||
}
|
}
|
||||||
private function getRandomGmailUser() {
|
|
||||||
|
private function getRandomGmailUser()
|
||||||
|
{
|
||||||
$gmailusername = json_decode(config('app.settings.configuration_settings'))->premium_gmailUsernames ?? [];
|
$gmailusername = json_decode(config('app.settings.configuration_settings'))->premium_gmailUsernames ?? [];
|
||||||
$count = count($gmailusername);
|
$count = count($gmailusername);
|
||||||
|
|
||||||
return $count > 0 ? $gmailusername[rand(1, $count) - 1] : '';
|
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 ?? [];
|
$outlook_username = json_decode(config('app.settings.configuration_settings'))->premium_outlookUsernames ?? [];
|
||||||
$count = count($outlook_username);
|
$count = count($outlook_username);
|
||||||
|
|
||||||
return $count > 0 ? $outlook_username[rand(1, $count) - 1] : '';
|
return $count > 0 ? $outlook_username[rand(1, $count) - 1] : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
private function generatePronounceableWord(): string
|
private function generatePronounceableWord(): string
|
||||||
{
|
{
|
||||||
$c = 'bcdfghjklmnprstvwz'; //consonants except hard to speak ones
|
$c = 'bcdfghjklmnprstvwz'; // consonants except hard to speak ones
|
||||||
$v = 'aeiou'; //vowels
|
$v = 'aeiou'; // vowels
|
||||||
$a = $c . $v; //both
|
$a = $c.$v; // both
|
||||||
$random = '';
|
$random = '';
|
||||||
for ($j = 0; $j < 2; $j++) {
|
for ($j = 0; $j < 2; $j++) {
|
||||||
$random .= $c[rand(0, strlen($c) - 1)];
|
$random .= $c[rand(0, strlen($c) - 1)];
|
||||||
$random .= $v[rand(0, strlen($v) - 1)];
|
$random .= $v[rand(0, strlen($v) - 1)];
|
||||||
$random .= $a[rand(0, strlen($a) - 1)];
|
$random .= $a[rand(0, strlen($a) - 1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $random;
|
return $random;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function generateRandomString($length = 10): string
|
private function generateRandomString($length = 10): string
|
||||||
{
|
{
|
||||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyz';
|
$characters = '0123456789abcdefghijklmnopqrstuvwxyz';
|
||||||
@@ -472,18 +510,17 @@ class Premium extends Model
|
|||||||
for ($i = 0; $i < $length; $i++) {
|
for ($i = 0; $i < $length; $i++) {
|
||||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $randomString;
|
return $randomString;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stats Handling Functions
|
* Stats Handling Functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
public static function incrementEmailIdsCreated($count = 1): void
|
public static function incrementEmailIdsCreated($count = 1): void
|
||||||
{
|
{
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
if (!$user) {
|
if (! $user) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -498,7 +535,7 @@ class Premium extends Model
|
|||||||
public static function incrementMessagesReceived($count = 1): void
|
public static function incrementMessagesReceived($count = 1): void
|
||||||
{
|
{
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
if (!$user) {
|
if (! $user) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -514,7 +551,7 @@ class Premium extends Model
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
if (!$user) {
|
if (! $user) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -525,9 +562,9 @@ class Premium extends Model
|
|||||||
);
|
);
|
||||||
|
|
||||||
$history = $usageLog->emails_created_history ?? [];
|
$history = $usageLog->emails_created_history ?? [];
|
||||||
if (!in_array($email, $history)) {
|
if (! in_array($email, $history)) {
|
||||||
$history[] = $email;
|
$history[] = $email;
|
||||||
//$usageLog->emails_created_count += 1;
|
// $usageLog->emails_created_count += 1;
|
||||||
$usageLog->emails_created_history = $history;
|
$usageLog->emails_created_history = $history;
|
||||||
$usageLog->save();
|
$usageLog->save();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ use Illuminate\Support\Facades\Validator;
|
|||||||
class RemoteEmail extends Model
|
class RemoteEmail extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
protected $table = 'emails';
|
protected $table = 'emails';
|
||||||
|
|
||||||
public function getConnectionName()
|
public function getConnectionName()
|
||||||
@@ -20,7 +21,6 @@ class RemoteEmail extends Model
|
|||||||
return 'mysql_remote';
|
return 'mysql_remote';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'message_id',
|
'message_id',
|
||||||
'subject',
|
'subject',
|
||||||
@@ -42,12 +42,13 @@ class RemoteEmail extends Model
|
|||||||
public static function fetchEmailFromDB($email)
|
public static function fetchEmailFromDB($email)
|
||||||
{
|
{
|
||||||
$validator = Validator::make(['email' => $email], [
|
$validator = Validator::make(['email' => $email], [
|
||||||
'email' => 'required|email'
|
'email' => 'required|email',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::whereJsonContains('to', $email)->orderBy('timestamp', 'desc')->get();
|
return self::whereJsonContains('to', $email)->orderBy('timestamp', 'desc')->get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ namespace App\Models;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
||||||
|
|
||||||
class Setting extends Model
|
class Setting extends Model
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Exception;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
@@ -13,7 +13,7 @@ class Ticket extends Model
|
|||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
protected $fillable = [
|
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()
|
protected static function boot()
|
||||||
@@ -22,7 +22,7 @@ class Ticket extends Model
|
|||||||
|
|
||||||
static::creating(function ($ticket) {
|
static::creating(function ($ticket) {
|
||||||
if (empty($ticket->ticket_id)) {
|
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;
|
return true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class TicketResponse extends Model
|
|||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'ticket_id', 'user_id', 'response', 'ip_address'
|
'ticket_id', 'user_id', 'response', 'ip_address',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function ticket()
|
public function ticket()
|
||||||
|
|||||||
@@ -2,18 +2,20 @@
|
|||||||
|
|
||||||
namespace App;
|
namespace App;
|
||||||
|
|
||||||
use Log;
|
|
||||||
use Http;
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use Http;
|
||||||
|
use Log;
|
||||||
|
|
||||||
trait NotifyMe
|
trait NotifyMe
|
||||||
{
|
{
|
||||||
function sendTelegramNotification($message) {
|
public function sendTelegramNotification($message)
|
||||||
|
{
|
||||||
$botToken = config('app.notify_tg_bot_token');
|
$botToken = config('app.notify_tg_bot_token');
|
||||||
$chatId = config('app.notify_tg_chat_id');
|
$chatId = config('app.notify_tg_chat_id');
|
||||||
|
|
||||||
if (!$botToken || !$chatId) {
|
if (! $botToken || ! $chatId) {
|
||||||
Log::error('Telegram bot token or chat ID not configured');
|
Log::error('Telegram bot token or chat ID not configured');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,14 +24,16 @@ trait NotifyMe
|
|||||||
$data = [
|
$data = [
|
||||||
'chat_id' => $chatId,
|
'chat_id' => $chatId,
|
||||||
'text' => $message,
|
'text' => $message,
|
||||||
'parse_mode' => 'HTML'
|
'parse_mode' => 'HTML',
|
||||||
];
|
];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$response = Http::post($url, $data);
|
$response = Http::post($url, $data);
|
||||||
|
|
||||||
return $response->successful();
|
return $response->successful();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Log::error('Failed to send Telegram notification: ' . $e->getMessage());
|
Log::error('Failed to send Telegram notification: '.$e->getMessage());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use Exception;
|
|
||||||
use App\Models\Blog;
|
use App\Models\Blog;
|
||||||
use App\Models\Menu;
|
use App\Models\Menu;
|
||||||
use App\Models\Plan;
|
use App\Models\Plan;
|
||||||
use DB;
|
use DB;
|
||||||
|
use Exception;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Laravel\Cashier\Cashier;
|
use Laravel\Cashier\Cashier;
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Providers\Filament;
|
namespace App\Providers\Filament;
|
||||||
|
|
||||||
use Filament\Pages\Dashboard;
|
|
||||||
use Filament\Http\Middleware\Authenticate;
|
use Filament\Http\Middleware\Authenticate;
|
||||||
use Filament\Http\Middleware\AuthenticateSession;
|
use Filament\Http\Middleware\AuthenticateSession;
|
||||||
use Filament\Http\Middleware\DisableBladeIconComponents;
|
use Filament\Http\Middleware\DisableBladeIconComponents;
|
||||||
use Filament\Http\Middleware\DispatchServingFilamentEvent;
|
use Filament\Http\Middleware\DispatchServingFilamentEvent;
|
||||||
use Filament\Pages;
|
use Filament\Pages\Dashboard;
|
||||||
use Filament\Panel;
|
use Filament\Panel;
|
||||||
use Filament\PanelProvider;
|
use Filament\PanelProvider;
|
||||||
use Filament\Support\Colors\Color;
|
use Filament\Support\Colors\Color;
|
||||||
@@ -39,8 +38,8 @@ class DashPanelProvider extends PanelProvider
|
|||||||
])
|
])
|
||||||
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
|
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
|
||||||
->widgets([
|
->widgets([
|
||||||
//Widgets\AccountWidget::class,
|
// Widgets\AccountWidget::class,
|
||||||
//Widgets\FilamentInfoWidget::class,
|
// Widgets\FilamentInfoWidget::class,
|
||||||
])
|
])
|
||||||
->middleware([
|
->middleware([
|
||||||
EncryptCookies::class,
|
EncryptCookies::class,
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Adjust this path if your file location is different
|
// Adjust this path if your file location is different
|
||||||
require __DIR__ . '/vendor/autoload.php';
|
require __DIR__.'/vendor/autoload.php';
|
||||||
|
|
||||||
// Bootstrap the Laravel application
|
// Bootstrap the Laravel application
|
||||||
$app = require_once __DIR__ . '/bootstrap/app.php';
|
$app = require_once __DIR__.'/bootstrap/app.php';
|
||||||
|
|
||||||
// Make the Console Kernel instance
|
// Make the Console Kernel instance
|
||||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||||
@@ -20,5 +20,5 @@ try {
|
|||||||
echo "Output:\n$output";
|
echo "Output:\n$output";
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
echo "Error running Artisan command: " . $e->getMessage();
|
echo 'Error running Artisan command: '.$e->getMessage();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Adjust this path if your file location is different
|
// Adjust this path if your file location is different
|
||||||
require __DIR__ . '/vendor/autoload.php';
|
require __DIR__.'/vendor/autoload.php';
|
||||||
|
|
||||||
// Bootstrap the Laravel application
|
// Bootstrap the Laravel application
|
||||||
$app = require_once __DIR__ . '/bootstrap/app.php';
|
$app = require_once __DIR__.'/bootstrap/app.php';
|
||||||
|
|
||||||
// Make the Console Kernel instance
|
// Make the Console Kernel instance
|
||||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||||
@@ -20,5 +20,5 @@ try {
|
|||||||
echo "Output:\n$output";
|
echo "Output:\n$output";
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
echo "Error running Artisan command: " . $e->getMessage();
|
echo 'Error running Artisan command: '.$e->getMessage();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ return [
|
|||||||
'db' => [
|
'db' => [
|
||||||
'with_params' => true, // Render SQL with the parameters substituted
|
'with_params' => true, // Render SQL with the parameters substituted
|
||||||
'exclude_paths' => [ // Paths to exclude entirely from the collector
|
'exclude_paths' => [ // Paths to exclude entirely from the collector
|
||||||
// 'vendor/laravel/framework/src/Illuminate/Session', // Exclude sessions queries
|
// '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)
|
'backtrace_exclude_paths' => [], // Paths to exclude from backtrace. (in addition to defaults)
|
||||||
@@ -243,7 +243,7 @@ return [
|
|||||||
'data' => false, // True for all data, 'keys' for only names, false for no parameters.
|
'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
|
'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
|
'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' => [
|
'route' => [
|
||||||
|
|||||||
@@ -37,6 +37,6 @@ return [
|
|||||||
'oxapay' => [
|
'oxapay' => [
|
||||||
'merchant_api_key' => env('OXAPAY_MERCHANT_API_KEY', ''),
|
'merchant_api_key' => env('OXAPAY_MERCHANT_API_KEY', ''),
|
||||||
'payout_api_key' => env('OXAPAY_PAYOUT_API_KEY', ''),
|
'payout_api_key' => env('OXAPAY_PAYOUT_API_KEY', ''),
|
||||||
]
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class RemoteEmailFactory extends Factory
|
|||||||
'from_name' => $this->faker->name(),
|
'from_name' => $this->faker->name(),
|
||||||
'from_email' => $this->faker->email(),
|
'from_email' => $this->faker->email(),
|
||||||
'to' => [$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(),
|
'body_text' => $this->faker->paragraph(),
|
||||||
'is_seen' => $this->faker->boolean(),
|
'is_seen' => $this->faker->boolean(),
|
||||||
'timestamp' => $this->faker->dateTime(),
|
'timestamp' => $this->faker->dateTime(),
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
Schema::table('plans', function (Blueprint $table) {
|
Schema::table('plans', function (Blueprint $table) {
|
||||||
$table->string('oxapay_link')->nullable()->after('accept_shoppy');
|
$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');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use App\Models\Meta;
|
use App\Models\Meta;
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
class MetaSeeder extends Seeder
|
class MetaSeeder extends Seeder
|
||||||
@@ -17,10 +16,10 @@ class MetaSeeder extends Seeder
|
|||||||
$metas->email_ids_created = 0;
|
$metas->email_ids_created = 0;
|
||||||
$metas->messages_received = 0;
|
$metas->messages_received = 0;
|
||||||
foreach ($metas as $key => $meta) {
|
foreach ($metas as $key => $meta) {
|
||||||
if (!Meta::where('key', $key)->exists()) {
|
if (! Meta::where('key', $key)->exists()) {
|
||||||
Meta::create([
|
Meta::create([
|
||||||
'key' => $key,
|
'key' => $key,
|
||||||
'value' => $meta
|
'value' => $meta,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use App\Models\Plan;
|
use App\Models\Plan;
|
||||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
class UpdatePlansTableSeeder extends Seeder
|
class UpdatePlansTableSeeder extends Seeder
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
function deleteFiles($dir) {
|
|
||||||
|
function deleteFiles($dir)
|
||||||
|
{
|
||||||
// Open the directory
|
// Open the directory
|
||||||
if ($handle = opendir($dir)) {
|
if ($handle = opendir($dir)) {
|
||||||
// Loop through each file in the directory
|
// Loop through each file in the directory
|
||||||
while (false !== ($file = readdir($handle))) {
|
while (false !== ($file = readdir($handle))) {
|
||||||
if ($file != "." && $file != "..") {
|
if ($file != '.' && $file != '..') {
|
||||||
$filePath = $dir . DIRECTORY_SEPARATOR . $file;
|
$filePath = $dir.DIRECTORY_SEPARATOR.$file;
|
||||||
// If it's a directory, recursively call deleteFiles
|
// If it's a directory, recursively call deleteFiles
|
||||||
if (is_dir($filePath)) {
|
if (is_dir($filePath)) {
|
||||||
deleteFiles($filePath);
|
deleteFiles($filePath);
|
||||||
@@ -38,4 +40,3 @@ if (is_dir($folderPath)) {
|
|||||||
} else {
|
} else {
|
||||||
echo "Folder '$folderPath' does not exist or is not a directory.";
|
echo "Folder '$folderPath' does not exist or is not a directory.";
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
function deleteFiles($dir) {
|
|
||||||
|
function deleteFiles($dir)
|
||||||
|
{
|
||||||
// Open the directory
|
// Open the directory
|
||||||
if ($handle = opendir($dir)) {
|
if ($handle = opendir($dir)) {
|
||||||
// Loop through each file in the directory
|
// Loop through each file in the directory
|
||||||
while (false !== ($file = readdir($handle))) {
|
while (false !== ($file = readdir($handle))) {
|
||||||
if ($file != "." && $file != "..") {
|
if ($file != '.' && $file != '..') {
|
||||||
$filePath = $dir . DIRECTORY_SEPARATOR . $file;
|
$filePath = $dir.DIRECTORY_SEPARATOR.$file;
|
||||||
// If it's a directory, recursively call deleteFiles
|
// If it's a directory, recursively call deleteFiles
|
||||||
if (is_dir($filePath)) {
|
if (is_dir($filePath)) {
|
||||||
deleteFiles($filePath);
|
deleteFiles($filePath);
|
||||||
@@ -38,4 +40,3 @@ if (is_dir($folderPath)) {
|
|||||||
} else {
|
} else {
|
||||||
echo "Folder '$folderPath' does not exist or is not a directory.";
|
echo "Folder '$folderPath' does not exist or is not a directory.";
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|||||||
23
dropmail.php
23
dropmail.php
@@ -1,8 +1,9 @@
|
|||||||
<?php
|
<?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
|
// 2. Start Laravel container
|
||||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||||
@@ -24,23 +25,23 @@ $password = $imapDB['password'];
|
|||||||
$inbox = imap_open($hostname, $username, $password);
|
$inbox = imap_open($hostname, $username, $password);
|
||||||
|
|
||||||
// Check for connection errors
|
// Check for connection errors
|
||||||
if (!$inbox) {
|
if (! $inbox) {
|
||||||
die('Could not connect to mailbox: ' . imap_last_error());
|
exit('Could not connect to mailbox: '.imap_last_error());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get current time in Unix timestamp
|
// Get current time in Unix timestamp
|
||||||
$current_time = time();
|
$current_time = time();
|
||||||
|
|
||||||
// Search for messages older than one day
|
// 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);
|
// $messages = imap_search($inbox, $search_criteria);
|
||||||
|
|
||||||
$messages = imap_search($inbox, 'ALL');
|
$messages = imap_search($inbox, 'ALL');
|
||||||
|
|
||||||
$batch_size = 10;
|
$batch_size = 10;
|
||||||
$deleted_count = 0;
|
$deleted_count = 0;
|
||||||
|
|
||||||
//if ($messages) {
|
// if ($messages) {
|
||||||
// $chunks = array_chunk($messages, $batch_size);
|
// $chunks = array_chunk($messages, $batch_size);
|
||||||
// foreach ($chunks as $chunk) {
|
// foreach ($chunks as $chunk) {
|
||||||
// foreach ($chunk as $message_number) {
|
// foreach ($chunk as $message_number) {
|
||||||
@@ -50,9 +51,9 @@ $deleted_count = 0;
|
|||||||
// $deleted_count += count($chunk);
|
// $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 {
|
// } else {
|
||||||
// echo 'No messages older than specified time found in mailbox.';
|
// echo 'No messages older than specified time found in mailbox.';
|
||||||
//}
|
// }
|
||||||
|
|
||||||
if ($messages) {
|
if ($messages) {
|
||||||
$chunks = array_chunk($messages, $batch_size);
|
$chunks = array_chunk($messages, $batch_size);
|
||||||
@@ -71,7 +72,7 @@ if ($messages) {
|
|||||||
}
|
}
|
||||||
imap_expunge($inbox);
|
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 {
|
} else {
|
||||||
echo 'No messages found in mailbox.';
|
echo 'No messages found in mailbox.';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
<?php
|
<?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
|
// 2. Start Laravel container
|
||||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||||
@@ -24,15 +25,15 @@ $password = $imapDB['premium_password'];
|
|||||||
$inbox = imap_open($hostname, $username, $password);
|
$inbox = imap_open($hostname, $username, $password);
|
||||||
|
|
||||||
// Check for connection errors
|
// Check for connection errors
|
||||||
if (!$inbox) {
|
if (! $inbox) {
|
||||||
die('Could not connect to mailbox: ' . imap_last_error());
|
exit('Could not connect to mailbox: '.imap_last_error());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get current time in Unix timestamp
|
// Get current time in Unix timestamp
|
||||||
$current_time = time();
|
$current_time = time();
|
||||||
|
|
||||||
// Search for messages older than one day
|
// 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);
|
$messages = imap_search($inbox, $search_criteria);
|
||||||
|
|
||||||
$batch_size = 10;
|
$batch_size = 10;
|
||||||
@@ -47,11 +48,10 @@ if ($messages) {
|
|||||||
imap_expunge($inbox);
|
imap_expunge($inbox);
|
||||||
$deleted_count += count($chunk);
|
$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 {
|
} else {
|
||||||
echo 'No messages older than specified time found in mailbox.';
|
echo 'No messages older than specified time found in mailbox.';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close mailbox connection
|
// Close mailbox connection
|
||||||
imap_close($inbox);
|
imap_close($inbox);
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Adjust this path if your file location is different
|
// Adjust this path if your file location is different
|
||||||
require __DIR__ . '/vendor/autoload.php';
|
require __DIR__.'/vendor/autoload.php';
|
||||||
|
|
||||||
// Bootstrap the Laravel application
|
// Bootstrap the Laravel application
|
||||||
$app = require_once __DIR__ . '/bootstrap/app.php';
|
$app = require_once __DIR__.'/bootstrap/app.php';
|
||||||
|
|
||||||
// Make the Console Kernel instance
|
// Make the Console Kernel instance
|
||||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||||
@@ -20,5 +20,5 @@ try {
|
|||||||
echo "Output:\n$output";
|
echo "Output:\n$output";
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
echo "Error running Artisan command: " . $e->getMessage();
|
echo 'Error running Artisan command: '.$e->getMessage();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Adjust this path if your file location is different
|
// Adjust this path if your file location is different
|
||||||
require __DIR__ . '/vendor/autoload.php';
|
require __DIR__.'/vendor/autoload.php';
|
||||||
|
|
||||||
// Bootstrap the Laravel application
|
// Bootstrap the Laravel application
|
||||||
$app = require_once __DIR__ . '/bootstrap/app.php';
|
$app = require_once __DIR__.'/bootstrap/app.php';
|
||||||
|
|
||||||
// Make the Console Kernel instance
|
// Make the Console Kernel instance
|
||||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||||
@@ -20,5 +20,5 @@ try {
|
|||||||
echo "Output:\n$output";
|
echo "Output:\n$output";
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
echo "Error running Artisan command: " . $e->getMessage();
|
echo 'Error running Artisan command: '.$e->getMessage();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,17 +9,17 @@ Artisan::command('inspire', function () {
|
|||||||
$this->comment(Inspiring::quote());
|
$this->comment(Inspiring::quote());
|
||||||
})->purpose('Display an inspiring quote');
|
})->purpose('Display an inspiring quote');
|
||||||
|
|
||||||
//Schedule::call(function () {
|
// Schedule::call(function () {
|
||||||
// Email::fetchProcessStoreEmail();
|
// Email::fetchProcessStoreEmail();
|
||||||
//})->everyMinute();
|
// })->everyMinute();
|
||||||
|
|
||||||
Schedule::call(function () {
|
Schedule::call(function () {
|
||||||
Email::deleteBulkAttachments();
|
Email::deleteBulkAttachments();
|
||||||
})->daily();
|
})->daily();
|
||||||
|
|
||||||
//Schedule::call(function () {
|
// Schedule::call(function () {
|
||||||
// Email::deleteBulkMailboxes();
|
// Email::deleteBulkMailboxes();
|
||||||
//})->everyMinute();
|
// })->everyMinute();
|
||||||
|
|
||||||
Schedule::call(function () {
|
Schedule::call(function () {
|
||||||
Email::deleteMessagesFromDB();
|
Email::deleteMessagesFromDB();
|
||||||
@@ -33,10 +33,10 @@ Schedule::call(function () {
|
|||||||
Email::cleanMailbox();
|
Email::cleanMailbox();
|
||||||
});
|
});
|
||||||
|
|
||||||
Artisan::command('cleanMail', function (){
|
Artisan::command('cleanMail', function () {
|
||||||
$this->comment(Email::cleanMailbox());
|
$this->comment(Email::cleanMailbox());
|
||||||
});
|
});
|
||||||
|
|
||||||
Artisan::command('closeTicket', function (){
|
Artisan::command('closeTicket', function () {
|
||||||
$this->comment(Ticket::autoClose());
|
$this->comment(Ticket::autoClose());
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ use App\Livewire\Frontend\Mailbox;
|
|||||||
use App\Livewire\Home;
|
use App\Livewire\Home;
|
||||||
use App\Livewire\ListBlog;
|
use App\Livewire\ListBlog;
|
||||||
use App\Livewire\Page;
|
use App\Livewire\Page;
|
||||||
|
|
||||||
use App\Livewire\Settings\Appearance;
|
use App\Livewire\Settings\Appearance;
|
||||||
use App\Livewire\Settings\Password;
|
use App\Livewire\Settings\Password;
|
||||||
use App\Livewire\Settings\Profile;
|
use App\Livewire\Settings\Profile;
|
||||||
@@ -45,6 +44,7 @@ Route::post('/sync', function (Request $request) {
|
|||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Log::error($e->getMessage());
|
\Log::error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->noContent();
|
return response()->noContent();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ Route::middleware(['auth', 'verified', CheckUserBanned::class])->group(function
|
|||||||
$validUser = 'admin';
|
$validUser = 'admin';
|
||||||
$validPass = 'admin@9608'; // 🔐 Change this to something secure
|
$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_USER'] !== $validUser ||
|
||||||
$_SERVER['PHP_AUTH_PW'] !== $validPass) {
|
$_SERVER['PHP_AUTH_PW'] !== $validPass) {
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@ Route::middleware(['auth', 'verified', CheckUserBanned::class])->group(function
|
|||||||
$validUser = 'admin';
|
$validUser = 'admin';
|
||||||
$validPass = 'admin@9608'; // 🔐 Change this to something secure
|
$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_USER'] !== $validUser ||
|
||||||
$_SERVER['PHP_AUTH_PW'] !== $validPass) {
|
$_SERVER['PHP_AUTH_PW'] !== $validPass) {
|
||||||
|
|
||||||
|
|||||||
@@ -79,13 +79,13 @@ trait LoadsApplicationData
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ensure we always have collections, even if cache is empty
|
// Ensure we always have collections, even if cache is empty
|
||||||
if (!($menus instanceof \Illuminate\Support\Collection)) {
|
if (! ($menus instanceof \Illuminate\Support\Collection)) {
|
||||||
$menus = collect();
|
$menus = collect();
|
||||||
}
|
}
|
||||||
if (!($blogs instanceof \Illuminate\Support\Collection)) {
|
if (! ($blogs instanceof \Illuminate\Support\Collection)) {
|
||||||
$blogs = collect();
|
$blogs = collect();
|
||||||
}
|
}
|
||||||
if (!($plans instanceof \Illuminate\Support\Collection)) {
|
if (! ($plans instanceof \Illuminate\Support\Collection)) {
|
||||||
$plans = collect();
|
$plans = collect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace Tests\Feature\Controllers;
|
namespace Tests\Feature\Controllers;
|
||||||
|
|
||||||
use App\Http\Controllers\WebhookController;
|
|
||||||
use Illuminate\Support\Facades\Config;
|
use Illuminate\Support\Facades\Config;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
@@ -263,7 +262,6 @@ class WebhookControllerTest extends TestCase
|
|||||||
'email' => 'test@example.com',
|
'email' => 'test@example.com',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
$response = $this->postJson('/webhook/oxapay', $invalidData);
|
$response = $this->postJson('/webhook/oxapay', $invalidData);
|
||||||
|
|
||||||
$response->assertStatus(400);
|
$response->assertStatus(400);
|
||||||
@@ -284,7 +282,6 @@ class WebhookControllerTest extends TestCase
|
|||||||
$validHmac = hash_hmac('sha512', $postData, $apiSecretKey);
|
$validHmac = hash_hmac('sha512', $postData, $apiSecretKey);
|
||||||
$invalidHmac = 'invalid_hmac';
|
$invalidHmac = 'invalid_hmac';
|
||||||
|
|
||||||
|
|
||||||
$response = $this->postJson('/webhook/oxapay', $validData, [
|
$response = $this->postJson('/webhook/oxapay', $validData, [
|
||||||
'HMAC' => $invalidHmac,
|
'HMAC' => $invalidHmac,
|
||||||
]);
|
]);
|
||||||
@@ -349,7 +346,6 @@ class WebhookControllerTest extends TestCase
|
|||||||
$invoicePostData = json_encode($invoiceData);
|
$invoicePostData = json_encode($invoiceData);
|
||||||
$invoiceHmac = hash_hmac('sha512', $invoicePostData, 'test_merchant_key');
|
$invoiceHmac = hash_hmac('sha512', $invoicePostData, 'test_merchant_key');
|
||||||
|
|
||||||
|
|
||||||
$response = $this->postJson('/webhook/oxapay', $invoiceData, [
|
$response = $this->postJson('/webhook/oxapay', $invoiceData, [
|
||||||
'HMAC' => $invoiceHmac,
|
'HMAC' => $invoiceHmac,
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace Tests\Feature;
|
namespace Tests\Feature;
|
||||||
|
|
||||||
use Tests\TestCase;
|
|
||||||
use Tests\Concerns\LoadsApplicationData;
|
use Tests\Concerns\LoadsApplicationData;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
class ExampleTest extends TestCase
|
class ExampleTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,11 +2,8 @@
|
|||||||
|
|
||||||
namespace Tests\Feature\Filament;
|
namespace Tests\Feature\Filament;
|
||||||
|
|
||||||
use App\Filament\Resources\BlogResource;
|
|
||||||
use App\Filament\Resources\BlogResource\Pages\CreateBlog;
|
use App\Filament\Resources\BlogResource\Pages\CreateBlog;
|
||||||
use App\Filament\Resources\PlanResource;
|
|
||||||
use App\Filament\Resources\PlanResource\Pages\CreatePlan;
|
use App\Filament\Resources\PlanResource\Pages\CreatePlan;
|
||||||
use App\Filament\Resources\TicketResource;
|
|
||||||
use App\Filament\Resources\TicketResource\Pages\CreateTicket;
|
use App\Filament\Resources\TicketResource\Pages\CreateTicket;
|
||||||
use App\Models\Blog;
|
use App\Models\Blog;
|
||||||
use App\Models\Category;
|
use App\Models\Category;
|
||||||
@@ -17,8 +14,8 @@ use App\Models\Ticket;
|
|||||||
use App\Models\TicketResponse;
|
use App\Models\TicketResponse;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Tests\TestCase;
|
|
||||||
use Livewire\Livewire;
|
use Livewire\Livewire;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
class ResourcesTest extends TestCase
|
class ResourcesTest extends TestCase
|
||||||
{
|
{
|
||||||
@@ -693,7 +690,6 @@ class ResourcesTest extends TestCase
|
|||||||
->assertHasFormErrors(['name', 'url']);
|
->assertHasFormErrors(['name', 'url']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** @test */
|
/** @test */
|
||||||
public function it_can_delete_menu_item()
|
public function it_can_delete_menu_item()
|
||||||
{
|
{
|
||||||
@@ -716,7 +712,6 @@ class ResourcesTest extends TestCase
|
|||||||
->assertCanSeeTableRecords([$menu2, $menu1], inOrder: true);
|
->assertCanSeeTableRecords([$menu2, $menu1], inOrder: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** @test */
|
/** @test */
|
||||||
public function it_can_handle_parent_child_relationships()
|
public function it_can_handle_parent_child_relationships()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,12 +7,10 @@ use App\Filament\Resources\UserResource\Pages\CreateUser;
|
|||||||
use App\Filament\Resources\UserResource\Pages\EditUser;
|
use App\Filament\Resources\UserResource\Pages\EditUser;
|
||||||
use App\Filament\Resources\UserResource\Pages\ListUsers;
|
use App\Filament\Resources\UserResource\Pages\ListUsers;
|
||||||
use App\Models\Log;
|
use App\Models\Log;
|
||||||
use App\Models\UsageLog;
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Illuminate\Support\Facades\Notification;
|
|
||||||
use Tests\TestCase;
|
|
||||||
use Livewire\Livewire;
|
use Livewire\Livewire;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
class UserResourceTest extends TestCase
|
class UserResourceTest extends TestCase
|
||||||
{
|
{
|
||||||
@@ -306,8 +304,6 @@ class UserResourceTest extends TestCase
|
|||||||
->assertTableBulkActionExists('updateLevel');
|
->assertTableBulkActionExists('updateLevel');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** @test */
|
/** @test */
|
||||||
public function it_searches_across_multiple_fields()
|
public function it_searches_across_multiple_fields()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class LoginTest extends TestCase
|
|||||||
public function it_handles_rate_limiting()
|
public function it_handles_rate_limiting()
|
||||||
{
|
{
|
||||||
// Clear any existing rate limit attempts
|
// Clear any existing rate limit attempts
|
||||||
RateLimiter::clear('login:' . request()->ip());
|
RateLimiter::clear('login:'.request()->ip());
|
||||||
|
|
||||||
// Exceed the rate limit (5 attempts by default)
|
// Exceed the rate limit (5 attempts by default)
|
||||||
for ($i = 0; $i < 6; $i++) {
|
for ($i = 0; $i < 6; $i++) {
|
||||||
@@ -124,7 +124,7 @@ class LoginTest extends TestCase
|
|||||||
public function it_handles_lockout_event()
|
public function it_handles_lockout_event()
|
||||||
{
|
{
|
||||||
// Clear any existing rate limit attempts
|
// Clear any existing rate limit attempts
|
||||||
RateLimiter::clear('login:' . request()->ip());
|
RateLimiter::clear('login:'.request()->ip());
|
||||||
|
|
||||||
// Exceed the rate limit to trigger lockout
|
// Exceed the rate limit to trigger lockout
|
||||||
for ($i = 0; $i < 6; $i++) {
|
for ($i = 0; $i < 6; $i++) {
|
||||||
|
|||||||
@@ -3,10 +3,8 @@
|
|||||||
namespace Tests\Unit\Models;
|
namespace Tests\Unit\Models;
|
||||||
|
|
||||||
use App\Models\Email;
|
use App\Models\Email;
|
||||||
use App\Models\RemoteEmail;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Support\Facades\Config;
|
use Illuminate\Support\Facades\Config;
|
||||||
use Illuminate\Support\Facades\File;
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class EmailTest extends TestCase
|
class EmailTest extends TestCase
|
||||||
@@ -91,7 +89,7 @@ class EmailTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @test */
|
/** @test */
|
||||||
public function it_validates_email_format_in_fetchEmailFromDB()
|
public function it_validates_email_format_in_fetch_email_from_db()
|
||||||
{
|
{
|
||||||
$result = Email::fetchEmailFromDB('invalid-email');
|
$result = Email::fetchEmailFromDB('invalid-email');
|
||||||
|
|
||||||
@@ -114,7 +112,7 @@ class EmailTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @test */
|
/** @test */
|
||||||
public function it_orders_emails_by_timestamp_descending_in_fetchEmailFromDB()
|
public function it_orders_emails_by_timestamp_descending_in_fetch_email_from_db()
|
||||||
{
|
{
|
||||||
$oldEmail = Email::factory()->create([
|
$oldEmail = Email::factory()->create([
|
||||||
'to' => ['test@example.com'],
|
'to' => ['test@example.com'],
|
||||||
|
|||||||
Reference in New Issue
Block a user