TOPIC COLLECTION
Artisan.
A collection of 12 practical ideas to make everyday Laravel work a little smoother.
12 TIPS01Cache Laravel's Bootstrap Files During DeploymentFor production releases, run Laravel's optimize command to cache configuration, events, routes, and views togetherArtisan02Create Artisan Commands for Repeatable MaintenanceTurn recurring operational work into a command so it can be run manually, scheduled, logged, and reviewed like the rest of the applicationArtisan03Artisan Command ParametersWhen creating Artisan command, you can ask the input in variety of ways: $this- confirm() , $this- anticipate() , $this- choice() .Artisan04Execute a Closure After Command Runs without Errors or Has Any ErrorsWith Laravel scheduler you can execute a Closure when a command runs without errors with the onSuccess() method and also when a command has any errors with…Artisan05Run Artisan Commands on Specific EnvironmentsTake control of your Laravel scheduled commands. Run them on specific environments for ultimate flexibility.Artisan06Maintenance ModeIf you want to enable maintenance mode on your page, execute the down Artisan command: Then people would see default 503 status page.Artisan07Artisan Command HelpTo check the options of artisan command, Run artisan commands with --help flag. For example, php artisan make:model --help and see how many options you haveArtisan08Exact Laravel VersionFind out exactly what Laravel version you have in your app, by running command php artisan --versionArtisan09Launch Artisan Command from AnywhereIf you have an Artisan command, you can launch it not only from Terminal, but also from anywhere in your code, with parameters. Use Artisan::call() methodArtisan10Hide Your Custom CommandIf you don't want to show a specific command on the artisan command list, set hidden property to trueArtisan11Skip MethodLaravel the skip method in scheduler You can use skip in your commands to skip an executionArtisan12Connect to Database Via CliTo get access to your database via CLI directly, you can run the following without any parametersArtisan