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
|
||||
{
|
||||
protected $table = 'tbl_leaves';
|
||||
protected $table = 'leaves';
|
||||
protected $guarded = [];
|
||||
|
||||
}
|
@ -7,6 +7,7 @@ use Illuminate\Support\ServiceProvider;
|
||||
use Modules\Leave\Repositories\LeaveInterface;
|
||||
use Modules\Leave\Repositories\LeaveRepository;
|
||||
|
||||
|
||||
class LeaveServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected string $moduleName = 'Leave';
|
||||
@ -59,7 +60,7 @@ class LeaveServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function registerTranslations(): void
|
||||
{
|
||||
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
|
||||
$langPath = resource_path('lang/modules/'.$this->moduleNameLower);
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||
@ -75,7 +76,7 @@ class LeaveServiceProvider extends ServiceProvider
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
@ -84,14 +85,14 @@ class LeaveServiceProvider extends ServiceProvider
|
||||
*/
|
||||
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');
|
||||
|
||||
$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);
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
@ -107,8 +108,8 @@ class LeaveServiceProvider extends ServiceProvider
|
||||
{
|
||||
$paths = [];
|
||||
foreach (config('view.paths') as $path) {
|
||||
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
|
||||
$paths[] = $path . '/modules/' . $this->moduleNameLower;
|
||||
if (is_dir($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": {
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\Seeders\\": "database/seeders/",
|
||||
"Modules\\": "Modules/"
|
||||
"Database\\Seeders\\": "database/seeders/"
|
||||
},
|
||||
"files":[
|
||||
"app/Helpers/OMIS.php",
|
||||
@ -64,6 +63,11 @@
|
||||
},
|
||||
"laravel": {
|
||||
"dont-discover": []
|
||||
},
|
||||
"merge-plugin": {
|
||||
"include": [
|
||||
"Modules/*/composer.json"
|
||||
]
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
|
2
composer.lock
generated
2
composer.lock
generated
@ -8865,5 +8865,5 @@
|
||||
"php": "^8.1"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.6.0"
|
||||
"plugin-api-version": "2.3.0"
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ return [
|
||||
| app folder name
|
||||
| for example can change it to 'src' or 'App'
|
||||
*/
|
||||
'app_folder' => '',
|
||||
'app_folder' => 'app/',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@ -112,28 +112,28 @@ return [
|
||||
| Setting the generate key to false will not generate that folder
|
||||
*/
|
||||
'generator' => [
|
||||
//
|
||||
'channels' => ['path' => 'Broadcasting', 'generate' => false],
|
||||
'command' => ['path' => 'Console', 'generate' => false],
|
||||
'emails' => ['path' => 'Emails', 'generate' => false],
|
||||
'event' => ['path' => 'Events', 'generate' => false],
|
||||
'jobs' => ['path' => 'Jobs', 'generate' => false],
|
||||
'listener' => ['path' => 'Listeners', 'generate' => false],
|
||||
'model' => ['path' => 'Models', 'generate' => true],
|
||||
'notifications' => ['path' => 'Notifications', 'generate' => false],
|
||||
'observer' => ['path' => 'Observers', 'generate' => false],
|
||||
'policies' => ['path' => 'Policies', 'generate' => false],
|
||||
'provider' => ['path' => 'Providers', 'generate' => true],
|
||||
'route-provider' => ['path' => 'Providers', 'generate' => true],
|
||||
'repository' => ['path' => 'Repositories', 'generate' => true],
|
||||
'resource' => ['path' => 'Transformers', 'generate' => false],
|
||||
'rules' => ['path' => 'Rules', 'generate' => false],
|
||||
'component-class' => ['path' => 'View/Components', 'generate' => false],
|
||||
// app/
|
||||
'channels' => ['path' => 'app/Broadcasting', 'generate' => false],
|
||||
'command' => ['path' => 'app/Console', 'generate' => false],
|
||||
'emails' => ['path' => 'app/Emails', 'generate' => false],
|
||||
'event' => ['path' => 'app/Events', 'generate' => false],
|
||||
'jobs' => ['path' => 'app/Jobs', 'generate' => false],
|
||||
'listener' => ['path' => 'app/Listeners', 'generate' => false],
|
||||
'model' => ['path' => 'app/Models', 'generate' => true],
|
||||
'notifications' => ['path' => 'app/Notifications', 'generate' => false],
|
||||
'observer' => ['path' => 'app/Observers', 'generate' => false],
|
||||
'policies' => ['path' => 'app/Policies', 'generate' => false],
|
||||
'provider' => ['path' => 'app/Providers', 'generate' => true],
|
||||
'route-provider' => ['path' => 'app/Providers', 'generate' => true],
|
||||
'repository' => ['path' => 'app/Repositories', 'generate' => true],
|
||||
'resource' => ['path' => 'app/Transformers', 'generate' => false],
|
||||
'rules' => ['path' => 'app/Rules', 'generate' => false],
|
||||
'component-class' => ['path' => 'app/View/Components', 'generate' => false],
|
||||
|
||||
// Http/
|
||||
'controller' => ['path' => 'Http/Controllers', 'generate' => true],
|
||||
'filter' => ['path' => 'Http/Middleware', 'generate' => false],
|
||||
'request' => ['path' => 'Http/Requests', 'generate' => false],
|
||||
// app/Http/
|
||||
'controller' => ['path' => 'app/Http/Controllers', 'generate' => true],
|
||||
'filter' => ['path' => 'app/Http/Middleware', 'generate' => false],
|
||||
'request' => ['path' => 'app/Http/Requests', 'generate' => true],
|
||||
|
||||
// config/
|
||||
'config' => ['path' => 'config', 'generate' => true],
|
||||
@ -141,7 +141,7 @@ return [
|
||||
// database/
|
||||
'migration' => ['path' => 'database/migrations', 'generate' => true],
|
||||
'seeder' => ['path' => 'database/seeders', 'generate' => true],
|
||||
'factory' => ['path' => 'database/factories', 'generate' => false],
|
||||
'factory' => ['path' => 'database/factories', 'generate' => true],
|
||||
|
||||
// lang/
|
||||
'lang' => ['path' => 'lang', 'generate' => false],
|
||||
|
@ -4,6 +4,7 @@ namespace Database\Seeders;
|
||||
|
||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
@ -19,11 +20,15 @@ class DatabaseSeeder extends Seeder
|
||||
$admin = \App\Models\User::factory()->create([
|
||||
'name' => 'Admin User',
|
||||
'email' => 'admin@gmail.com',
|
||||
'password' => Hash::make('password'),
|
||||
|
||||
]);
|
||||
|
||||
$member = \App\Models\User::factory()->create([
|
||||
'name' => 'Member User',
|
||||
'email' => 'member@gmail.com',
|
||||
'password' => Hash::make('password'),
|
||||
|
||||
]);
|
||||
|
||||
$adminRole = Role::create(['name' => 'admin']);
|
||||
|
@ -65,7 +65,7 @@
|
||||
</li>
|
||||
|
||||
<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>
|
||||
</a>
|
||||
</li>
|
||||
|
Loading…
Reference in New Issue
Block a user