The Blog

Laravel

Laravel

Laravel Artisan Generator Command: The make:migration Command

John Koster
John Koster
December 7, 2016

Learn how to use the make:migration command in Laravel to generate new migration classes for database changes. You can use options like --create to create a new table or --table to modify an existing one. By default, migrations are stored in the database/migrations directory, but you can specify a different directory using the --path option. The make:migration command allows you to easily manage your database changes and run them when needed.

Laravel

Laravel Artisan Generator Command: The make:model Command

John Koster
John Koster
December 7, 2016

The make:model command in Laravel generates new Eloquent model classes. You can provide a name for the model, and it will create a corresponding class and file in the app/ directory. You can also generate a migration file for the model using the --migration flag or -m shortcut. If a model with the same name already exists, it will not be overwritten and an error will be displayed. Namespaced classes can also be generated by separating namespace sections with \.

Laravel

Laravel Artisan Generator Command: The make:notification Command

John Koster
John Koster
December 7, 2016

The make:notification command helps generate a new notification class in Laravel. When using this command, a name must be provided, which will be the name of the newly created class. The command creates a new file at app/Notifications/StorageQuotaNotification.php and generates a class named StorageQuotaNotification. If the provided class name already exists, an error will be issued. The command can handle nested namespaces and directories as well.

Laravel

Laravel Artisan Generator Command: The make:policy Command

John Koster
John Koster
December 7, 2016

The make:policy command in Laravel is used to create policy classes. By providing a name, you can generate a new policy class, which will be stored in the app/Policies directory. The command can also generate namespaced classes by using the \ separator in the policy name. Existing policy classes with the same name will not be overwritten, and an error message will be displayed instead.

Laravel

Laravel Artisan Generator Command: The make:provider Command

John Koster
John Koster
December 7, 2016

The make:provider command in Laravel allows you to create new service providers for your application. By providing a name, a new service provider class and file will be generated and stored in the app/Providers directory. Existing service provider classes with the same name will not be overwritten. The command is also capable of generating namespaced classes by separating namespace sections using \ . A nested directory will be created and the correct namespace will be set on the generated class.

Laravel

Laravel Artisan Generator Command: The make:request Command

John Koster
John Koster
December 7, 2016

The make:request command in Laravel allows you to generate new request validation classes. You can specify a name for the class, which will be used as both the class name and the file name. The command also supports generating namespaced classes by using the \ separator when specifying the request name. If a request class with the same name already exists, an error will be displayed.

Laravel

Laravel Artisan Generator Command: The make:seeder Command

John Koster
John Koster
December 7, 2016

Learn how to generate new seed classes using the make:seeder command in Laravel. By providing a name argument, you can ensure that the generated file and class have the desired name. The generated seeder classes are stored in the database/seeds/ directory by default. If a seeder class with the same name already exists, you will receive an error message. To create a seeder class within nested directories, separate the directory sections using \ . Please note that seeder classes are not namespaced by default.

Laravel

Laravel Artisan Generator Command: The make:test Command

John Koster
John Koster
December 7, 2016

Learn how to quickly generate test files for your application using the make:test command in Laravel. This command allows you to create new test files and generated classes easily. The generated tests are stored in the tests/ directory by default and will not overwrite any existing test classes with the same name. You can also generate test classes within nested directories by separating directory sections using \ . Remember, test classes are not namespaced by default.

Laravel

Laravel Artisan: Interacting With Commands

John Koster
John Koster
December 7, 2016

Learn how to interact with Artisan console commands in Laravel. This article covers executing a command, entering data, and supplying array data. To execute a command, you need to invoke the Artisan console application by typing php artisan followed by the command name. You can also use shorthand commands and shortcuts. When entering data, make sure to enclose values with spaces in quotes. If a command requires multiple pieces of information stored in the same input argument, you can supply array data by separating values with spaces or by using the option name to preface the values.

Laravel

Laravel Artisan Key Command: The key:generate Command

John Koster
John Koster
December 7, 2016

The key:generate command generates a random key that is used for encryption in the application. The generated key can be updated in the application's environment file. There is also an option to simply display the generated key without updating any configuration files. Regenerating the encryption key is not recommended, but in some cases, it may be necessary to decrypt old data and reapply encryption with the new key.

Latest posts

That Escalated Quickly: All the New Things

The past six months or so have been incredibly busy. What started as a new article series about cust...

Read more
Troubleshooting a Statamic Illegal Offset Type Error when Viewing Collection Entries in the Control Panel

In this post I talk about how I resolved a mysterious illegal offset type error when viewing collect...

Read more
Creating Simple HTTP Redirect Routes from a Statamic Site

Generating a custom Laravel routes file from a Statamic website to redirect to a new domain.

Read more
Disabling Vite File Hashes

Disabling file hashes in Vite output can be accomplished by modifying your project's vite.config.js

Read more
Implementing a Custom Laravel Blade Precompiler for Volt and Livewire

Learn how to implement a custom component compiler for Laravel's Blade templating language in this p...

Read more
Creating a Hybrid Cache System for Statamic: Part Five

Part 5 of 6 covers implementing a cache namespace and labeling system, which we can use to target mu...

Read more