Laravel: Difference between revisions
Content added Content deleted
Line 36: | Line 36: | ||
sudo service apache2 restart |
sudo service apache2 restart |
||
= |
= Auth = |
||
Enable Authentication |
Enable Authentication |
||
php artisan make:auth |
php artisan make:auth |
||
DB access denied error: |
|||
=DB access= |
|||
.env |
.env |
||
Line 54: | Line 55: | ||
grant all privileges on homestead.* to homestead@localhost identified by 'secret'; |
grant all privileges on homestead.* to homestead@localhost identified by 'secret'; |
||
=Site Creation= |
|||
{{UC}} |
|||
php artisan make:migration create_links_table --create=blog |
|||
cd database/migrations/ |
|||
sudo nano 2017_08_31_184008_create_links_table.php |
|||
Schema::create('blog', function (Blueprint $table) { |
|||
$table->increments('id'); |
|||
$table->string('title'); |
|||
$table->string('url’)->unique(); |
|||
$table->text('description'); |
|||
$table->timestamps(); |
|||
}); |
Revision as of 01:16, 20 September 2017
Installation
sudo apt install composer
Creating a project named 'code':
composer create-project --prefer-dist laravel/laravel code cp .env.example .env php artisan key:generate sudo chmod -R 777 storage/
Tesing output:
php artisan serve --host 0.0.0.0 --port 8082
Else
sudo nano /etc/apache2/sites-available/laravel.conf
<VirtualHost *:8082> ServerName localhost ServerAdmin webmaster@localhost DocumentRoot /var/www/html/code/public <Directory /var/www/html/code/public> AllowOverride All </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
sudo nano /etc/apache2/ports.conf Listen 8082
sudo a2ensite laravel.conf sudo service apache2 restart
Auth
Enable Authentication
php artisan make:auth
DB access
.env DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=homestead DB_USERNAME=homestead DB_PASSWORD=secret
create database homestead; grant all privileges on homestead.* to homestead@localhost identified by 'secret';