Skip to content

santos-sabanari/laravel-foundation

Repository files navigation

Installation

Install the package via composer:

composer require santos-sabanari/laravel-foundation
php artisan laravel-foundation:install

Change to this code array in config/fortify.php

'username' => 'username',

Add this code to in Http/Kernel.php

// $middlewareGroups
'admin' => [
    'auth',
    'is_admin',
],

// $routeMiddleware
'is_admin' => \SantosSabanari\LaravelFoundation\Http\Middleware\AdminCheck::class,
'is_super_admin' => \SantosSabanari\LaravelFoundation\Http\Middleware\SuperAdminCheck::class,
'is_user' => \SantosSabanari\LaravelFoundation\Http\Middleware\UserCheck::class,
'type' => \SantosSabanari\LaravelFoundation\Http\Middleware\UserTypeCheck::class,
'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class,
'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,
'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class,

Add this code to App/Provider/EventServiceProvider

// load class
use SantosSabanari\LaravelFoundation\Listeners\RoleEventListener;
use SantosSabanari\LaravelFoundation\Listeners\UserEventListener;

// below $listen
protected $subscribe = [
    RoleEventListener::class,
    UserEventListener::class,
];

Set timezone and local for Indonesia (optional)

'timezone' => 'Asia/Jakarta',
'locale' => 'id',
'faker_locale' => 'id_ID',

Finaly, migrate the database

php artisan migrate

Don't forget to set schedule for backup server (app\Console\Kernel.php -> on 'schedule' function)

$schedule->command('backup:run')->daily()->at('02:00');

Set cron job for running every minute

* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

Usage

To publish package

php artisan vendor:publish --provider=SantosSabanari\LaravelFoundation\LaravelFoundationServiceProvider --tag=config
php artisan vendor:publish --provider=SantosSabanari\LaravelFoundation\LaravelFoundationServiceProvider --tag=public
php artisan vendor:publish --provider=SantosSabanari\LaravelFoundation\LaravelFoundationServiceProvider --tag=views
php artisan vendor:publish --provider=SantosSabanari\LaravelFoundation\LaravelFoundationServiceProvider --tag=database

To update published assets (delete old resources/views/vendor, public/vendor, and then copy the new one)

php artisan laravel-foundation:update

To create & delete master, use this command

php artisan laravel-foundation:master title-of-master field_1 field_2 field_3
php artisan laravel-foundation:delete-master title-of-master

To create & delete table (without controller, livewire, and view), use this command

php artisan laravel-foundation:table title-of-table field_1 field_2 field_3
php artisan laravel-foundation:delete-table title-of-table

To create & delete report (without model, migration), use this command

php artisan laravel-foundation:report title-of-report
php artisan laravel-foundation:delete-report title-of-report

Require Package

The require packages below has automatically installed when installing laravel foundation.

  1. Laravel Fortify
  2. Log Viewer by Arcanedev
  3. Laravel Activitylog by Spatie
  4. Laravel Permission by Spatie
  5. Laravel Backup by Spatie
  6. Laravel PWA by Silvio Leite

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.