bondarde / laravel-toolbox
Collection of Laravel components and utilities
Requires
- php: ^8.2
- ext-json: *
- bondarde/php-utils: ^0.5.0
- deployer/deployer: ^7.0
- diglactic/laravel-breadcrumbs: ^9.0
- firebase/php-jwt: ^6.3
- jenssegers/agent: ^2.6
- laravel/fortify: ^1.10
- laravel/framework: ^11
- laravel/scout: ^10.2
- laravel/socialite: ^5.5
- livewire/livewire: ^3.0
- openai-php/laravel: ^0.10.0
- spatie/laravel-permission: ^6.0
- spatie/laravel-translatable: ^6.5
- teamtnt/laravel-scout-tntsearch-driver: ^14.0
- tinymce/tinymce: ^7.0
- tweeb/tinymce-i18n: ^2.0
Requires (Dev)
- fakerphp/faker: ^1.23
- laravel/pint: ^1.14
- laravel/sail: ^1.29
- mockery/mockery: ^1.6
- nunomaduro/collision: ^8.0
- orchestra/testbench: ^9.0
- phpunit/phpunit: ^10.0
- spatie/laravel-ignition: ^2.4
- spatie/laravel-ray: ^1.35
- dev-main
- v2.18.1
- v2.18.0
- v2.17.0
- v2.16.7
- v2.16.6
- v2.16.5
- v2.16.4
- v2.16.3
- v2.16.2
- v2.16.1
- v2.16.0
- v2.15.3
- v2.15.2
- v2.15.1
- v2.15.0
- v2.14.1
- v2.14.0
- v2.13.0
- v2.12.4
- v2.12.3
- v2.12.2
- v2.12.1
- v2.12.0
- v2.11.3
- v2.11.2
- v2.11.1
- v2.11.0
- v2.10.0
- v2.9.1
- v2.9.0
- v2.8.0
- v2.7.3
- v2.7.2
- v2.7.1
- v2.7.0
- v2.6.1
- v2.6.0
- v2.5.0
- v2.4.11
- v2.4.10
- v2.4.9
- v2.4.8
- v2.4.7
- v2.4.6
- v2.4.5
- v2.4.4
- v2.4.3
- v2.4.2
- v2.4.1
- v2.4.0
- v2.3.1
- v2.3.0
- v2.2.9
- v2.2.8
- v2.2.7
- v2.2.6
- v2.2.5
- v2.2.4
- v2.2.3
- v2.2.2
- v2.2.1
- v2.2.0
- v2.1.7
- v2.1.6
- v2.1.5
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.17.10
- v1.17.9
- v1.17.8
- v1.17.7
- v1.17.6
- v1.17.5
- v1.17.4
- v1.17.3
- v1.17.2
- v1.17.1
- v1.17.0
- v1.16.5
- v1.16.4
- v1.16.3
- v1.16.2
- v1.16.1
- v1.16.0
- v1.15.0
- v1.14.7
- v1.14.6
- v1.14.5
- v1.14.4
- v1.14.3
- v1.14.2
- v1.14.1
- v1.14.0
- v1.13.1
- v1.13.0
- v1.12.0
- v1.11.1
- v1.11.0
- v1.10.1
- v1.10.0
- v1.9.0
- v1.8.2
- v1.8.1
- v1.8.0
- v1.7.3
- v1.7.2
- v1.7.1
- v1.7.0
- v1.6.1
- v1.6.0
- v1.5.2
- v1.5.1
- v1.5.0
- v1.4.0
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.1
- v1.0.0
- v0.55.1
- v0.55.0
- v0.54.16
- v0.54.15
- v0.54.14
- v0.54.13
- v0.54.12
- v0.54.11
- v0.54.10
- v0.54.9
- v0.54.8
- v0.54.7
- v0.54.6
- v0.54.5
- v0.54.4
- v0.54.3
- v0.54.2
- v0.54.1
- v0.54.0
- v0.53.16
- v0.53.15
- v0.53.14
- v0.53.13
- v0.53.12
- v0.53.11
- v0.53.10
- v0.53.9
- v0.53.8
- v0.53.7
- v0.53.6
- v0.53.5
- v0.53.4
- v0.53.3
- v0.52.2
- v0.52.1
- v0.52.0
- v0.51.4
- v0.51.3
- v0.51.2
- v0.51.1
- v0.51.0
- v0.50.4
- v0.50.3
- v0.50.2
- v0.50.1
- v0.50.0
- v0.49.1
- v0.49.0
- v0.48.3
- v0.48.2
- v0.48.1
- v0.48.0
- v0.47.2
- v0.47.1
- v0.47.0
- v0.46.1
- v0.46.0
- v0.45.1
- v0.45.0
- v0.44.0
- v0.43.0
- v0.42.0
- v0.41.0
- v0.40.0
- v0.39.0
- v0.38.1
- v0.38.0
- v0.37.3
- v0.37.2
- v0.37.1
- v0.37.0
- v0.36.0
- v0.35.0
- v0.34.0
- v0.33.1
- v0.33.0
- v0.32.0
- v0.31.0
- v0.30.1
- v0.30.0
- v0.29.0
- v0.28.0
- v0.27.1
- v0.27.0
- v0.26.0
- v0.25.0
- v0.24.0
- v0.23.1
- v0.23.0
- v0.22.3
- v0.22.2
- v0.22.1
- v0.22.0
- v0.21.0
- v0.20.0
- v0.19.0
- v0.18.4
- v0.18.3
- v0.18.2
- v0.18.1
- v0.18.0
- v0.17.1
- v0.17.0
- v0.16.2
- v0.16.1
- v0.16.0
- v0.15.0
- v0.14.0
- v0.13.0
- v0.12.1
- v0.12.0
- v0.11.1
- v0.11.0
- v0.10.0
- v0.9.2
- v0.9.1
- v0.9.0
- v0.8.0
- v0.7.1
- v0.7.0
- v0.6.0
- v0.5.0
- v0.4.0
- v0.3.0
- v0.2.0
- v0.1.1
- v0.1.0
This package is auto-updated.
Last update: 2024-08-27 12:30:33 UTC
README
Installation
composer require bondarde/lox
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider"
If needed, customize table names in config/permission.php
, e.g.:
'table_names' => [
'roles' => 'acl_roles',
'permissions' => 'acl_permissions',
'model_has_permissions' => 'acl_model_has_permissions',
'model_has_roles' => 'acl_model_has_roles',
'role_has_permissions' => 'acl_role_has_permissions',
],
Run migrations:
php artisan migrate
If needed, add middleware aliases to the app/Http/Kernel.php
file, in the $middlewareAliases
array:
protected $middlewareAliases = [
…
'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,
'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class,
'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class,
…
];
If needed, grant "super-admin" role all permissions in AuthServiceProvider
's boot()
method:
Gate::before(
fn($user, $ability) => $user->hasRole(AclSetupData::ROLE_SUPER_ADMIN) && $ability !== AclSetupData::PERMISSION_VIEW_MODEL_META_DATA
? true
: null
);
Create super-admin role and all configured roles/permissions:
php artisan acl:update-roles-and-permission
After signing up, assign admin group to (your) user by ID or e-mail address:
php artisan acl:make-super-admin 1
or:
php artisan acl:make-super-admin mail@example.com
Publish config:
php artisan vendor:publish --provider="BondarDe\Lox\LoxServiceProvider" --tag=config
This command also publishes:
package.json
postcss.config.json
tailwind.config.js
vite.config.js
Styles
Publish:
php artisan vendor:publish --provider="BondarDe\Lox\LoxServiceProvider" --tag=styles
Add them to your resources/scss/app.scss
:
@tailwind base;
@tailwind components;
@tailwind utilities;
@import 'lox/base';
@import 'lox/tools';
@import 'lox/boolean';
Tailwind config:
php artisan vendor:publish --provider="BondarDe\Lox\LoxServiceProvider" --tag=tailwind
Burger menu as Tailwind plugin:
php artisan vendor:publish --provider="BondarDe\Lox\LoxServiceProvider" --tag=tailwind-burger-menu
Laravel Vite & Tailwind CSS
package.json
:
{
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"autoprefixer": "^10.4.0",
"laravel-vite-plugin": "^0.5.2",
"postcss": "^8.4.4",
"sass": "^1.30.0",
"sass-loader": "^12.6.0",
"tailwindcss": "^3.2.0",
"vite": "^3.0.4"
}
}
Build and Deployment
Build for different stages:
composer/bin/dep build stage=test
composer/bin/dep deploy stage=test
For local OPCache reset, a call to http://127.0.0.1/opcache-reset.php
has to call PHP’s opcache_clear()
If not possible, add in deploy.php
:
set('opcache_reset_mode', 'remote');
User deployer
should be able to execute sudo
without password prompt for chmod
, chown
and chgrp
:
sudo visudo
deployer ALL=(ALL:ALL) NOPASSWD: /usr/bin/chmod *
deployer ALL=(ALL:ALL) NOPASSWD: /usr/bin/chown *
deployer ALL=(ALL:ALL) NOPASSWD: /usr/bin/chgrp *
Vite Builds
npm run vite
npm run vite build
Usage
Page structure:
<x-page
title="Page Title"
h1="Headline"
>
<p>Your page content, beautifully staged.</p>
</x-page>
For page component you have to create page header and footer:
php artisan make:component HtmlHeader
php artisan make:component PageHeader
php artisan make:component PageFooter
php artisan make:component AdminPage
Forms
<x-form-row
for="input-name"
>
...
</x-form-row>
Buttons
TBD
FortifyServiceProvider
Publish:
php artisan vendor:publish --provider="Laravel\Fortify\FortifyServiceProvider"
Add in boot()
:
Fortify::registerView(config('lox.views.auth.register'));
Fortify::loginView(config('lox.views.auth.login'));
Fortify::confirmPasswordView(config('lox.views.auth.confirm-password'));
Fortify::requestPasswordResetLinkView(config('lox.views.auth.forgot-password'));
Fortify::resetPasswordView(config('lox.views.auth.reset-password'));
Fortify::twoFactorChallengeView(config('lox.views.auth.two-factor-challenge'));
Fortify::verifyEmailView(config('lox.views.auth.verify-email'));
In config/app.php
add service provider:
\App\Providers\FortifyServiceProvider::class,
Database Session storage:
php artisan session:table
php artisan migrate
SSO
Add "sso"
to features
array in config/fortify.php
.
In config/fortify-options.php
, add SSO providers, e.g.:
return [
'sso' => [
'apple' => true,
'facebook' => true,
'twitter' => true,
],
];
For each provider, install Socialite Providers package:
composer require socialiteproviders/<provider>
Follow installation steps: https://socialiteproviders.com/