Laravel Cheat Sheet Command Page

Create a New Project Laravel

composer create-project laravel/laravel folder_name

Model

Create  a New Model

php artisan make:model model_name

Controller

Create a New Controller

php artisan make:controller controller_name

Migration Script

Create a New Migration Script

php artisan make:migrate migration_script_name

How to Solve Laravel Error Message : SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘column_name’ in ‘field list’

This is an article where the focus is the error message triggered upon executing PHP Artisan Tinker to insert a new record into the table in the process of a development of a web-based application using Laravel as its main framework. The main error is shown in the following output :

Continue reading “How to Solve Laravel Error Message : SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘column_name’ in ‘field list’”

How to Solve Laravel Error Message : Call to undefined method stdClass::save()

This article is an article where the focus is about how to solve the error message on the development of a web-based application Project using Laravel as its PHP Framework. But the main point is on generating a new record which is going to be used as a data for testing without even inserting a record from a form or even using a specified query.

For an example, the new record generated below is using PHP Artisan Tinker. But in order to do that, the following prerequisite must be fulfilled :

  1. The direct connection to the database which is going to be used for data testing. The direct connection’s configuration in Laravel web-based application project is defined in a file named .env which is located in the root folder of Laravel web-based application project.
  2. The next is the model which is generated and one way to accomplish it by executing the command ‘php artisan make:model’.
  3. By generating the model, in this context it is the model which is associated with one certain table where it can be used as a proxy or a intermediate to fill or to insert a new record to the table.

The error specified is shown as follows :

Continue reading “How to Solve Laravel Error Message : Call to undefined method stdClass::save()”

How to Insert a New Record Using PHP Artisan Tinker in Laravel

This article is an article which is focusing on the writing for a specific subject specified in the title of this article. It is about how to insert a new record using PHP Artisan Tinker in Laravel. To simplify or to insert a new record in a simple way without having to connect to MySQL Database Server as long as the connection itself has been made from inside the Laravel web-based application project. Just execute the following command to start inserting a new record using PHP Artisan Tinker :

Continue reading “How to Insert a New Record Using PHP Artisan Tinker in Laravel”

How to solve Laravel Error Messsage rmdir(/tmp/php-xdg-runtime-dir-fallback-root): Directory not empty using PHP Artisan Tinker in Laravel

This is an article written for showing on how to solve an error message which is triggered in the development of a Laravel web-based application project. It is shown as follows :

root@hostname:/var/www/html/laravel# php artisan tinker

[ErrorException]
rmdir(/tmp/php-xdg-runtime-dir-fallback-root): Directory not empty

root@hostname:/var/www/html/laravel#

As shown in the above output command of the command ‘php artisan tinker’, it is generating an error message :

Continue reading “How to solve Laravel Error Messsage rmdir(/tmp/php-xdg-runtime-dir-fallback-root): Directory not empty using PHP Artisan Tinker in Laravel”

How to generate key in Laravel

This is an article which is specifically written to generate key used in a Laravel web-based application project. The key generated is very special for several features which is needed by the Laravel web-based application itself. It is important because the key is going to be used further for generating cookies and even password across the application. It is actually generated a 32-length of random string.

Actually, it is going to be automatically generated upon the creation of the Laravel web-based application using composer utility or command which is represented with ‘composer create-project laravel/laravel’ command.

The key generated by typing a command which is executed as follows :

Continue reading “How to generate key in Laravel”

How to execute only specific migration script file in Laravel

This is an article on how to execute only a specific migration script file as shown in the title of this article. The migration script file exist inside or it is stored in the Laravel web-based application project. Basically, executing the following command :

Continue reading “How to execute only specific migration script file in Laravel”