/laravel-starter-kit

Laravel 5.6~ Starter Kit Powered by VueJS + Material Design(Vuetify)

Primary LanguagePHP

Build Status

About Laravel Starter Kit

Laravel Starter Kit is based on Laravel 5.6 and VueJS + Material design(Vuetify).

Why?

So many starter kits out there but so bloated with features and sometimes an overkill. This tries to provide you the very basic that most of the application needs. In most cases, you only need this to go further with still full control on your foundation, no magic and extra complexities, just the right sugar.

NOTE: This starter app assumes you have a good fundamental knowledge with Laravel framework and vueJS. If you are new to this technologies then this app might not be for you. If you have good knowledge already with Laravel & VueJS then things here should be straight forward to you and you can easily expand the app to your needs.

Features

✔ User, Group & Permissions Management

✔ Uses the default Laravel Auth + some goodies to handle complex permissions. No worries of learning anything!

✔ Comes with File Manager Out of the box

✔ Easy to work with, no complex patterns & techniques

✔ Everything is explicitly defined so any developer can quickly dive in to the codes and start working with the starter kit

✔ Built in Material Design using Vuetify

✔ Single Page Admin Dashboard

Stack Info

  • Laravel v5.6
  • VueJS v3+
  • Vuetify(Material Design) v1.0.*

DOCUMENTATION

Requirements

  • Requirements are same with Laravel 5.5

Installation

  • Clone repository git clone https://github.com/darryldecode/laravel-starter-kit.git
  • cp .env.example .env Then open .env file and put necessary credentials. Make sure to put proper APP_URL because it will be use in file manager module.
  • composer install
  • php artisan key:generate
  • php artisan migrate
  • php artisan db:seed
  • php artisan storage:link
  • npm install

Compiling Assets

Then for development you can run npm run dev.

Or for monitor and automatically recompile npm run watch.

Or for recompile and minify npm run prod.

You are done! You can now login in your application using the following credentials:

User, Groups & Permissions

  • Get current logged in user or Get User
    • $User = \Auth::user()
    • $User = App\Components\User\Models\User::find($id)
  • Check if user belongs to a group
    • $User->inGroup($groupId|$groupName|$groupObject);
  • Check if user has given permission
    • $User->hasPermission('blog.create')
    • $User->hasAnyPermission(['blog.create','user.edit','etc'])
  • Check if user is a super user
    • $User->isSuperUser()
  • Get User's combined permissions. This will include permission acquired from its group and its specific given permissions:
    • $User->getCombinedPermissions()
  • Primarily, you can assign, re-assign or revoke permissions on a user & group using the backend UI. But you can also do that programmatically.
// Assign, Re-assign, revoke permission in a USER:

$User = App\Components\User\Models\User::find($id);

// using permission ID
$permissionID = 1 // the permission ID that you add/define on permissions
$permissionValue = 1 // values can be (1,0,-1) allow=1, inherit=0, deny=-1

$User->addPermission($permissionID,$permissionValue);

// using permission object
$permission = App\Components\User\Models\Permission::find($id); // the permission object
$permissionValue = 1 // values can be (1,0,-1) allow=1, inherit=0, deny=-1

$User->addPermission($permission,$permissionValue);

NOTE: if the permission is already exist on the user, it will just update the value.

// remove a permission
$User->removePermission($permissionID|$permissionObject);
  • We can also do the same in a Group
// Assign, Re-assign, revoke permission in a GROUP:

$Group = App\Components\User\Models\Group::find($id);

// using permission ID
$permissionID = 1 // the permission ID that you add/define on permissions
$permissionValue = 1 // values can be (1,-1) allow=1, deny=-1

$Group->addPermission($permissionID,$permissionValue);

// using permission object
$permission = App\Components\User\Models\Permission::find($id); // the permission object
$permissionValue = 1 // values can be (1,-1) allow=1, deny=-1

$Group->addPermission($permission,$permissionValue);

NOTE: if the permission is already exist on the group, it will just update the value.

// remove a permission
$Group->removePermission($permissionID|$permissionObject);

Adding Dashboard Menu

  • Please open config/menu.php and see 'menu' array.
  • To give a modern backend with a smooth navigation from page to page, I designed at as a hybrid single page app. The routing in the admin panel is powered by vueJS's vue-router, so you will need first define those routes on the vue-router and make it work then add that new route to config/menu.php to make it appear on menu.

Contributing

  • Only accepts patches, improvements & bug fixes.
  • For pull requests related to additional modules or features, it will be subject for discussion as this project is intended for a very lean starting point and avoids to be bloated.

Disclaimer

THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR, OR ANY OF THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.