Welcome Back. I am using latest version Laravel 5.4 for this post.
Before continue please check your are updated with your PHP version required for the running environment of Laravel.
And you have installed the Composer in your system.
You can check & verify your running environment from here.
If you are up to date with the minimum requirement than lets continue.
Open your terminal and type enter after below command :
composer create-project --prefer-dist laravel/laravel blog
Now wait for a moment. If you got any error during installation than terminal will warn you. Please Google the issue and resolve it. If you are still facing any issue for the same just comment below.If you installed the laravel successfully than in your system than lets move to next step.
There will be an new folder "blog" where you executed the above composer command.
Just move to the blog folder by tying :
cd blog/And start the application by typing
php artisan serveCopy the URL displayed in the terminal and past it in your browser. Now its time to make blog CMS admin panel in laravel.
For this post i am using Voyager.
Its pretty simple admin panel will all features you needs to manage a blogging application like Media Management , Roles Management, Categories Management etc. You can checkout Voyager's Youtube channel for all available functionality.
So lets create admin panel within 2 minutes by following below steps one by one :-
Step 1 :- Include the package by running below command
composer require tcg/voyager
Step 2 :- Create new database (i.e laravel) and define in your .env file
DB_HOST=localhost
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=secret
And update your App url in same env file
APP_URL=http://127.0.0.1:8000
Step 3 :-
Now you needs to add the Voyager service provider to the
config/app.php file in the providers array:Add below line in the array :-
// Package Service Providers
TCG\Voyager\VoyagerServiceProvider::class,
Step 4 :- Its all done. All you needs to run below final command to get everything. Below command will automatically create the tables in your laravel database with dummy content --
php artisan voyager:install --with-dummy
If you didn't got any error than enjoy other wise follow Step 5.
Step 5 :- If your MariaDB version is not up to date than you will got below SQL Error
[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter tableusersadd uniqueusers_email_unique(
[PDOException]
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
Don't worry. delete your laravel database from MySQL and create a fresh database "lavavel" again and edit your AppServiceProvider.php file located at
app/Providers/Add below two line in the file.
use Illuminate\Support\Facades\Schema;
And in boot() function
Schema::defaultStringLength(191);
Final AppServiceProvider.php will look like below :-
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
class AppServiceProvider extends ServiceProvider{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot() {
Schema::defaultStringLength(191);
}
/**/**
* Bootstrap any application services.
*
* @return void
*/
public function boot() {
Schema::defaultStringLength(191);
}
* Register any application services.
*
* @return void
*/
public function register() {
}
}
?>
Now run the last command again in terminal :-
php artisan voyager:install --with-dummy
All done. Now open your browser and access the admin by adding /admin in the url.
http://localhost:8000/admin
Default Login is :-
admin@admin.com/password
You can checkout Docs for additional details and functionality to explore your admin panel.
Thanks to be here.
Good Bye :)
Comments
Post a Comment