Compare commits
2 Commits
e9f75f1337
...
f50031393e
| Author | SHA1 | Date | |
|---|---|---|---|
| f50031393e | |||
| 497aa161a7 |
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Enums\AdminStatus;
|
||||
use App\Models\Admin;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class AdminGeneratorCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'app:admin-generator';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create default admin user';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
|
||||
Admin::create([
|
||||
'full_name' => 'مدیر سیستم',
|
||||
'username' => 'admin',
|
||||
'email' => 'admin@gmail.com',
|
||||
'mobile' => '09123456789',
|
||||
'password' => Hash::make('123456789'),
|
||||
'status' => AdminStatus::ENABLE,
|
||||
]);
|
||||
|
||||
$this->info('Admin created successfully.');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
function ActiveAdminSidebar(array $routes): string
|
||||
{
|
||||
$currentRouteName = Route::currentRouteName();
|
||||
|
||||
|
||||
if (in_array($currentRouteName, $routes)) {
|
||||
return 'active';
|
||||
}
|
||||
|
||||
// برای مسیرهایی که پیشوند دارند (مثلاً admin.tours.*)
|
||||
foreach ($routes as $route) {
|
||||
if ($currentRouteName && str_starts_with($currentRouteName, $route . '.')) {
|
||||
return 'active';
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
Reference in New Issue
Block a user