samedi 28 juillet 2018

How to avoid duplicate content file_put_contents when creating a command in laravel

I am creating a command in laravel, where I copy my views correctly to the views folder, but it happens that I want to add some routes and I do it in the following way

file_put_contents(
       base_path('routes/web.php'),
       file_get_contents(__DIR__.'/stubs/make/routes.stub'),
       FILE_APPEND
);

I add the routes correctly but this is done every time I use the command php artisan make: micommand, is there any way to evaluate that if the routes already exist do not add them?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire