You will need php 7.1.x and composer 1.9.x (and a database, I'm using mysql/phpmyadmin/apache) to run the project. Dont forget to use the commands composer install
and npm i --save
.
git clone https://github.com/edn9/favbooks
After you clone, create a .env file based of .env.example, configure your database, generate key with:
php artisan key:generate
Then run the project with:
php artisan serve
Video sample:
Here's a list of useful commands to use. This is just a simple sketch of what to do if its your first time trying laravel, or if you forgot something.
After all the setup, to create a new laravel project you can use these two commands:
laravel new blog
OR
composer create-project --prefer-dist laravel/laravel blog "5.8.*"
And then you need to generate a key, before that you will not be able to run the server, so first you gotta create a .env file (you can just copy and paste the .env.example one and configure by yourself) and then:
php artisan key:generate
You can specify what version you want to use at the end. To run the server:
php artisan serve
First, when you create a new project, you need to migrate to your database:
php artisan migrate:refresh --seed
If you working with seed, dont forget to check the database/seeds/DatabaseSeeder.php file, you need to tell what you gonna run to 'feed' the DB.
php artisan make:seeder UsersTableSeeder
Generating Migrations table:
php artisan make:migration create_users_table
You need to create a model when you create a table:
php artisan make:model Books
php artisan make:controller ContactController --resource
Laravel resource routing assigns the typical "CRUD" routes to a controller with a single line of code.
So, I dont know why but sometimes you will have this bugs, so here's a list of the one's already solve:
SQLSTATE 42000: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes com PHP
- Go to the file app\Providers\AppServiceProvider.php
- Add namespace use Illuminate\Support\Facades\Schema;
- Inside boot add Schema::defaultStringLength(191);
use Illuminate\Support\Facades\Schema;
public function boot()
{
Schema::defaultStringLength(191);
}