sinarajabpour1998 / lara-core
This package core features in laravel apps.
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:Blade
Type:laravel-package
Requires
- php: 7.1.*|7.2.*|7.3.*|7.4.*|8.*
- laravel/framework: 7.*|8.*
- santigarcor/laratrust: 6.*
- sinarajabpour1998/alpha-helper: 1.*
This package is auto-updated.
Last update: 2024-10-19 04:14:42 UTC
README
This package provides core features [access control list and user manager] for laravel apps.
Installation
Using Composer :
composer require sinarajabpour1998/lara-core
packagist : lara-core
ACL Usage
- Change the user modal namespace to laratrust config
(located in
/config/laratrust.php
) inuser_models
section :
'user_models' => [ 'users' => 'App\Models\User', ],
- Publish blade files
php artisan vendor:publish --tag=lara-core
** Please note if you already published the vendor, for updates you can run the following command :
php artisan vendor:publish --tag=lara-core --force
- Add the following tag in your sidebar layout :
<x-acl-menu></x-acl-menu>
or shorten tag :
<x-acl-menu />
Google Recaptcha usage
Set the values for google api in .env file:
GOOGLE_RECAPTCHA_SITE_KEY=
GOOGLE_RECAPTCHA_SECRET_KEY=
Add this tag in blade files:
<x-cutlet-recaptcha :has-error="$errors->has('g-recaptcha-response')"></x-cutlet-recaptcha>
Add the validation rule:
protected function validateLogin(Request $request)
{
$request->validate([
$this->username() => ['required', 'string'],
'password' => ['required', 'string'],
'g-recaptcha-response' => ['required', 'cutlet_recaptcha']
]);
}
Customize the language and validation message in config file:
return [
'language' => 'fa',
'site_key' => env('GOOGLE_RECAPTCAH_SITE_KEY'),
'secret_key' => env('GOOGLE_RECAPTCAH_SECRET_KEY'),
'message' => 'شما به عنوان ربات تشخیص داده شدهاید'
];
Config options
You can set custom permissions for each section of this package. make sure that you already specified permissions in a seeder.