Artisan

Artisan

artisan help

“php artisan help” doesnt work on it’s own, it displays information an a given command but as mentioned for that you also need to provide the command you want help with. For example: “php artisan help make:model” or “php artisan help migrate” and so on.
It displays information on all the different variations of this command and what they do, so quite useful.

Bash
php artisan help (whichever command you want details on for example what they can do or what it does)

artisan tinker

php artisan tinker is a command line interface included with Laravel that allows you to interact with your application’s code and data directly from the command line. It’s essentially a REPL (read-eval-print loop) that allows you to execute PHP code within the context of your application.
An important thing to remember is that each tinker session has a memory, meaning that if you open a tinker session and change something it wont be applied / recognized in the current tinker session, so you have to close the current one with: “ctrl + c” and open a new one.

The command to access this is the following (command prompt):

Bash
php artisan tinker

artisan migrate

The command “php artisan migrate” is used to run / re-run the migration files in your project. The migration files hold the code on how to create the tables.
Here’s an example with “php artisan migrate“.

Bash
php artisan migrate

artisan seed

The “php artisan db:seed” command allows you to seed your database, meaning that it can create rows in a table or whatever you programmed it to do. This is often used with “php artisan migrate:fresh”.
Here’s an example with “php artisan db:seed“.

Bash
php artisan db:seed

artisan make

The “php artisan make” command as in the name makes you something, this can range from views to migrations to models and much more.
Here’s an example with “php artisan make:model“.

Bash
php artisan make

Here’s a list of all the different commands:

Bash
  make:cache-table          [cache:table] Create a migration for the cache database table
  make:cast                 Create a new custom Eloquent cast class
  make:channel              Create a new channel class
  make:class                Create a new class
  make:command              Create a new Artisan command
  make:component            Create a new view component class
  make:controller           Create a new controller class
  make:enum                 Create a new enum
  make:event                Create a new event class
  make:exception            Create a new custom exception class
  make:factory              Create a new model factory
  make:interface            Create a new interface
  make:job                  Create a new job class
  make:job-middleware       Create a new job middleware class
  make:listener             Create a new event listener class
  make:mail                 Create a new email class
  make:middleware           Create a new HTTP middleware class
  make:migration            Create a new migration file
  make:model                Create a new Eloquent model class
  make:notification         Create a new notification class
  make:notifications-table  [notifications:table] Create a migration for the notifications table
  make:observer             Create a new observer class
  make:policy               Create a new policy class
  make:provider             Create a new service provider class
  make:queue-batches-table  [queue:batches-table] Create a migration for the batches database table
  make:queue-failed-table   [queue:failed-table] Create a migration for the failed queue jobs database table
  make:queue-table          [queue:table] Create a migration for the queue jobs database table
  make:request              Create a new form request class
  make:resource             Create a new resource
  make:rule                 Create a new validation rule
  make:scope                Create a new scope class
  make:seeder               Create a new seeder class
  make:session-table        [session:table] Create a migration for the session database table
  make:test                 Create a new test class
  make:trait                Create a new trait
  make:view                 Create a new view

artisan vendor:publish

“php artisan vendor:publish” copies a package’s publishable files—such as config, views, assets, migrations—from the vendor/ directory into your app’s own folders (e.g., config/, resources/views/). That way you can modify them safely without them being overwritten on the next Composer update.
Here’s an example with “php artisan vendor:publish“

Bash
php artisan vendor:publish

Tags: