![]() The first command will create two files (, ) on the public/css directory.īecause we used the -comments and -concat flags, we’re going to get a file called containing the two files with comments left. Php artisan cssmin 'public/css' 'public/css/style.css' 'public/css/responsive.css' -comments -concat php artisan cssmin 'public/css' 'public/css/style.css' 'public/css/responsive.css' To test our command, we’re going to copy some css files into our public/css directory, and then run the command. $this -> call ( 'command:name', array ( 'argument' => 'foo', '-option' => 'bar' ) ) Tip: You can also run an external command using the call method. use Illuminate \Console \Command use Symfony \Component \Console \Input \InputOption use Symfony \Component \Console \Input \InputArgument class CssminCommand extends Command Now, to create our command we will use php artisan command:make CssMinCommand -command=cssminwhich will create a CssMinCommand.php file within our app/commands directory. in the command command:make, the make command is under the command namespace. ![]() -namespace: you can use this option to namespace your set of commands, e.g.-path: by default the commands are stored within the app/commands folder, however, you can change that with this option.-command: the name that should be typed to run the command. ![]() ![]() To create an artisan command, you can use the command:make command. ![]()
0 Comments
Leave a Reply. |