betalabs/engine-laravel-helper

Engine Laravel Helper provides essential functionalities to work with Engine apps on Laravel.

v4.0 2023-11-23 20:36 UTC

README

This package provides essential functionalities to work with Engine apps on Laravel.

Features

  • Passport configured by default
  • Tenant management
  • Application genesis process
  • App deploy command for deploy application

Requirements

  • PHP 7.1.3+
  • Laravel 5.6
  • Passport 6.0+

Installation

  1. Install the package via composer
$ composer require betalabs/engine-laravel-helper
  1. Import package files to your Laravel project
$ php artisan vendor:publish --provider="Betalabs\LaravelHelper\LaravelHelperServiceProvider"
  1. Register package routes to your RouteServiceProvider:
/**
 * Define the routes for the application.
 *
 * @return void
 */
public function map()
{
    $this->mapApiRoutes();

    $this->mapWebRoutes();

    \Betalabs\LaravelHelper\LaravelHelper::routes();
}
  1. Register Passport routes to your AuthServiceProvider:
/**
 * Register any authentication / authorization services.
 *
 * @return void
 */
public function boot()
{
    $this->registerPolicies();

    \Laravel\Passport\Passport::routes();
}
  1. In your config/auth.php configuration file, you should set the driver option of the api authentication guard to passport and the users provider model to our Tenant model. This will instruct your application to use Passport's TokenGuard when authenticating incoming API requests:
'guards' => [
    'api' => [
        'driver' => 'passport',
        'provider' => 'users',
    ],
],
'providers' => [
    'users' => [
        'driver' => 'eloquent',
        'model' => \Betalabs\LaravelHelper\Models\Tenant::class,
    ],
],
  1. And finally
$ php artisan app:deploy