Created as a demo for conducting an online workshop for VESIT.
-
Install XAMPP.
-
Intall Composer. Put correct path for PHP during installation. The file php.exe is in php directory in the XAMPP installation folder.
-
Install Node.js along with npm.
-
In xampp/htdocs run command:
php artisan create-project laravel/laravel notes
- In xampp/apache/conf/extra add follwing lines to http-vhosts.conf file:
<VirtualHost *:80>
DocumentRoot "path/to/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "path/to/public/of/project"
ServerName notes.ves
</VirtualHost>
- Open Notepad as administrator and add follwing lines to hosts file in C:\Windows\System32\drivers\etc :
127.0.0.1 localhost
127.0.0.1 notes.ves
-
Install Git and Git Bash.
-
Inside your project directory, run the following commands in a bash shell:
composer require laravel/ui
composer require laravelcollective/html
php artisan ui bootstrap
npm install
npm run dev
- Create controller along with predefines routes:
php artisan make:controller NotesController --resource
- Add the follwing line in web.php file in routes directory.
Route::get('/', function () {
return view('home');
});
Route::resource('notes','NotesController');
- Check routes using:
php artisan route:list
- Create a database "notes" from PhpMyAdmin. Set MySQL database credentials in .env file. Make database model for notes using:
php artisan make:model Note -m
- Add following line to AppServiceProvider.php in app/Providers directory:
use Illuminate\Support\Facades\Schema;
- In the same file, add this line to boot() function:
Schema::defaultStringLength(191);
- Add all views and layouts (resources/views), controller functions (app/Http/Controllers/NotesController.php), model details (app/Note.php) and migrations (database/migrations/create_notes_table.php). Run the follwing command:
php artisan migrate
-
Download and add CKEditor files to your public folder. Refer this article.
-
We have already installed laravel collectives. Make changes to config/app.php as shown here.
-
Make sure that the Apache server and MySQL are running. The project site will be visible at http://notes.ves. This will be your local server, website won't be accessible via web.