Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 1632 | Revision 1634 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

<?php

    namespace App\Console\Commands;

    use Illuminate\Console\Command;
    use App\Models\PriceAgency;

    class dump extends Command
    {
        /**
         * The name and signature of the console command.
         *
         * @var string
         */
        protected $signature = 'command:dump';

        /**
         * The console command description.
         *
         * @var string
         */
        protected $description = 'Erstellt CSV-Dateien für Preisagenturen';

        /**
         * Execute the console command.
         *
         * @return int
         */
        public function handle(): int
        {
            $agencies = PriceAgency::where( 'shop_id', $GLOBALS["INI"]["shops_ID"] )->where( "status", "1" )->get();
            foreach ( $agencies as $agency )
            {
                $this->info( $agency["name"] );
                if ( !$agency["config"] )
                {
                    $this->warn( "Agentur nicht komplett konfiguriert!" );
                    continue;
                }
                $configFile = storage_path( "config/" ) . $agency["config"];
                if ( file_exists( $configFile ) )
                {
                    require $configFile;
                }
                else
                {
                    $this->error( "Konfigdatei " . $configFile . " existiert nicht!" );
                }
            }
            return count( $agencies );
        }
    }