����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/././././././public_html/common/Generators/Policy/  | 
Upload File :  | 
<?php
namespace Common\Generators\Policy;
use Illuminate\Foundation\Console\PolicyMakeCommand;
class GeneratePolicy extends PolicyMakeCommand
{
    public function handle()
    {
        if (parent::handle() !== false) {
            // auto-register policy
            $path = app_path('Providers/AuthServiceProvider.php');
            $model = str_replace('/', '\\', $this->option('model'));
            $policy = $this->getNameInput();
            // add policy to providers
            $marker = "'App\\Model' => 'App\\Policies\\ModelPolicy',";
            file_put_contents($path, str_replace(
                $marker,
                "$marker\n        {$model}::class => $policy::class,",
                file_get_contents($path)
            ));
            // import policy and model
            $marker = 'use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;';
            $namespaceModel = $this->laravel->getNamespace().$model;
            $namespacePolicy = $this->qualifyClass($policy);
            file_put_contents($path, str_replace(
                $marker,
                "use {$namespaceModel};\nuse {$namespacePolicy};\n$marker",
                file_get_contents($path)
            ));
        }
    }
    protected function getStub()
    {
        if ($this->option('model')) {
            return __DIR__.'/stubs/policy.model.stub';
        }
        return parent::getStub();
    }
}