The kpod history command displays information about the layers used to build the image. It provides information for the layers such as creation time, default command to use when running a container…
There are several default artisan commands that come with laravel, the common ones are php artisan serve
,php artisan migrate
, php artisan make:migration
and the likes of them.
The more an application grows the more important it becomes to automate certain tasks. If you are a junior developer or an intern that doesn’t have access to a server to run some certain commands like running a migration, you’ll have to buzz the devops engineer to help you run a migration (after your code has been reviewed and merged to the live branch tho ). Automating these tasks will go a long way to help you and the devops engineer. With that being said we’ll go over making a custom laravel artisan command to add data to the DB(Database) in the following steps.
Step 1: Install Laravel.
Step 2: Run php artisan make:command userData
.
Step 3: Create signature
and description
for your command in app/Console/Command
.
Step 4: Add your command logic in the handle()
function.
I’ll assume you have Laravel installed.
Open your terminal in your “project directory” and run the following command
php artisan make:command userData
.
This command creates a file in the app/Console/Commands
directory called userData.php
which looks like:
If you run php artisan list
in your terminal you will find out that our command does not exist yet, that's because it has not been registered. To register the command we'll navigate to app/Console
and open up the Kernel.php
file, we will then add this line of code Commands\userData::class
to the $commands
array defination. It should look like this:
So now if we run php artisan list
we should see our command signature and description:
If you got this response Users data added
. Can i get an Air five!!?.
This is a channel of versatile Hindi/Urdu Poetry and music of different types- Love, Devotional, Bhajans and Motivational song music and song lyrics. If you are a true lover of devotional music and…
Our resilience is often tested when life circumstances take an unexpected turn. Everyone possesses some degree of mental strength, however, we all react differently when life knocks us down. In some…
While choosing a mattress for tranquil comfort, deciding the thickness is an integral part of the process. The thickness of the mattress is directly related to your comfort level, if you choose a…