leave moudle setup
This commit is contained in:
parent
dfdc927a56
commit
5cc42edcba
@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
|
|
||||||
class Leave extends Model
|
class Leave extends Model
|
||||||
{
|
{
|
||||||
protected $table = 'tbl_leaves';
|
protected $table = 'leaves';
|
||||||
protected $guarded = [];
|
protected $guarded = [];
|
||||||
|
|
||||||
}
|
}
|
@ -7,6 +7,7 @@ use Illuminate\Support\ServiceProvider;
|
|||||||
use Modules\Leave\Repositories\LeaveInterface;
|
use Modules\Leave\Repositories\LeaveInterface;
|
||||||
use Modules\Leave\Repositories\LeaveRepository;
|
use Modules\Leave\Repositories\LeaveRepository;
|
||||||
|
|
||||||
|
|
||||||
class LeaveServiceProvider extends ServiceProvider
|
class LeaveServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
protected string $moduleName = 'Leave';
|
protected string $moduleName = 'Leave';
|
||||||
@ -59,7 +60,7 @@ class LeaveServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function registerTranslations(): void
|
public function registerTranslations(): void
|
||||||
{
|
{
|
||||||
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
|
$langPath = resource_path('lang/modules/'.$this->moduleNameLower);
|
||||||
|
|
||||||
if (is_dir($langPath)) {
|
if (is_dir($langPath)) {
|
||||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||||
@ -75,7 +76,7 @@ class LeaveServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
protected function registerConfig(): void
|
protected function registerConfig(): void
|
||||||
{
|
{
|
||||||
$this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower . '.php')], 'config');
|
$this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config');
|
||||||
$this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower);
|
$this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,14 +85,14 @@ class LeaveServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function registerViews(): void
|
public function registerViews(): void
|
||||||
{
|
{
|
||||||
$viewPath = resource_path('views/modules/' . $this->moduleNameLower);
|
$viewPath = resource_path('views/modules/'.$this->moduleNameLower);
|
||||||
$sourcePath = module_path($this->moduleName, 'resources/views');
|
$sourcePath = module_path($this->moduleName, 'resources/views');
|
||||||
|
|
||||||
$this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower . '-module-views']);
|
$this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']);
|
||||||
|
|
||||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||||
|
|
||||||
$componentNamespace = str_replace('/', '\\', config('modules.namespace') . '\\' . $this->moduleName . '\\' . ltrim(config('modules.paths.generator.component-class.path'), config('modules.paths.app_folder', '')));
|
$componentNamespace = str_replace('/', '\\', config('modules.namespace').'\\'.$this->moduleName.'\\'.ltrim(config('modules.paths.generator.component-class.path'), config('modules.paths.app_folder','')));
|
||||||
Blade::componentNamespace($componentNamespace, $this->moduleNameLower);
|
Blade::componentNamespace($componentNamespace, $this->moduleNameLower);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,8 +108,8 @@ class LeaveServiceProvider extends ServiceProvider
|
|||||||
{
|
{
|
||||||
$paths = [];
|
$paths = [];
|
||||||
foreach (config('view.paths') as $path) {
|
foreach (config('view.paths') as $path) {
|
||||||
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
|
if (is_dir($path.'/modules/'.$this->moduleNameLower)) {
|
||||||
$paths[] = $path . '/modules/' . $this->moduleNameLower;
|
$paths[] = $path.'/modules/'.$this->moduleNameLower;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
0
Modules/Leave/app/Repositories/.gitkeep
Normal file
0
Modules/Leave/app/Repositories/.gitkeep
Normal file
0
Modules/Leave/database/factories/.gitkeep
Normal file
0
Modules/Leave/database/factories/.gitkeep
Normal file
@ -29,8 +29,7 @@
|
|||||||
"psr-4": {
|
"psr-4": {
|
||||||
"App\\": "app/",
|
"App\\": "app/",
|
||||||
"Database\\Factories\\": "database/factories/",
|
"Database\\Factories\\": "database/factories/",
|
||||||
"Database\\Seeders\\": "database/seeders/",
|
"Database\\Seeders\\": "database/seeders/"
|
||||||
"Modules\\": "Modules/"
|
|
||||||
},
|
},
|
||||||
"files":[
|
"files":[
|
||||||
"app/Helpers/OMIS.php",
|
"app/Helpers/OMIS.php",
|
||||||
@ -64,6 +63,11 @@
|
|||||||
},
|
},
|
||||||
"laravel": {
|
"laravel": {
|
||||||
"dont-discover": []
|
"dont-discover": []
|
||||||
|
},
|
||||||
|
"merge-plugin": {
|
||||||
|
"include": [
|
||||||
|
"Modules/*/composer.json"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
|
2
composer.lock
generated
2
composer.lock
generated
@ -8865,5 +8865,5 @@
|
|||||||
"php": "^8.1"
|
"php": "^8.1"
|
||||||
},
|
},
|
||||||
"platform-dev": [],
|
"platform-dev": [],
|
||||||
"plugin-api-version": "2.6.0"
|
"plugin-api-version": "2.3.0"
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ return [
|
|||||||
|
|
|
|
||||||
| Default module namespace.
|
| Default module namespace.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'namespace' => 'Modules',
|
'namespace' => 'Modules',
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ return [
|
|||||||
|
|
|
|
||||||
| Default module stubs.
|
| Default module stubs.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'stubs' => [
|
'stubs' => [
|
||||||
'enabled' => false,
|
'enabled' => false,
|
||||||
@ -69,7 +69,7 @@ return [
|
|||||||
| This path is used to save the generated module.
|
| This path is used to save the generated module.
|
||||||
| This path will also be added automatically to the list of scanned folders.
|
| This path will also be added automatically to the list of scanned folders.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'modules' => base_path('Modules'),
|
'modules' => base_path('Modules'),
|
||||||
/*
|
/*
|
||||||
@ -79,7 +79,7 @@ return [
|
|||||||
|
|
|
|
||||||
| Here you may update the modules' assets path.
|
| Here you may update the modules' assets path.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'assets' => public_path('modules'),
|
'assets' => public_path('modules'),
|
||||||
/*
|
/*
|
||||||
@ -90,7 +90,7 @@ return [
|
|||||||
| Where you run the 'module:publish-migration' command, where do you publish the
|
| Where you run the 'module:publish-migration' command, where do you publish the
|
||||||
| the migration files?
|
| the migration files?
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'migration' => base_path('database/migrations'),
|
'migration' => base_path('database/migrations'),
|
||||||
|
|
||||||
@ -101,8 +101,8 @@ return [
|
|||||||
|
|
|
|
||||||
| app folder name
|
| app folder name
|
||||||
| for example can change it to 'src' or 'App'
|
| for example can change it to 'src' or 'App'
|
||||||
*/
|
*/
|
||||||
'app_folder' => '',
|
'app_folder' => 'app/',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -110,30 +110,30 @@ return [
|
|||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Customise the paths where the folders will be generated.
|
| Customise the paths where the folders will be generated.
|
||||||
| Setting the generate key to false will not generate that folder
|
| Setting the generate key to false will not generate that folder
|
||||||
*/
|
*/
|
||||||
'generator' => [
|
'generator' => [
|
||||||
//
|
// app/
|
||||||
'channels' => ['path' => 'Broadcasting', 'generate' => false],
|
'channels' => ['path' => 'app/Broadcasting', 'generate' => false],
|
||||||
'command' => ['path' => 'Console', 'generate' => false],
|
'command' => ['path' => 'app/Console', 'generate' => false],
|
||||||
'emails' => ['path' => 'Emails', 'generate' => false],
|
'emails' => ['path' => 'app/Emails', 'generate' => false],
|
||||||
'event' => ['path' => 'Events', 'generate' => false],
|
'event' => ['path' => 'app/Events', 'generate' => false],
|
||||||
'jobs' => ['path' => 'Jobs', 'generate' => false],
|
'jobs' => ['path' => 'app/Jobs', 'generate' => false],
|
||||||
'listener' => ['path' => 'Listeners', 'generate' => false],
|
'listener' => ['path' => 'app/Listeners', 'generate' => false],
|
||||||
'model' => ['path' => 'Models', 'generate' => true],
|
'model' => ['path' => 'app/Models', 'generate' => true],
|
||||||
'notifications' => ['path' => 'Notifications', 'generate' => false],
|
'notifications' => ['path' => 'app/Notifications', 'generate' => false],
|
||||||
'observer' => ['path' => 'Observers', 'generate' => false],
|
'observer' => ['path' => 'app/Observers', 'generate' => false],
|
||||||
'policies' => ['path' => 'Policies', 'generate' => false],
|
'policies' => ['path' => 'app/Policies', 'generate' => false],
|
||||||
'provider' => ['path' => 'Providers', 'generate' => true],
|
'provider' => ['path' => 'app/Providers', 'generate' => true],
|
||||||
'route-provider' => ['path' => 'Providers', 'generate' => true],
|
'route-provider' => ['path' => 'app/Providers', 'generate' => true],
|
||||||
'repository' => ['path' => 'Repositories', 'generate' => true],
|
'repository' => ['path' => 'app/Repositories', 'generate' => true],
|
||||||
'resource' => ['path' => 'Transformers', 'generate' => false],
|
'resource' => ['path' => 'app/Transformers', 'generate' => false],
|
||||||
'rules' => ['path' => 'Rules', 'generate' => false],
|
'rules' => ['path' => 'app/Rules', 'generate' => false],
|
||||||
'component-class' => ['path' => 'View/Components', 'generate' => false],
|
'component-class' => ['path' => 'app/View/Components', 'generate' => false],
|
||||||
|
|
||||||
// Http/
|
// app/Http/
|
||||||
'controller' => ['path' => 'Http/Controllers', 'generate' => true],
|
'controller' => ['path' => 'app/Http/Controllers', 'generate' => true],
|
||||||
'filter' => ['path' => 'Http/Middleware', 'generate' => false],
|
'filter' => ['path' => 'app/Http/Middleware', 'generate' => false],
|
||||||
'request' => ['path' => 'Http/Requests', 'generate' => false],
|
'request' => ['path' => 'app/Http/Requests', 'generate' => true],
|
||||||
|
|
||||||
// config/
|
// config/
|
||||||
'config' => ['path' => 'config', 'generate' => true],
|
'config' => ['path' => 'config', 'generate' => true],
|
||||||
@ -141,7 +141,7 @@ return [
|
|||||||
// database/
|
// database/
|
||||||
'migration' => ['path' => 'database/migrations', 'generate' => true],
|
'migration' => ['path' => 'database/migrations', 'generate' => true],
|
||||||
'seeder' => ['path' => 'database/seeders', 'generate' => true],
|
'seeder' => ['path' => 'database/seeders', 'generate' => true],
|
||||||
'factory' => ['path' => 'database/factories', 'generate' => false],
|
'factory' => ['path' => 'database/factories', 'generate' => true],
|
||||||
|
|
||||||
// lang/
|
// lang/
|
||||||
'lang' => ['path' => 'lang', 'generate' => false],
|
'lang' => ['path' => 'lang', 'generate' => false],
|
||||||
@ -168,7 +168,7 @@ return [
|
|||||||
| Here you can define which commands will be visible and used in your
|
| Here you can define which commands will be visible and used in your
|
||||||
| application. You can add your own commands to merge section.
|
| application. You can add your own commands to merge section.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
'commands' => ConsoleServiceProvider::defaultCommands()
|
'commands' => ConsoleServiceProvider::defaultCommands()
|
||||||
->merge([
|
->merge([
|
||||||
// New commands go here
|
// New commands go here
|
||||||
@ -182,7 +182,7 @@ return [
|
|||||||
| Here you define which folder will be scanned. By default will scan vendor
|
| Here you define which folder will be scanned. By default will scan vendor
|
||||||
| directory. This is useful if you host the package in packagist website.
|
| directory. This is useful if you host the package in packagist website.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'scan' => [
|
'scan' => [
|
||||||
'enabled' => false,
|
'enabled' => false,
|
||||||
@ -197,7 +197,7 @@ return [
|
|||||||
|
|
|
|
||||||
| Here is the config for the composer.json file, generated by this package
|
| Here is the config for the composer.json file, generated by this package
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'composer' => [
|
'composer' => [
|
||||||
'vendor' => env('MODULES_VENDOR', 'nwidart'),
|
'vendor' => env('MODULES_VENDOR', 'nwidart'),
|
||||||
@ -215,7 +215,7 @@ return [
|
|||||||
|
|
|
|
||||||
| Here is the config for setting up the caching feature.
|
| Here is the config for setting up the caching feature.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
'cache' => [
|
'cache' => [
|
||||||
'enabled' => false,
|
'enabled' => false,
|
||||||
'driver' => 'file',
|
'driver' => 'file',
|
||||||
@ -228,7 +228,7 @@ return [
|
|||||||
| Setting one to false will require you to register that part
|
| Setting one to false will require you to register that part
|
||||||
| in your own Service Provider class.
|
| in your own Service Provider class.
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
'register' => [
|
'register' => [
|
||||||
'translations' => true,
|
'translations' => true,
|
||||||
/**
|
/**
|
||||||
@ -245,7 +245,7 @@ return [
|
|||||||
| You can define new types of activators here, file, database, etc. The only
|
| You can define new types of activators here, file, database, etc. The only
|
||||||
| required parameter is 'class'.
|
| required parameter is 'class'.
|
||||||
| The file activator will store the activation status in storage/installed_modules
|
| The file activator will store the activation status in storage/installed_modules
|
||||||
*/
|
*/
|
||||||
'activators' => [
|
'activators' => [
|
||||||
'file' => [
|
'file' => [
|
||||||
'class' => FileActivator::class,
|
'class' => FileActivator::class,
|
||||||
|
@ -4,6 +4,7 @@ namespace Database\Seeders;
|
|||||||
|
|
||||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Spatie\Permission\Models\Permission;
|
use Spatie\Permission\Models\Permission;
|
||||||
use Spatie\Permission\Models\Role;
|
use Spatie\Permission\Models\Role;
|
||||||
|
|
||||||
@ -19,11 +20,15 @@ class DatabaseSeeder extends Seeder
|
|||||||
$admin = \App\Models\User::factory()->create([
|
$admin = \App\Models\User::factory()->create([
|
||||||
'name' => 'Admin User',
|
'name' => 'Admin User',
|
||||||
'email' => 'admin@gmail.com',
|
'email' => 'admin@gmail.com',
|
||||||
|
'password' => Hash::make('password'),
|
||||||
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$member = \App\Models\User::factory()->create([
|
$member = \App\Models\User::factory()->create([
|
||||||
'name' => 'Member User',
|
'name' => 'Member User',
|
||||||
'email' => 'member@gmail.com',
|
'email' => 'member@gmail.com',
|
||||||
|
'password' => Hash::make('password'),
|
||||||
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$adminRole = Role::create(['name' => 'admin']);
|
$adminRole = Role::create(['name' => 'admin']);
|
||||||
|
@ -65,7 +65,7 @@
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link menu-link" href="{{ route('leave.index') }}">
|
<a class="nav-link menu-link active" href="{{ route('leave.index') }}">
|
||||||
<i class="ri-honour-line"></i> <span data-key="t-widgets">Leave</span>
|
<i class="ri-honour-line"></i> <span data-key="t-widgets">Leave</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
Loading…
Reference in New Issue
Block a user