Skip to main content

Blog CMS Admin Panel Using Laravel within 10 minutes

Hey !!

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 serve


Copy 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 table users add unique users_email_unique(email))
[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);
     }
 /**
* 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

Popular posts from this blog

Getting Started With Python - for PHP developers

This blog is not specially for PHP developers. So don't worry if you are not from PHP Development Background. Recommended Reading - IBM - Python basics for PHP developers After reading above article i am assuming you already knows A) What is Python. B) How Python is different from PHP (If you are from PHP Background) C) Basic understanding for variables in Python. This Tutorial will cover Web Application Development using Python and  MySQL . Prerequisite  1. Install  MySQL   for database storage.  2. Install Python .  3. Install Django .    why Django ?   Yess right question.  Django is open source web framework which is most popular to create a web application in python language. No doubt you can start development by core python. But if you are going to develop a secure standard application than Django is a boiler plate to get started quickly. Except  Django   there are also some python w...