First commit
This commit is contained in:
commit
7cf3558ba7
12933 changed files with 1180047 additions and 0 deletions
73
app/Console/Commands/GenerateDomainFavicons.php
Normal file
73
app/Console/Commands/GenerateDomainFavicons.php
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class GenerateDomainFavicons extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'domains:generate-favicons';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Generiere Favicons für alle konfigurierten Domains';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$domains = config('domains');
|
||||
$faviconDir = public_path('img/favicons');
|
||||
|
||||
// Erstelle das Favicon-Verzeichnis, wenn es nicht existiert
|
||||
if (! File::exists($faviconDir)) {
|
||||
File::makeDirectory($faviconDir, 0755, true);
|
||||
$this->info("Verzeichnis {$faviconDir} erstellt.");
|
||||
}
|
||||
|
||||
// Erstelle eine Liste der Themes, für die wir Favicons erstellen müssen
|
||||
$themes = [];
|
||||
|
||||
foreach ($domains as $domain => $config) {
|
||||
if (is_array($config) && isset($config['theme'])) {
|
||||
$themes[$config['theme']] = [
|
||||
'domain' => $domain,
|
||||
'name' => $config['name'] ?? 'Website',
|
||||
'color' => $config['color_scheme']['primary'] ?? '#000000',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// Erstelle die Favicons
|
||||
foreach ($themes as $theme => $data) {
|
||||
$faviconPath = "{$faviconDir}/{$theme}-favicon.ico";
|
||||
|
||||
// Wenn die Datei bereits existiert, frage, ob sie überschrieben werden soll
|
||||
if (File::exists($faviconPath) && ! $this->confirm("Favicon für '{$theme}' existiert bereits. Überschreiben?")) {
|
||||
$this->info("Favicon für '{$theme}' übersprungen.");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// Hier könntest du mit einer externen Bibliothek einen Favicon erstellen
|
||||
// Da dies aber komplex sein kann, erstellen wir erstmal nur Platzhalter-Dateien
|
||||
File::put($faviconPath, '');
|
||||
|
||||
$this->info("Platzhalter-Favicon für '{$theme}' erstellt: {$faviconPath}");
|
||||
$this->comment("Ersetze diese Datei mit einem echten Favicon für {$data['domain']} ({$data['name']})");
|
||||
}
|
||||
|
||||
$this->info('Favicons wurden erfolgreich erstellt!');
|
||||
$this->line('Denke daran, die Platzhalter-Dateien mit echten Favicons zu ersetzen.');
|
||||
}
|
||||
}
|
||||
36
app/Console/Kernel.php
Normal file
36
app/Console/Kernel.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* The Artisan commands provided by your application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $commands = [
|
||||
\App\Console\Commands\GenerateDomainFavicons::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*/
|
||||
protected function schedule(Schedule $schedule): void
|
||||
{
|
||||
// $schedule->command('inspire')->hourly();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the commands for the application.
|
||||
*/
|
||||
protected function commands(): void
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue