core-logo

CoreUI Laravel Admin Template

On this page:



CoreUI Laravel & Bootstrap admin dashboard delivers a bunch of responsive, customizable, and reusable components you need to create modern, beautiful, responsive apps.

Installation

# clone the repo
$ git clone https://github.com/coreui/coreui-free-laravel-admin-template.git my-project

# go into app's directory
$ cd my-project

# install app's dependencies
$ composer install

# install app's dependencies
$ npm install

# create database
$ touch database/database.sqlite

Copy file “.env.example”, and change its name to “.env”. Then in file “.env” replace this database configuration:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

To this:

* DB_CONNECTION=sqlite
* DB_DATABASE=/path_to_your_project/database/database.sqlite
# in your app directory
# generate laravel APP_KEY
$ php artisan key:generate

# run database migration and seed
$ php artisan migrate:refresh --seed

# generate mixing
$ npm run dev

# and repeat generate mixing
$ npm run dev

Usage

# start local server
$ php artisan serve

# test
$ php vendor/bin/phpunit

Open your browser with address: localhost:8000
Click “Notes” on topbar menu and log in with credentials:

This user has roles: user and admin * Role user is required for notes management. * Role admin is required for users management.


Instructions for CoreUI Free Laravel admin template only. Pro and Vue.js versions have separate instructions.

To add a link to the sidebar - modify seeds file: my-project/database/seeds/MenusTableSeeder.php

In run() function - add insertLink():

$id = $this->insertLink( $rolesString, $visibleName, $href, $iconString);
  • $rolesString - a string with list of user roles this menu element will be available, ex. "guest,user,admin"
  • $visibleName - a string caption visible in sidebar
  • $href - a href, ex. /homepage or http://example.com
  • $iconString - a string containing valid CoreUI Icon name (kebab-case), ex. cui-speedometer or cui-star

To add a title to the sidebar - use function insertTitle():

$id = $this->insertTitle( $rolesString, $title );
  • $rolesString - a string with list of user roles this menu element will be available, ex. "guest,user,admin"
  • $title - a string caption visible in sidebar

To add a dropdown menu to the sidebar - use function beginDropdown():

$id = $this->beginDropdown( $rolesString, $visibleName, $iconString);
  • $rolesString - a string with list of user roles this menu element will be available, ex. "guest,user,admin"
  • $visibleName - a string caption visible in sidebar
  • $iconString - a string containing valid CoreUI icon name (kebab-case). For example: cui-speedometer or cui-star

To end dropdown section - use function endDropdown().

To add link to dropdown call function insertLink() between function calls beginDropdown() and endDropdown(). Example:

$id = $this->beginDropdown('guest,user,admin', 'Some dropdown', 'cui-puzzle');
$id = $this->insertLink('guest,user,admin', 'Dropdown name', 'http://example.com');
$this->endDropdown();

IMPORTANT - At the end of run() function, call joinAllByTransaction() function:

$this->joinAllByTransaction();

Once done with seeds file edit, run:

$ php artisan migrate:refresh --seed
# This command also rollbacks database and migrates it again.