Book Image

Mastering Laravel

By : Christopher Pecoraro
Book Image

Mastering Laravel

By: Christopher Pecoraro

Overview of this book

<p>PHP continues to revive and Laravel is at its forefront. Laravel follows modern PHP's object-oriented best practices and reduces time-to-market, enabling you to build robust web and API-driven mobile applications that can be automatically tested and deployed.</p> <p>With this book you will learn how to rapidly develop software applications using the Laravel 5 PHP framework.</p> <p>This book walks you through the creation of an application, starting with behavior-driven design of entities. You'll explore various aspects of modern software including the RESTful API, and will be introduced to command bus. Laravel's annotations package is also explained and demonstrated. Finally, the book closes with a demonstration of different ways to deploy and scale your applications.</p>
Table of Contents (17 chapters)
Mastering Laravel
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
3
Building Services, Commands, and Events
Index

Migration anatomy


Consider an example of one of the lines in the migration file; we can see that the table object is used in a chain of methods. The following line of the migration file sets up the state attributes in the location eloquent attribute in the locations table:

$table->smallInteger('state_id')->unsigned()->index('state_id');

List tables

Often, it is necessary to create or import a list of finite items that usually remain constant, such as cities, states, countries, and similar items. Let's call these list tables or lookup tables. In these tables, the ID should usually be positive. These lists may grow, but they usually will not have any data that is deleted or updated. The smallInteger type is used to keep the table small and also represent a value that belongs to a finite list, something that will not grow naturally. The next method, unsigned, states that the limit will be 65535. This value should be enough to represent most of the states, provinces, or similar types of...