composer create-project --prefer-dist laravel/laravel test- then add
testfolder to virtualhost in order to run the application - installing UI package:
composer require laravel/ui - then add auth module:
php artisan ui vue --auth - before running migrate, go to app/Providers/AppServiceProvider.php and modify:
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
Schema::defaultStringLength(191);
}
}
- then run:
php artisan migrate - then install npm dependencies:
npm install - to compile assets run the command:
npm run dev
- In order to add new controller, run the following command:
php artisan make:controller ThoughtController --api - for making model:
php artisan make:model Thought -m - then migrate
php artisan migrate - then create a seeder:
php artisan make:seeder UsersTableSeeder - adding this code on UsersTableSeeder on run method:
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\User;
class UsersTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
User::create([
'name' => 'Juan',
'email' => 'hola@poasdfa.com',
'password' => bcrypt('asdfasdf')
]);
}
}
- then run
php artisan db:seed - clean cache
php artisan config:cache. - check routes with:
php artisan route:list