Laravel - Getting Started

Install Laravel

composer global require laravel/installer

Create a new Project

laravel new <blog>

or

laravel new <blog> --auth

- to include authentication

Install Authentication

composer require laravel/ui
php artisan ui vue --auth
npm install
npm run dev

If your application doesn’t need registration, you may disable it by removing the newly created RegisterController and modifying your route declaration:
For more info review authentication here

Auth::routes(['register' => false]);
extension=fileinfo

Create tables in config (not the database yet!) by creating a model. e.g. Lets create the model Ivruser- which should create the table endusers

php artisan make:model Ivruser -mc

-m = migration -c = controller

This create the table in migration config - e.g. <projectname>\database\migrations\ Edit the migration file <timestamp>_create_ivrusers_table.php example:

<?php
 
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
 
class CreateIvrusersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('ivrusers', function (Blueprint $table) {
            $table->id();
            $table->string('email')->unique();			
            $table->string('staffid')->unique();			
            $table->string('name');
            $table->string('pin');
            $table->string('mobile')->unique();			
            $table->timestamps();
        });
    }
 
    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('ivrusers');
    }
}

Then create the database tables using:

php artisan migrate

Rollback to drop your last migration table

php artisan migrate:rollback

The migrate:reset command will roll back all of your application's migrations:

php artisan migrate:reset

The migrate:fresh command will drop all tables from the database and then execute the migrate command:

php artisan migrate:fresh

The migrate:fresh command will drop all tables from the database and then execute the migrate command:

php artisan migrate:fresh --seed
/config/
/routes/web.php
/database/migrations
/resources/views
/app
/app/Http
/storage/logs/laravel.log
  • code/laravel/gettingstarted.txt
  • Last modified: 2020/04/18 18:47
  • by gerardorourke