Skip to content

Latest commit

 

History

History
41 lines (32 loc) · 1.2 KB

README.md

File metadata and controls

41 lines (32 loc) · 1.2 KB

💡 Purpose

This package permit to check user permissions, managed by spatie/laravel-permission package, directly from JS.

🚀 Installation

  • First of all, you can install the package using composer

    composer require tiaxter/laravel-permission-js
  • This step can be skipper if auto-discovery is enabled

    Add package service provider into config/app.php file

    'providers' => [
          ..., 
          Tiaxter\LaravelPermissionJs\LaravelPermissionJsServiceProvider::class
    ];

🔰 Getting started

First of all you have to include this Blade Directive inside the page where you want to use this package

@permissions

💻 Basic usage

  • If you're using TypeScript you will need to add this line at start of your script:
    declare function can(permissionName: string): bool

Checking logged in user permission

    const canUserDoSomething = can('permission name here'); // true or false

🎨 Credits