December 2017
Beginner to intermediate
376 pages
7h 53m
English
A schema is a blueprint for the structure of a database. For a relational database such as MySQL, the schema will organize data into tables and columns. In Laravel, schemas are declared by using the Schema facade's create method.
We'll now make a schema for a table to hold Vuebnb listings. The columns of the table will match the structure of our mock listing data. Note that we set a default false value for the amenities and allow the prices to have a NULL value. All other columns require a value.
The schema will go inside our migration's up method. We'll also fill out the down with a call to Schema::drop.
2017_06_20_133317_create_listings_table.php:
public function up() { Schema::create('listings', function (Blueprint $table) { $table ...
Read now
Unlock full access