Laravel how to create table and column

in #dlive6 years ago

Thumbnail

Of this video i show you how to create database with tables and columns
First step in your project you must open file .env in him you must write:
name database username and password on your db
The next step in folder app/Providers/AppServiceProvider.php
Add in function boot this line code:
Schema::defaultStringLength(191);
and import Schema like in my video
The next step in localhost/phpmyadmin you must create name database like you add in laravel.
Now open your console ang go to your project laravel and write this command:
php artisan migrate this command create your tables with columns like you have in you file in
database/migrations just open someone file and you see your structure table with columns
If you want add new table its a very simple method
in console write this command: php artisan make:migration company
And write the same data what its exists in other file of this folder example:
Schema::create('company', function (Blueprint $table) {
$table->increments('id_company');
$table->string('nazwa_firmy');
$table->integer('regon');
$table->string('city');
$table->date('date_of_birth');
$table->timestamps();
});
in function up
and function down write this
Schema::dropIfExists('company');
And well now open your console and write this commands:
php artisan migrate:reset
and
php artisan migrate
Now you can create your database with table and columns to your projects i hope i help you please for comment and upvote sya.

My video is at DLive

Coin Marketplace

STEEM 0.30
TRX 0.11
JST 0.033
BTC 64320.07
ETH 3154.23
USDT 1.00
SBD 4.34