mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 00:02:15 +00:00
clear howdy file requests in demo account
This commit is contained in:
@@ -5,7 +5,7 @@ use Illuminate\Console\Scheduling\Schedule;
|
||||
use App\Console\Commands\SetupDevEnvironment;
|
||||
use App\Console\Commands\SetupProdEnvironment;
|
||||
use Support\Scheduler\Actions\ReportUsageAction;
|
||||
use Support\Demo\Actions\DeleteAllDemoSharedLinksAction;
|
||||
use Support\Demo\Actions\ClearHowdyDemoDataAction;
|
||||
use Support\Scheduler\Actions\DeleteFailedFilesAction;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
use Support\Scheduler\Actions\DeleteUnverifiedUsersAction;
|
||||
@@ -43,7 +43,7 @@ class Kernel extends ConsoleKernel
|
||||
|
||||
if (is_demo()) {
|
||||
$schedule->call(
|
||||
fn () => resolve(DeleteAllDemoSharedLinksAction::class)()
|
||||
fn () => resolve(ClearHowdyDemoDataAction::class)()
|
||||
)->daily()->at('00:00');
|
||||
}
|
||||
|
||||
|
||||
30
src/Support/Demo/Actions/ClearHowdyDemoDataAction.php
Normal file
30
src/Support/Demo/Actions/ClearHowdyDemoDataAction.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
namespace Support\Demo\Actions;
|
||||
|
||||
use DB;
|
||||
use App\Users\Models\User;
|
||||
use Domain\UploadRequest\Models\UploadRequest;
|
||||
|
||||
class ClearHowdyDemoDataAction
|
||||
{
|
||||
public function __invoke()
|
||||
{
|
||||
// Get howdy account
|
||||
$user = User::where('email', 'howdy@hi5ve.digital')
|
||||
->first();
|
||||
|
||||
// Delete howdy shared links
|
||||
DB::table('shares')
|
||||
->where('user_id', $user->id)
|
||||
->delete();
|
||||
|
||||
// Delete File request
|
||||
UploadRequest::where('user_id', $user->id)
|
||||
->cursor()
|
||||
->each(function ($request) {
|
||||
if ($request->created_at->diffInHours(now()) >= 6) {
|
||||
$request->delete();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
namespace Support\Demo\Actions;
|
||||
|
||||
use DB;
|
||||
use App\Users\Models\User;
|
||||
|
||||
class DeleteAllDemoSharedLinksAction
|
||||
{
|
||||
public function __invoke()
|
||||
{
|
||||
// Get howdy account
|
||||
$user = User::where('email', 'howdy@hi5ve.digital')
|
||||
->first();
|
||||
|
||||
// Delete howdy shared links
|
||||
DB::table('shares')
|
||||
->where('user_id', $user->id)
|
||||
->delete();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user