initial commit

This commit is contained in:
Daeng Deni Mardaeni
2024-10-29 07:38:29 +07:00
commit 750ee4aec4
25 changed files with 389 additions and 0 deletions

View File

View File

@@ -0,0 +1,65 @@
<?php
namespace Modules\Basicdata\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class BasicdataController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
return view('basicdata::index');
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('basicdata::create');
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('basicdata::show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
return view('basicdata::edit');
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}

0
app/Providers/.gitkeep Normal file
View File

View File

@@ -0,0 +1,118 @@
<?php
namespace Modules\Basicdata\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
use Nwidart\Modules\Traits\PathNamespace;
class BasicdataServiceProvider extends ServiceProvider
{
use PathNamespace;
protected string $name = 'Basicdata';
protected string $nameLower = 'basicdata';
/**
* Boot the application events.
*/
public function boot(): void
{
$this->registerCommands();
$this->registerCommandSchedules();
$this->registerTranslations();
$this->registerConfig();
$this->registerViews();
$this->loadMigrationsFrom(module_path($this->name, 'database/migrations'));
}
/**
* Register the service provider.
*/
public function register(): void
{
$this->app->register(EventServiceProvider::class);
$this->app->register(RouteServiceProvider::class);
}
/**
* Register commands in the format of Command::class
*/
protected function registerCommands(): void
{
// $this->commands([]);
}
/**
* Register command Schedules.
*/
protected function registerCommandSchedules(): void
{
// $this->app->booted(function () {
// $schedule = $this->app->make(Schedule::class);
// $schedule->command('inspire')->hourly();
// });
}
/**
* Register translations.
*/
public function registerTranslations(): void
{
$langPath = resource_path('lang/modules/'.$this->nameLower);
if (is_dir($langPath)) {
$this->loadTranslationsFrom($langPath, $this->nameLower);
$this->loadJsonTranslationsFrom($langPath);
} else {
$this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower);
$this->loadJsonTranslationsFrom(module_path($this->name, 'lang'));
}
}
/**
* Register config.
*/
protected function registerConfig(): void
{
$this->publishes([module_path($this->name, 'config/config.php') => config_path($this->nameLower.'.php')], 'config');
$this->mergeConfigFrom(module_path($this->name, 'config/config.php'), $this->nameLower);
}
/**
* Register views.
*/
public function registerViews(): void
{
$viewPath = resource_path('views/modules/'.$this->nameLower);
$sourcePath = module_path($this->name, 'resources/views');
$this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']);
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower);
$componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path')));
Blade::componentNamespace($componentNamespace, $this->nameLower);
}
/**
* Get the services provided by the provider.
*/
public function provides(): array
{
return [];
}
private function getPublishableViewPaths(): array
{
$paths = [];
foreach (config('view.paths') as $path) {
if (is_dir($path.'/modules/'.$this->nameLower)) {
$paths[] = $path.'/modules/'.$this->nameLower;
}
}
return $paths;
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace Modules\Basicdata\Providers;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
/**
* The event handler mappings for the application.
*
* @var array<string, array<int, string>>
*/
protected $listen = [];
/**
* Indicates if events should be discovered.
*
* @var bool
*/
protected static $shouldDiscoverEvents = true;
/**
* Configure the proper event listeners for email verification.
*/
protected function configureEmailVerification(): void
{
//
}
}

View File

@@ -0,0 +1,50 @@
<?php
namespace Modules\Basicdata\Providers;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
protected string $name = 'Basicdata';
/**
* Called before routes are registered.
*
* Register any model bindings or pattern based filters.
*/
public function boot(): void
{
parent::boot();
}
/**
* Define the routes for the application.
*/
public function map(): void
{
$this->mapApiRoutes();
$this->mapWebRoutes();
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*/
protected function mapWebRoutes(): void
{
Route::middleware('web')->group(module_path($this->name, '/routes/web.php'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*/
protected function mapApiRoutes(): void
{
Route::middleware('api')->prefix('api')->name('api.')->group(module_path($this->name, '/routes/api.php'));
}
}

31
composer.json Normal file
View File

@@ -0,0 +1,31 @@
{
"name": "daengdeni/logs-module",
"type": "laravel-module",
"description": "",
"authors": [
{
"name": "Daeng Deni Mardaeni",
"email": "ddeni05@gmail.com"
}
],
"extra": {
"laravel": {
"providers": [],
"aliases": {
}
}
},
"autoload": {
"psr-4": {
"Modules\\Basicdata\\": "app/",
"Modules\\Basicdata\\Database\\Factories\\": "database/factories/",
"Modules\\Basicdata\\Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Modules\\Basicdata\\Tests\\": "tests/"
}
}
}

0
config/.gitkeep Normal file
View File

5
config/config.php Normal file
View File

@@ -0,0 +1,5 @@
<?php
return [
'name' => 'Basicdata',
];

View File

View File

View File

View File

@@ -0,0 +1,16 @@
<?php
namespace Modules\Basicdata\Database\Seeders;
use Illuminate\Database\Seeder;
class BasicdataDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// $this->call([]);
}
}

17
module.json Normal file
View File

@@ -0,0 +1,17 @@
{
"name": "Basicdata",
"alias": "basicdata",
"database": "",
"description": "",
"keywords": [],
"priority": 0,
"providers": [
"Modules\\Basicdata\\Providers\\BasicdataServiceProvider"
],
"files": [],
"menu": {
"main": [],
"master": [],
"system": []
}
}

15
package.json Normal file
View File

@@ -0,0 +1,15 @@
{
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"axios": "^1.1.2",
"laravel-vite-plugin": "^0.7.5",
"sass": "^1.69.5",
"postcss": "^8.3.7",
"vite": "^4.0.0"
}
}

View File

View File

View File

0
resources/views/.gitkeep Normal file
View File

0
routes/.gitkeep Normal file
View File

19
routes/api.php Normal file
View File

@@ -0,0 +1,19 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\Basicdata\Http\Controllers\BasicdataController;
/*
*--------------------------------------------------------------------------
* API Routes
*--------------------------------------------------------------------------
*
* Here is where you can register API routes for your application. These
* routes are loaded by the RouteServiceProvider within a group which
* is assigned the "api" middleware group. Enjoy building your API!
*
*/
Route::middleware(['auth:sanctum'])->prefix('v1')->group(function () {
Route::apiResource('basicdata', BasicdataController::class)->names('basicdata');
});

19
routes/web.php Normal file
View File

@@ -0,0 +1,19 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\Basicdata\Http\Controllers\BasicdataController;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::group([], function () {
Route::resource('basicdata', BasicdataController::class)->names('basicdata');
});

0
tests/Feature/.gitkeep Normal file
View File

0
tests/Unit/.gitkeep Normal file
View File

4
vite.config.js Normal file
View File

@@ -0,0 +1,4 @@
export const paths = [
"Modules/Basicdata/resources/assets/sass/app.scss",
"Modules/Basicdata/resources/assets/js/app.js",
];