The Blog

Laravel

Laravel

Laravel Artisan Tinker: The buffer Command

John Koster
John Koster
December 7, 2016

The buffer command in JavaScript is useful for viewing the contents of a multi-line expression without interrupting the input process. It allows you to easily check what you have typed so far. You can also use the --clear option to clear the current buffer if needed. Check out the example session provided to see how it works.

Laravel

Laravel Artisan Tinker: The clear-compiled Command

John Koster
John Koster
December 7, 2016

Learn how to clear the compiled classes and services application cache with the clear-compiled command. This command will remove the compiled.php and services.php files located in bootstrap/cache/ directory. It's equivalent to the php artisan clear:compiled command.

Laravel

Laravel Artisan Tinker: The doc Command

John Koster
John Koster
December 7, 2016

The doc command in Laravel allows you to view the documentation for various objects, classes, constants, methods, functions, and properties. It accepts the name or reference to the item as its argument. This command is particularly helpful due to Laravel's extensive code documentation. For example, you can easily access the documentation for the config helper function or the $table property on an Eloquent model using doc.

Laravel

Laravel Artisan Tinker: The down Command

John Koster
John Koster
December 7, 2016

Learn how to put your application into maintenance mode using the down command. By creating a file named down in the framework storage path, you can ensure your application is temporarily unavailable. Discover how this command parallels the php artisan down command.

Laravel

Laravel Artisan Tinker: The dump Command

John Koster
John Koster
December 7, 2016

The dump command in Laravel's Tinker REPL is used to display information about a variable or class instance in the console window. It utilizes Symfony's VarDumper console component. The dd helper function is also available in Tinker, providing useful output in the context of a Laravel application.

Laravel

Laravel Artisan Tinker: The env Command

John Koster
John Koster
December 7, 2016

Learn how to use the env command in Laravel to retrieve the name of the current framework environment. The environment name is specified in the .env file and can be accessed using the APP_ENV entry. This command is similar to php artisan env.

Laravel

Laravel Artisan Tinker: The history Command

John Koster
John Koster
December 7, 2016

Learn how to use the history command in the Tinker REPL session to retrieve previously entered commands. With its options, you can easily search, replay, and even save commands to a file. Check out this example session and explore the various options available to streamline your workflow.

Laravel

Laravel Artisan Tinker: The ls Command

John Koster
John Koster
December 7, 2016

Learn how to use the ls command to obtain information about variables, constants, functions, classes, interfaces, traits, properties, and methods in PHP. Discover how to use the ls command without any options to list defined variables in the current scope. Understand that the ls command can be used to inspect object instances to learn about their properties and methods. Find out that using the ls command with non-object types will result in an error. Explore an example using the ls command on an Eloquent model instance to display class constants, properties, and methods. Discover that the ls command offers various options and filters to narrow down the output, such as viewing only properties of an Eloquent model.

Laravel

Laravel Artisan Tinker: The migrate Command

John Koster
John Koster
December 7, 2016

Learn how to use the migrate command in Laravel to run migrations against the database. With options like --database to specify the database connection, --force to run migrations in a production environment, and --pretend to display SQL queries instead of running migrations, this command provides flexibility. Additionally, you can use flags like --seed to execute the db:seed command after running migrations and --step to increment the migration's batch number for rollback purposes.

Laravel

Laravel Artisan Tinker: The optimize Command

John Koster
John Koster
December 7, 2016

Learn how to use the optimize command in Laravel to improve the performance of your application. This command offers two flags: --force to write the compiled class file, and --psr to disable the optimized class map loader. The compiled files cache is stored in bootstrap/cache/compiled.php. Find out how to implement these options in your development environment and increase the efficiency of your Laravel application.

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