Laravel first steps

•

Hello, this article is for beginners and will show basic functions.

Installation of Laravel

To begin with instalation we need composer. In console write the following.

composer create-project --prefer-dist laravel/laravel NameOfTheProject

What is artisan

Artisan is the name of the command-line interface included with Laravel. It provides a number of helpful commands for your use while developing your application. It is driven by the powerful Symfony Console component.

Helpful artisan commands

List of all available artisan commands

#php artisan list

Create basic login and registration views and routes

#php artisan make:auth

Create database tables from database migrations

#php artisan migrate

Create controller

#php artisan make:controller PagesController

Create controller. The controller will contain a method for each of the available resource operations. (CRUD)

#php artisan make:controller PagesController --resource

Create model (-m is for migration creation)

#php artisan make:model Page -m

Create only a migration

#php artisan make:migration add_user_id_to_posts

List of all declared routes

#php artisan route:list

To register a resourceful route to the controller place this in your router.

Route::resource('pages', 'PagesController ');

Create a symbolic link from “public/storage” to “storage/app/public” vendor

#php artisan storage:link

Installing WYSIWYG editor

Set up package:

#composer require unisharp/laravel-ckeditor

Add ServiceProvider:
Edit config/app.php, add the following file to Application Service Providers section.

Unisharp\Ckeditor\ServiceProvider::class,

Publish the resources:

#php artisan vendor:publish --tag=ckeditor

Usage:
Default way (initiate by name or id) :

    
    

SASS Compiling

To compile SASS files you need to install npm online repository.

#npm install
#npm run dev //compile once
#npm run watch //real time compiling

Leave a Reply

Your email address will not be published. Required fields are marked *