This commit is contained in:
Saeed Vaziry
2025-02-20 18:00:13 +01:00
parent 8c7c3d2192
commit a1cf09e35d
20 changed files with 550 additions and 9 deletions

View File

@ -0,0 +1,32 @@
<?php
namespace App\Cli\Commands;
use App\Models\User;
use Illuminate\Console\Command;
use function Laravel\Prompts\error;
abstract class AbstractCommand extends Command
{
private User|null $user = null;
public function user()
{
if ($this->user) {
return $this->user->refresh();
}
/** @var User $user */
$user = User::query()->first();
if (!$user) {
error('The application is not setup');
exit(1);
}
$this->user = $user;
return $user;
}
}