Update Metronic Version to 8.2.1 #1
0
Modules/CetakLabel/Config/.gitkeep
Normal file
0
Modules/CetakLabel/Config/.gitkeep
Normal file
6
Modules/CetakLabel/Config/config.php
Normal file
6
Modules/CetakLabel/Config/config.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'CetakLabel',
|
||||
'domain' => 'cetaklabel.io'
|
||||
];
|
0
Modules/CetakLabel/Console/.gitkeep
Normal file
0
Modules/CetakLabel/Console/.gitkeep
Normal file
0
Modules/CetakLabel/Database/Migrations/.gitkeep
Normal file
0
Modules/CetakLabel/Database/Migrations/.gitkeep
Normal file
0
Modules/CetakLabel/Database/Seeders/.gitkeep
Normal file
0
Modules/CetakLabel/Database/Seeders/.gitkeep
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\CetakLabel\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CetakLabelDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Model::unguard();
|
||||
|
||||
// $this->call("OthersTableSeeder");
|
||||
}
|
||||
}
|
0
Modules/CetakLabel/Database/factories/.gitkeep
Normal file
0
Modules/CetakLabel/Database/factories/.gitkeep
Normal file
0
Modules/CetakLabel/Entities/.gitkeep
Normal file
0
Modules/CetakLabel/Entities/.gitkeep
Normal file
0
Modules/CetakLabel/Http/Controllers/.gitkeep
Normal file
0
Modules/CetakLabel/Http/Controllers/.gitkeep
Normal file
79
Modules/CetakLabel/Http/Controllers/CetakLabelController.php
Normal file
79
Modules/CetakLabel/Http/Controllers/CetakLabelController.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\CetakLabel\Http\Controllers;
|
||||
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
|
||||
class CetakLabelController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @return Renderable
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('cetaklabel::index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @return Renderable
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('cetaklabel::create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param Request $request
|
||||
* @return Renderable
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
* @param int $id
|
||||
* @return Renderable
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('cetaklabel::show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param int $id
|
||||
* @return Renderable
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
return view('cetaklabel::edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param Request $request
|
||||
* @param int $id
|
||||
* @return Renderable
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param int $id
|
||||
* @return Renderable
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
23
Modules/CetakLabel/Http/Controllers/DirectoratController.php
Normal file
23
Modules/CetakLabel/Http/Controllers/DirectoratController.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\CetakLabel\Http\Controllers;
|
||||
|
||||
use App\DataTables\DirectoratDataTable;
|
||||
use App\Http\Controllers\ApiController;
|
||||
use App\Http\Requests\StoreDirectoratRequest;
|
||||
use App\Http\Requests\UpdateDirectoratRequest;
|
||||
use App\Models\Directorat;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Spatie\Activitylog\Facades\CauserResolver;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
|
||||
class DirectoratController extends ApiController
|
||||
{
|
||||
public function index() : JsonResponse{
|
||||
$directorats = Directorat::all();
|
||||
|
||||
return $this->sendResponse($directorats, 'Directorats retrieved successfully.');
|
||||
}
|
||||
}
|
0
Modules/CetakLabel/Http/Middleware/.gitkeep
Normal file
0
Modules/CetakLabel/Http/Middleware/.gitkeep
Normal file
0
Modules/CetakLabel/Http/Requests/.gitkeep
Normal file
0
Modules/CetakLabel/Http/Requests/.gitkeep
Normal file
0
Modules/CetakLabel/Providers/.gitkeep
Normal file
0
Modules/CetakLabel/Providers/.gitkeep
Normal file
114
Modules/CetakLabel/Providers/CetakLabelServiceProvider.php
Normal file
114
Modules/CetakLabel/Providers/CetakLabelServiceProvider.php
Normal file
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\CetakLabel\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Database\Eloquent\Factory;
|
||||
|
||||
class CetakLabelServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* @var string $moduleName
|
||||
*/
|
||||
protected $moduleName = 'CetakLabel';
|
||||
|
||||
/**
|
||||
* @var string $moduleNameLower
|
||||
*/
|
||||
protected $moduleNameLower = 'cetaklabel';
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/Migrations'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerConfig()
|
||||
{
|
||||
$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
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerViews()
|
||||
{
|
||||
$viewPath = resource_path('views/modules/' . $this->moduleNameLower);
|
||||
|
||||
$sourcePath = module_path($this->moduleName, 'Resources/views');
|
||||
|
||||
$this->publishes([
|
||||
$sourcePath => $viewPath
|
||||
], ['views', $this->moduleNameLower . '-module-views']);
|
||||
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerTranslations()
|
||||
{
|
||||
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom($langPath);
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path($this->moduleName, 'Resources/lang'), $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'Resources/lang'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
private function getPublishableViewPaths(): array
|
||||
{
|
||||
$paths = [];
|
||||
foreach (\Config::get('view.paths') as $path) {
|
||||
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
|
||||
$paths[] = $path . '/modules/' . $this->moduleNameLower;
|
||||
}
|
||||
}
|
||||
return $paths;
|
||||
}
|
||||
}
|
69
Modules/CetakLabel/Providers/RouteServiceProvider.php
Normal file
69
Modules/CetakLabel/Providers/RouteServiceProvider.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\CetakLabel\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The module namespace to assume when generating URLs to actions.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $moduleNamespace = 'Modules\CetakLabel\Http\Controllers';
|
||||
|
||||
/**
|
||||
* Called before routes are registered.
|
||||
*
|
||||
* Register any model bindings or pattern based filters.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map()
|
||||
{
|
||||
$this->mapApiRoutes();
|
||||
|
||||
$this->mapWebRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapWebRoutes()
|
||||
{
|
||||
Route::middleware('web')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('CetakLabel', '/Routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapApiRoutes()
|
||||
{
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('CetakLabel', '/Routes/api.php'));
|
||||
}
|
||||
}
|
0
Modules/CetakLabel/Resources/assets/.gitkeep
Normal file
0
Modules/CetakLabel/Resources/assets/.gitkeep
Normal file
0
Modules/CetakLabel/Resources/assets/js/app.js
Normal file
0
Modules/CetakLabel/Resources/assets/js/app.js
Normal file
0
Modules/CetakLabel/Resources/assets/sass/app.scss
Normal file
0
Modules/CetakLabel/Resources/assets/sass/app.scss
Normal file
0
Modules/CetakLabel/Resources/lang/.gitkeep
Normal file
0
Modules/CetakLabel/Resources/lang/.gitkeep
Normal file
0
Modules/CetakLabel/Resources/views/.gitkeep
Normal file
0
Modules/CetakLabel/Resources/views/.gitkeep
Normal file
9
Modules/CetakLabel/Resources/views/index.blade.php
Normal file
9
Modules/CetakLabel/Resources/views/index.blade.php
Normal file
@ -0,0 +1,9 @@
|
||||
@extends('cetaklabel::layouts.master')
|
||||
|
||||
@section('content')
|
||||
<h1>Hello World</h1>
|
||||
|
||||
<p>
|
||||
This view is loaded from module: {!! config('cetaklabel.name') !!}
|
||||
</p>
|
||||
@endsection
|
19
Modules/CetakLabel/Resources/views/layouts/master.blade.php
Normal file
19
Modules/CetakLabel/Resources/views/layouts/master.blade.php
Normal file
@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Module CetakLabel</title>
|
||||
|
||||
{{-- Laravel Vite - CSS File --}}
|
||||
{{-- {{ module_vite('build-cetaklabel', 'Resources/assets/sass/app.scss') }} --}}
|
||||
|
||||
</head>
|
||||
<body>
|
||||
@yield('content')
|
||||
|
||||
{{-- Laravel Vite - JS File --}}
|
||||
{{-- {{ module_vite('build-cetaklabel', 'Resources/assets/js/app.js') }} --}}
|
||||
</body>
|
||||
</html>
|
0
Modules/CetakLabel/Routes/.gitkeep
Normal file
0
Modules/CetakLabel/Routes/.gitkeep
Normal file
25
Modules/CetakLabel/Routes/api.php
Normal file
25
Modules/CetakLabel/Routes/api.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use Modules\CetakLabel\Http\Controllers\DirectoratController;
|
||||
use Nwidart\Modules\Facades\Module;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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!
|
||||
|
|
||||
*/
|
||||
|
||||
|
||||
$module = Module::find('CetakLabel');
|
||||
$domain= config($module->getLowerName().'.domain');
|
||||
|
||||
Route::domain($domain)->group(function () {
|
||||
Route::middleware('auth:sanctum')->group(function () {
|
||||
Route::resource('directorats', DirectoratController::class);
|
||||
});
|
||||
});
|
20
Modules/CetakLabel/Routes/web.php
Normal file
20
Modules/CetakLabel/Routes/web.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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!
|
||||
|
|
||||
*/
|
||||
|
||||
use Modules\CetakLabel\Http\Controllers\DirectoratController;
|
||||
|
||||
Route::prefix('cetaklabel')->group(function() {
|
||||
Route::get('/', 'CetakLabelController@index');
|
||||
});
|
||||
|
||||
Route::resource('directorat', DirectoratController::class);
|
0
Modules/CetakLabel/Tests/Feature/.gitkeep
Normal file
0
Modules/CetakLabel/Tests/Feature/.gitkeep
Normal file
0
Modules/CetakLabel/Tests/Unit/.gitkeep
Normal file
0
Modules/CetakLabel/Tests/Unit/.gitkeep
Normal file
23
Modules/CetakLabel/composer.json
Normal file
23
Modules/CetakLabel/composer.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "nwidart/cetaklabel",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Widart",
|
||||
"email": "n.widart@gmail.com"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\CetakLabel\\": ""
|
||||
}
|
||||
}
|
||||
}
|
11
Modules/CetakLabel/module.json
Normal file
11
Modules/CetakLabel/module.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "CetakLabel",
|
||||
"alias": "cetaklabel",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"Modules\\CetakLabel\\Providers\\CetakLabelServiceProvider"
|
||||
],
|
||||
"files": []
|
||||
}
|
16
Modules/CetakLabel/package.json
Normal file
16
Modules/CetakLabel/package.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"axios": "^0.21.4",
|
||||
"dotenv": "^10.0.0",
|
||||
"dotenv-expand": "^5.1.0",
|
||||
"laravel-vite-plugin": "^0.6.0",
|
||||
"lodash": "^4.17.21",
|
||||
"postcss": "^8.3.7",
|
||||
"vite": "^3.0.9"
|
||||
}
|
||||
}
|
24
Modules/CetakLabel/vite.config.js
Normal file
24
Modules/CetakLabel/vite.config.js
Normal file
@ -0,0 +1,24 @@
|
||||
const dotenvExpand = require('dotenv-expand');
|
||||
dotenvExpand(require('dotenv').config({ path: '../../.env'/*, debug: true*/}));
|
||||
|
||||
import { defineConfig } from 'vite';
|
||||
import laravel from 'laravel-vite-plugin';
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
outDir: '../../public/build-cetaklabel',
|
||||
emptyOutDir: true,
|
||||
manifest: true,
|
||||
},
|
||||
plugins: [
|
||||
laravel({
|
||||
publicDirectory: '../../public',
|
||||
buildDirectory: 'build-cetaklabel',
|
||||
input: [
|
||||
__dirname + '/Resources/assets/sass/app.scss',
|
||||
__dirname + '/Resources/assets/js/app.js'
|
||||
],
|
||||
refresh: true,
|
||||
}),
|
||||
],
|
||||
});
|
0
Modules/hcis.io/Config/.gitkeep
Normal file
0
Modules/hcis.io/Config/.gitkeep
Normal file
0
Modules/hcis.io/Console/.gitkeep
Normal file
0
Modules/hcis.io/Console/.gitkeep
Normal file
0
Modules/hcis.io/Database/Migrations/.gitkeep
Normal file
0
Modules/hcis.io/Database/Migrations/.gitkeep
Normal file
0
Modules/hcis.io/Database/Seeders/.gitkeep
Normal file
0
Modules/hcis.io/Database/Seeders/.gitkeep
Normal file
0
Modules/hcis.io/Database/factories/.gitkeep
Normal file
0
Modules/hcis.io/Database/factories/.gitkeep
Normal file
0
Modules/hcis.io/Entities/.gitkeep
Normal file
0
Modules/hcis.io/Entities/.gitkeep
Normal file
0
Modules/hcis.io/Http/Controllers/.gitkeep
Normal file
0
Modules/hcis.io/Http/Controllers/.gitkeep
Normal file
0
Modules/hcis.io/Http/Middleware/.gitkeep
Normal file
0
Modules/hcis.io/Http/Middleware/.gitkeep
Normal file
0
Modules/hcis.io/Http/Requests/.gitkeep
Normal file
0
Modules/hcis.io/Http/Requests/.gitkeep
Normal file
0
Modules/hcis.io/Providers/.gitkeep
Normal file
0
Modules/hcis.io/Providers/.gitkeep
Normal file
0
Modules/hcis.io/Resources/assets/.gitkeep
Normal file
0
Modules/hcis.io/Resources/assets/.gitkeep
Normal file
0
Modules/hcis.io/Resources/lang/.gitkeep
Normal file
0
Modules/hcis.io/Resources/lang/.gitkeep
Normal file
0
Modules/hcis.io/Resources/views/.gitkeep
Normal file
0
Modules/hcis.io/Resources/views/.gitkeep
Normal file
0
Modules/hcis.io/Routes/.gitkeep
Normal file
0
Modules/hcis.io/Routes/.gitkeep
Normal file
0
Modules/hcis.io/Tests/Feature/.gitkeep
Normal file
0
Modules/hcis.io/Tests/Feature/.gitkeep
Normal file
0
Modules/hcis.io/Tests/Unit/.gitkeep
Normal file
0
Modules/hcis.io/Tests/Unit/.gitkeep
Normal file
11
Modules/hcis.io/module.json
Normal file
11
Modules/hcis.io/module.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "Hcis",
|
||||
"alias": "hcis",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
|
||||
],
|
||||
"files": []
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Throwable;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
@ -46,5 +47,14 @@ class Handler extends ExceptionHandler
|
||||
$this->reportable(function (Throwable $e) {
|
||||
//
|
||||
});
|
||||
|
||||
$this->renderable(function (NotFoundHttpException $e, $request) {
|
||||
if ($request->is('api/*')) {
|
||||
return response()->json([
|
||||
'message' => 'Not found.'
|
||||
], 404);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
43
app/Http/Controllers/ApiController.php
Normal file
43
app/Http/Controllers/ApiController.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller as Controller;
|
||||
|
||||
class ApiController extends Controller
|
||||
{
|
||||
/**
|
||||
* success response method.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function sendResponse($result, $message, $code = 200)
|
||||
{
|
||||
$response = [
|
||||
'success' => true,
|
||||
'data' => $result,
|
||||
'message' => $message,
|
||||
];
|
||||
|
||||
return response()->json($response, $code);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* return error response.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function sendError($error, $errorMessages = [], $code = 404)
|
||||
{
|
||||
$response = [
|
||||
'success' => false,
|
||||
'message' => $error,
|
||||
];
|
||||
|
||||
if (!empty($errorMessages)) {
|
||||
$response['data'] = $errorMessages;
|
||||
}
|
||||
|
||||
return response()->json($response, $code);
|
||||
}
|
||||
}
|
60
app/Http/Controllers/Auth/AuthApiController.php
Normal file
60
app/Http/Controllers/Auth/AuthApiController.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\ApiController;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class AuthApiController extends ApiController
|
||||
{
|
||||
/**
|
||||
* Register api
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function register(Request $request)
|
||||
: JsonResponse
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required',
|
||||
'email' => 'required|email',
|
||||
'password' => 'required',
|
||||
'password_confirmation' => 'required|same:password',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return $this->sendError('Validation Error.', $validator->errors());
|
||||
}
|
||||
|
||||
$input = $request->all();
|
||||
$input['password'] = bcrypt($input['password']);
|
||||
$user = User::create($input);
|
||||
$success['token'] = $user->createToken('MyApp')->plainTextToken;
|
||||
$success['name'] = $user->name;
|
||||
|
||||
return $this->sendResponse($success, 'User register successfully.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Login api
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function login(Request $request)
|
||||
: JsonResponse
|
||||
{
|
||||
if (Auth::attempt(['email' => $request->email, 'password' => $request->password])) {
|
||||
$user = Auth::user();
|
||||
$success['token'] = $user->createToken('MyApp')->plainTextToken;
|
||||
$success['name'] = $user->name;
|
||||
|
||||
return $this->sendResponse($success, 'User login successfully.');
|
||||
} else {
|
||||
return $this->sendError('Unauthorised.', ['error' => 'Unauthorised']);
|
||||
}
|
||||
}
|
||||
}
|
@ -39,7 +39,7 @@ class Kernel extends HttpKernel
|
||||
],
|
||||
|
||||
'api' => [
|
||||
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||
\Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||
'throttle:api',
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
|
@ -12,9 +12,11 @@
|
||||
"jackiedo/log-reader": "2.*",
|
||||
"laracasts/flash": "^3.2",
|
||||
"laravel/framework": "^10.0",
|
||||
"laravel/sanctum": "^3.0",
|
||||
"laravel/octane": "^1.5",
|
||||
"laravel/sanctum": "^3.2",
|
||||
"laravel/tinker": "^2.7",
|
||||
"laravelcollective/html": "^6.4",
|
||||
"nwidart/laravel-modules": "^10.0",
|
||||
"spatie/laravel-activitylog": "^4.7",
|
||||
"spatie/laravel-permission": "^5.10",
|
||||
"wildside/userstamps": "^2.3",
|
||||
@ -40,7 +42,8 @@
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests/"
|
||||
"Tests\\": "tests/",
|
||||
"Modules\\": "Modules/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
|
634
composer.lock
generated
634
composer.lock
generated
File diff suppressed because it is too large
Load Diff
277
config/modules.php
Normal file
277
config/modules.php
Normal file
@ -0,0 +1,277 @@
|
||||
<?php
|
||||
|
||||
use Nwidart\Modules\Activators\FileActivator;
|
||||
use Nwidart\Modules\Commands;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Module Namespace
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Default module namespace.
|
||||
|
|
||||
*/
|
||||
|
||||
'namespace' => 'Modules',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Module Stubs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Default module stubs.
|
||||
|
|
||||
*/
|
||||
|
||||
'stubs' => [
|
||||
'enabled' => false,
|
||||
'path' => base_path('vendor/nwidart/laravel-modules/src/Commands/stubs'),
|
||||
'files' => [
|
||||
'routes/web' => 'Routes/web.php',
|
||||
'routes/api' => 'Routes/api.php',
|
||||
'views/index' => 'Resources/views/index.blade.php',
|
||||
'views/master' => 'Resources/views/layouts/master.blade.php',
|
||||
'scaffold/config' => 'Config/config.php',
|
||||
'composer' => 'composer.json',
|
||||
'assets/js/app' => 'Resources/assets/js/app.js',
|
||||
'assets/sass/app' => 'Resources/assets/sass/app.scss',
|
||||
'vite' => 'vite.config.js',
|
||||
'package' => 'package.json',
|
||||
],
|
||||
'replacements' => [
|
||||
'routes/web' => ['LOWER_NAME', 'STUDLY_NAME'],
|
||||
'routes/api' => ['LOWER_NAME'],
|
||||
'vite' => ['LOWER_NAME'],
|
||||
'json' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE', 'PROVIDER_NAMESPACE'],
|
||||
'views/index' => ['LOWER_NAME'],
|
||||
'views/master' => ['LOWER_NAME', 'STUDLY_NAME'],
|
||||
'scaffold/config' => ['STUDLY_NAME'],
|
||||
'composer' => [
|
||||
'LOWER_NAME',
|
||||
'STUDLY_NAME',
|
||||
'VENDOR',
|
||||
'AUTHOR_NAME',
|
||||
'AUTHOR_EMAIL',
|
||||
'MODULE_NAMESPACE',
|
||||
'PROVIDER_NAMESPACE',
|
||||
],
|
||||
],
|
||||
'gitkeep' => true,
|
||||
],
|
||||
'paths' => [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Modules path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This path used for save the generated module. This path also will be added
|
||||
| automatically to list of scanned folders.
|
||||
|
|
||||
*/
|
||||
|
||||
'modules' => base_path('Modules'),
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Modules assets path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may update the modules assets path.
|
||||
|
|
||||
*/
|
||||
|
||||
'assets' => public_path('modules'),
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| The migrations path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Where you run 'module:publish-migration' command, where do you publish the
|
||||
| the migration files?
|
||||
|
|
||||
*/
|
||||
|
||||
'migration' => base_path('database/migrations'),
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Generator path
|
||||
|--------------------------------------------------------------------------
|
||||
| Customise the paths where the folders will be generated.
|
||||
| Set the generate key to false to not generate that folder
|
||||
*/
|
||||
'generator' => [
|
||||
'config' => ['path' => 'Config', 'generate' => true],
|
||||
'command' => ['path' => 'Console', 'generate' => true],
|
||||
'migration' => ['path' => 'Database/Migrations', 'generate' => true],
|
||||
'seeder' => ['path' => 'Database/Seeders', 'generate' => true],
|
||||
'factory' => ['path' => 'Database/factories', 'generate' => true],
|
||||
'model' => ['path' => 'Entities', 'generate' => true],
|
||||
'routes' => ['path' => 'Routes', 'generate' => true],
|
||||
'controller' => ['path' => 'Http/Controllers', 'generate' => true],
|
||||
'filter' => ['path' => 'Http/Middleware', 'generate' => true],
|
||||
'request' => ['path' => 'Http/Requests', 'generate' => true],
|
||||
'provider' => ['path' => 'Providers', 'generate' => true],
|
||||
'assets' => ['path' => 'Resources/assets', 'generate' => true],
|
||||
'lang' => ['path' => 'Resources/lang', 'generate' => true],
|
||||
'views' => ['path' => 'Resources/views', 'generate' => true],
|
||||
'test' => ['path' => 'Tests/Unit', 'generate' => true],
|
||||
'test-feature' => ['path' => 'Tests/Feature', 'generate' => true],
|
||||
'repository' => ['path' => 'Repositories', 'generate' => false],
|
||||
'event' => ['path' => 'Events', 'generate' => false],
|
||||
'listener' => ['path' => 'Listeners', 'generate' => false],
|
||||
'policies' => ['path' => 'Policies', 'generate' => false],
|
||||
'rules' => ['path' => 'Rules', 'generate' => false],
|
||||
'jobs' => ['path' => 'Jobs', 'generate' => false],
|
||||
'emails' => ['path' => 'Emails', 'generate' => false],
|
||||
'notifications' => ['path' => 'Notifications', 'generate' => false],
|
||||
'resource' => ['path' => 'Transformers', 'generate' => false],
|
||||
'component-view' => ['path' => 'Resources/views/components', 'generate' => false],
|
||||
'component-class' => ['path' => 'View/Components', 'generate' => false],
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Package commands
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you can define which commands will be visible and used in your
|
||||
| application. If for example you don't use some of the commands provided
|
||||
| you can simply comment them out.
|
||||
|
|
||||
*/
|
||||
'commands' => [
|
||||
Commands\CommandMakeCommand::class,
|
||||
Commands\ComponentClassMakeCommand::class,
|
||||
Commands\ComponentViewMakeCommand::class,
|
||||
Commands\ControllerMakeCommand::class,
|
||||
Commands\DisableCommand::class,
|
||||
Commands\DumpCommand::class,
|
||||
Commands\EnableCommand::class,
|
||||
Commands\EventMakeCommand::class,
|
||||
Commands\JobMakeCommand::class,
|
||||
Commands\ListenerMakeCommand::class,
|
||||
Commands\MailMakeCommand::class,
|
||||
Commands\MiddlewareMakeCommand::class,
|
||||
Commands\NotificationMakeCommand::class,
|
||||
Commands\ProviderMakeCommand::class,
|
||||
Commands\RouteProviderMakeCommand::class,
|
||||
Commands\InstallCommand::class,
|
||||
Commands\ListCommand::class,
|
||||
Commands\ModuleDeleteCommand::class,
|
||||
Commands\ModuleMakeCommand::class,
|
||||
Commands\FactoryMakeCommand::class,
|
||||
Commands\PolicyMakeCommand::class,
|
||||
Commands\RequestMakeCommand::class,
|
||||
Commands\RuleMakeCommand::class,
|
||||
Commands\MigrateCommand::class,
|
||||
Commands\MigrateFreshCommand::class,
|
||||
Commands\MigrateRefreshCommand::class,
|
||||
Commands\MigrateResetCommand::class,
|
||||
Commands\MigrateRollbackCommand::class,
|
||||
Commands\MigrateStatusCommand::class,
|
||||
Commands\MigrationMakeCommand::class,
|
||||
Commands\ModelMakeCommand::class,
|
||||
Commands\PublishCommand::class,
|
||||
Commands\PublishConfigurationCommand::class,
|
||||
Commands\PublishMigrationCommand::class,
|
||||
Commands\PublishTranslationCommand::class,
|
||||
Commands\SeedCommand::class,
|
||||
Commands\SeedMakeCommand::class,
|
||||
Commands\SetupCommand::class,
|
||||
Commands\UnUseCommand::class,
|
||||
Commands\UpdateCommand::class,
|
||||
Commands\UseCommand::class,
|
||||
Commands\ResourceMakeCommand::class,
|
||||
Commands\TestMakeCommand::class,
|
||||
Commands\LaravelModulesV6Migrator::class,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Scan Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 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.
|
||||
|
|
||||
*/
|
||||
|
||||
'scan' => [
|
||||
'enabled' => false,
|
||||
'paths' => [
|
||||
base_path('vendor/*/*'),
|
||||
],
|
||||
],
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Composer File Template
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is the config for composer.json file, generated by this package
|
||||
|
|
||||
*/
|
||||
|
||||
'composer' => [
|
||||
'vendor' => 'nwidart',
|
||||
'author' => [
|
||||
'name' => 'Nicolas Widart',
|
||||
'email' => 'n.widart@gmail.com',
|
||||
],
|
||||
'composer-output' => false,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Caching
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is the config for setting up caching feature.
|
||||
|
|
||||
*/
|
||||
'cache' => [
|
||||
'enabled' => false,
|
||||
'driver' => 'file',
|
||||
'key' => 'laravel-modules',
|
||||
'lifetime' => 60,
|
||||
],
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Choose what laravel-modules will register as custom namespaces.
|
||||
| Setting one to false will require you to register that part
|
||||
| in your own Service Provider class.
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'register' => [
|
||||
'translations' => true,
|
||||
/**
|
||||
* load files on boot or register method
|
||||
*
|
||||
* Note: boot not compatible with asgardcms
|
||||
*
|
||||
* @example boot|register
|
||||
*/
|
||||
'files' => 'register',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Activators
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You can define new types of activators here, file, database etc. The only
|
||||
| required parameter is 'class'.
|
||||
| The file activator will store the activation status in storage/installed_modules
|
||||
*/
|
||||
'activators' => [
|
||||
'file' => [
|
||||
'class' => FileActivator::class,
|
||||
'statuses-file' => base_path('modules_statuses.json'),
|
||||
'cache-key' => 'activator.installed',
|
||||
'cache-lifetime' => 604800,
|
||||
],
|
||||
],
|
||||
|
||||
'activator' => 'file',
|
||||
];
|
228
config/octane.php
Normal file
228
config/octane.php
Normal file
@ -0,0 +1,228 @@
|
||||
<?php
|
||||
|
||||
use Laravel\Octane\Contracts\OperationTerminated;
|
||||
use Laravel\Octane\Events\RequestHandled;
|
||||
use Laravel\Octane\Events\RequestReceived;
|
||||
use Laravel\Octane\Events\RequestTerminated;
|
||||
use Laravel\Octane\Events\TaskReceived;
|
||||
use Laravel\Octane\Events\TaskTerminated;
|
||||
use Laravel\Octane\Events\TickReceived;
|
||||
use Laravel\Octane\Events\TickTerminated;
|
||||
use Laravel\Octane\Events\WorkerErrorOccurred;
|
||||
use Laravel\Octane\Events\WorkerStarting;
|
||||
use Laravel\Octane\Events\WorkerStopping;
|
||||
use Laravel\Octane\Listeners\CollectGarbage;
|
||||
use Laravel\Octane\Listeners\DisconnectFromDatabases;
|
||||
use Laravel\Octane\Listeners\EnsureUploadedFilesAreValid;
|
||||
use Laravel\Octane\Listeners\EnsureUploadedFilesCanBeMoved;
|
||||
use Laravel\Octane\Listeners\FlushTemporaryContainerInstances;
|
||||
use Laravel\Octane\Listeners\FlushUploadedFiles;
|
||||
use Laravel\Octane\Listeners\ReportException;
|
||||
use Laravel\Octane\Listeners\StopWorkerIfNecessary;
|
||||
use Laravel\Octane\Octane;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Octane Server
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines the default "server" that will be used by Octane
|
||||
| when starting, restarting, or stopping your server via the CLI. You
|
||||
| are free to change this to the supported server of your choosing.
|
||||
|
|
||||
| Supported: "roadrunner", "swoole"
|
||||
|
|
||||
*/
|
||||
|
||||
'server' => env('OCTANE_SERVER', 'roadrunner'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Force HTTPS
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When this configuration value is set to "true", Octane will inform the
|
||||
| framework that all absolute links must be generated using the HTTPS
|
||||
| protocol. Otherwise your links may be generated using plain HTTP.
|
||||
|
|
||||
*/
|
||||
|
||||
'https' => env('OCTANE_HTTPS', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Octane Listeners
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| All of the event listeners for Octane's events are defined below. These
|
||||
| listeners are responsible for resetting your application's state for
|
||||
| the next request. You may even add your own listeners to the list.
|
||||
|
|
||||
*/
|
||||
|
||||
'listeners' => [
|
||||
WorkerStarting::class => [
|
||||
EnsureUploadedFilesAreValid::class,
|
||||
EnsureUploadedFilesCanBeMoved::class,
|
||||
],
|
||||
|
||||
RequestReceived::class => [
|
||||
...Octane::prepareApplicationForNextOperation(),
|
||||
...Octane::prepareApplicationForNextRequest(),
|
||||
//
|
||||
],
|
||||
|
||||
RequestHandled::class => [
|
||||
//
|
||||
],
|
||||
|
||||
RequestTerminated::class => [
|
||||
// FlushUploadedFiles::class,
|
||||
],
|
||||
|
||||
TaskReceived::class => [
|
||||
...Octane::prepareApplicationForNextOperation(),
|
||||
//
|
||||
],
|
||||
|
||||
TaskTerminated::class => [
|
||||
//
|
||||
],
|
||||
|
||||
TickReceived::class => [
|
||||
...Octane::prepareApplicationForNextOperation(),
|
||||
//
|
||||
],
|
||||
|
||||
TickTerminated::class => [
|
||||
//
|
||||
],
|
||||
|
||||
OperationTerminated::class => [
|
||||
FlushTemporaryContainerInstances::class,
|
||||
// DisconnectFromDatabases::class,
|
||||
// CollectGarbage::class,
|
||||
],
|
||||
|
||||
WorkerErrorOccurred::class => [
|
||||
ReportException::class,
|
||||
StopWorkerIfNecessary::class,
|
||||
],
|
||||
|
||||
WorkerStopping::class => [
|
||||
//
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Warm / Flush Bindings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The bindings listed below will either be pre-warmed when a worker boots
|
||||
| or they will be flushed before every new request. Flushing a binding
|
||||
| will force the container to resolve that binding again when asked.
|
||||
|
|
||||
*/
|
||||
|
||||
'warm' => [
|
||||
...Octane::defaultServicesToWarm(),
|
||||
],
|
||||
|
||||
'flush' => [
|
||||
//
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Octane Cache Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| While using Swoole, you may leverage the Octane cache, which is powered
|
||||
| by a Swoole table. You may set the maximum number of rows as well as
|
||||
| the number of bytes per row using the configuration options below.
|
||||
|
|
||||
*/
|
||||
|
||||
'cache' => [
|
||||
'rows' => 1000,
|
||||
'bytes' => 10000,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Octane Swoole Tables
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| While using Swoole, you may define additional tables as required by the
|
||||
| application. These tables can be used to store data that needs to be
|
||||
| quickly accessed by other workers on the particular Swoole server.
|
||||
|
|
||||
*/
|
||||
|
||||
'tables' => [
|
||||
'example:1000' => [
|
||||
'name' => 'string:1000',
|
||||
'votes' => 'int',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| File Watching
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following list of files and directories will be watched when using
|
||||
| the --watch option offered by Octane. If any of the directories and
|
||||
| files are changed, Octane will automatically reload your workers.
|
||||
|
|
||||
*/
|
||||
|
||||
'watch' => [
|
||||
'app',
|
||||
'bootstrap',
|
||||
'config',
|
||||
'database',
|
||||
'public/**/*.php',
|
||||
'resources/**/*.php',
|
||||
'routes',
|
||||
'composer.lock',
|
||||
'.env',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Garbage Collection Threshold
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When executing long-lived PHP scripts such as Octane, memory can build
|
||||
| up before being cleared by PHP. You can force Octane to run garbage
|
||||
| collection if your application consumes this amount of megabytes.
|
||||
|
|
||||
*/
|
||||
|
||||
'garbage' => 50,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Maximum Execution Time
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following setting configures the maximum execution time for requests
|
||||
| being handled by Octane. You may set this value to 0 to indicate that
|
||||
| there isn't a specific time limit on Octane request execution time.
|
||||
|
|
||||
*/
|
||||
|
||||
'max_execution_time' => 30,
|
||||
|
||||
'swoole' => [
|
||||
'options' => [
|
||||
'log_file' => storage_path('logs/swoole_http.log'),
|
||||
'package_max_length' => 10 * 1024 * 1024,
|
||||
],
|
||||
],
|
||||
|
||||
];
|
4
modules_statuses.json
Normal file
4
modules_statuses.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"CetakLabel": true,
|
||||
"Hcis": true
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\Auth\AuthApiController as AuthApiControllerAlias;
|
||||
use App\Http\Controllers\DirectoratController;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
@ -15,8 +16,9 @@ use Illuminate\Support\Facades\Route;
|
||||
|
|
||||
*/
|
||||
|
||||
Route::post('register', [AuthApiControllerAlias::class, 'register']);
|
||||
Route::post('login', [AuthApiControllerAlias::class, 'login']);
|
||||
|
||||
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
|
||||
return $request->user();
|
||||
});
|
||||
|
||||
Route::get('directorat',[DirectoratController::class, 'index']);
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\DashboardController;
|
||||
use App\Http\Controllers\DirectoratController;
|
||||
use App\Http\Controllers\DocumentController;
|
||||
use App\Http\Controllers\DocumentTypeController;
|
||||
use App\Http\Controllers\JobController;
|
||||
@ -37,7 +36,6 @@ Route::group(['middleware' => ['auth', 'verified']], function () {
|
||||
|
||||
});
|
||||
|
||||
Route::resource('directorat', DirectoratController::class);
|
||||
Route::resource('sub-directorat', SubDirectoratController::class);
|
||||
Route::resource('job', JobController::class);
|
||||
Route::resource('sub-job', SubJobController::class);
|
||||
|
0
stubs/nwidart-stubs/assets/js/app.stub
Normal file
0
stubs/nwidart-stubs/assets/js/app.stub
Normal file
0
stubs/nwidart-stubs/assets/sass/app.stub
Normal file
0
stubs/nwidart-stubs/assets/sass/app.stub
Normal file
68
stubs/nwidart-stubs/command.stub
Normal file
68
stubs/nwidart-stubs/command.stub
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
|
||||
class $CLASS$ extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = '$COMMAND_NAME$';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description.';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command arguments.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getArguments()
|
||||
{
|
||||
return [
|
||||
['example', InputArgument::REQUIRED, 'An example argument.'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return [
|
||||
['example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null],
|
||||
];
|
||||
}
|
||||
}
|
28
stubs/nwidart-stubs/component-class.stub
Normal file
28
stubs/nwidart-stubs/component-class.stub
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class $CLASS$ extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\View\View|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('$LOWER_NAME$::$COMPONENT_NAME$');
|
||||
}
|
||||
}
|
3
stubs/nwidart-stubs/component-view.stub
Normal file
3
stubs/nwidart-stubs/component-view.stub
Normal file
@ -0,0 +1,3 @@
|
||||
<div>
|
||||
<!-- $QUOTE$ -->
|
||||
</div>
|
23
stubs/nwidart-stubs/composer.stub
Normal file
23
stubs/nwidart-stubs/composer.stub
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "$VENDOR$/$LOWER_NAME$",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "$AUTHOR_NAME$",
|
||||
"email": "$AUTHOR_EMAIL$"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"$MODULE_NAMESPACE$\\$STUDLY_NAME$\\": ""
|
||||
}
|
||||
}
|
||||
}
|
60
stubs/nwidart-stubs/controller-api.stub
Normal file
60
stubs/nwidart-stubs/controller-api.stub
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace $CLASS_NAMESPACE$;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Routing\Controller;
|
||||
|
||||
class $CLASS$ extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @return Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param Request $request
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param int $id
|
||||
* @return Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
9
stubs/nwidart-stubs/controller-plain.stub
Normal file
9
stubs/nwidart-stubs/controller-plain.stub
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace $CLASS_NAMESPACE$;
|
||||
|
||||
use Illuminate\Routing\Controller;
|
||||
|
||||
class $CLASS$ extends Controller
|
||||
{
|
||||
}
|
79
stubs/nwidart-stubs/controller.stub
Normal file
79
stubs/nwidart-stubs/controller.stub
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace $CLASS_NAMESPACE$;
|
||||
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
|
||||
class $CLASS$ extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @return Renderable
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('$LOWER_NAME$::index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @return Renderable
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('$LOWER_NAME$::create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param Request $request
|
||||
* @return Renderable
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
* @param int $id
|
||||
* @return Renderable
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('$LOWER_NAME$::show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param int $id
|
||||
* @return Renderable
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
return view('$LOWER_NAME$::edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param Request $request
|
||||
* @param int $id
|
||||
* @return Renderable
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param int $id
|
||||
* @return Renderable
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
30
stubs/nwidart-stubs/event.stub
Normal file
30
stubs/nwidart-stubs/event.stub
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class $CLASS$
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the channels the event should be broadcast on.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function broadcastOn()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
28
stubs/nwidart-stubs/factory.stub
Normal file
28
stubs/nwidart-stubs/factory.stub
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class $NAME$Factory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $model = \$MODEL_NAMESPACE$\$NAME$::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
|
22
stubs/nwidart-stubs/feature-test.stub
Normal file
22
stubs/nwidart-stubs/feature-test.stub
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\WithFaker;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
class $CLASS$ extends TestCase
|
||||
{
|
||||
/**
|
||||
* A basic feature test example.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testExample()
|
||||
{
|
||||
$response = $this->get('/');
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
}
|
34
stubs/nwidart-stubs/job-queued.stub
Normal file
34
stubs/nwidart-stubs/job-queued.stub
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
|
||||
class $CLASS$ implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
31
stubs/nwidart-stubs/job.stub
Normal file
31
stubs/nwidart-stubs/job.stub
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
|
||||
class $CLASS$ implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, Queueable;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
11
stubs/nwidart-stubs/json.stub
Normal file
11
stubs/nwidart-stubs/json.stub
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "$STUDLY_NAME$",
|
||||
"alias": "$LOWER_NAME$",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"$MODULE_NAMESPACE$\\$STUDLY_NAME$\\$PROVIDER_NAMESPACE$\\$STUDLY_NAME$ServiceProvider"
|
||||
],
|
||||
"files": []
|
||||
}
|
30
stubs/nwidart-stubs/listener-duck.stub
Normal file
30
stubs/nwidart-stubs/listener-duck.stub
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class $CLASS$
|
||||
{
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param object $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
32
stubs/nwidart-stubs/listener-queued-duck.stub
Normal file
32
stubs/nwidart-stubs/listener-queued-duck.stub
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class $CLASS$ implements ShouldQueue
|
||||
{
|
||||
use InteractsWithQueue;
|
||||
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param object $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
33
stubs/nwidart-stubs/listener-queued.stub
Normal file
33
stubs/nwidart-stubs/listener-queued.stub
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use $EVENTNAME$;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class $CLASS$ implements ShouldQueue
|
||||
{
|
||||
use InteractsWithQueue;
|
||||
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param $SHORTEVENTNAME$ $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle($SHORTEVENTNAME$ $event)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
31
stubs/nwidart-stubs/listener.stub
Normal file
31
stubs/nwidart-stubs/listener.stub
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use $EVENTNAME$;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class $CLASS$
|
||||
{
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param $SHORTEVENTNAME$ $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle($SHORTEVENTNAME$ $event)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
33
stubs/nwidart-stubs/mail.stub
Normal file
33
stubs/nwidart-stubs/mail.stub
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class $CLASS$ extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
return $this->view('view.name');
|
||||
}
|
||||
}
|
21
stubs/nwidart-stubs/middleware.stub
Normal file
21
stubs/nwidart-stubs/middleware.stub
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class $CLASS$
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
return $next($request);
|
||||
}
|
||||
}
|
32
stubs/nwidart-stubs/migration/add.stub
Normal file
32
stubs/nwidart-stubs/migration/add.stub
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('$TABLE$', function (Blueprint $table) {
|
||||
$FIELDS_UP$
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('$TABLE$', function (Blueprint $table) {
|
||||
$FIELDS_DOWN$
|
||||
});
|
||||
}
|
||||
};
|
32
stubs/nwidart-stubs/migration/create.stub
Normal file
32
stubs/nwidart-stubs/migration/create.stub
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('$TABLE$', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$FIELDS$
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('$TABLE$');
|
||||
}
|
||||
};
|
32
stubs/nwidart-stubs/migration/delete.stub
Normal file
32
stubs/nwidart-stubs/migration/delete.stub
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('$TABLE$', function (Blueprint $table) {
|
||||
$FIELDS_UP$
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('$TABLE$', function (Blueprint $table) {
|
||||
$FIELDS_DOWN$
|
||||
});
|
||||
}
|
||||
};
|
32
stubs/nwidart-stubs/migration/drop.stub
Normal file
32
stubs/nwidart-stubs/migration/drop.stub
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::dropIfExists('$TABLE$');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::create('$TABLE$', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$FIELDS$
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
};
|
28
stubs/nwidart-stubs/migration/plain.stub
Normal file
28
stubs/nwidart-stubs/migration/plain.stub
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
};
|
18
stubs/nwidart-stubs/model.stub
Normal file
18
stubs/nwidart-stubs/model.stub
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class $CLASS$ extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = $FILLABLE$;
|
||||
|
||||
protected static function newFactory()
|
||||
{
|
||||
return \$MODULE_NAMESPACE$\$MODULE$\Database\factories\$NAME$Factory::new();
|
||||
}
|
||||
}
|
61
stubs/nwidart-stubs/notification.stub
Normal file
61
stubs/nwidart-stubs/notification.stub
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
|
||||
class $CLASS$ extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
/**
|
||||
* Create a new notification instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the notification's delivery channels.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
return ['mail'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mail representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
return (new MailMessage)
|
||||
->line('The introduction to the notification.')
|
||||
->action('Notification Action', 'https://laravel.com')
|
||||
->line('Thank you for using our application!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
16
stubs/nwidart-stubs/package.stub
Normal file
16
stubs/nwidart-stubs/package.stub
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"axios": "^0.21.4",
|
||||
"dotenv": "^10.0.0",
|
||||
"dotenv-expand": "^5.1.0",
|
||||
"laravel-vite-plugin": "^0.6.0",
|
||||
"lodash": "^4.17.21",
|
||||
"postcss": "^8.3.7",
|
||||
"vite": "^3.0.9"
|
||||
}
|
||||
}
|
20
stubs/nwidart-stubs/policy.plain.stub
Normal file
20
stubs/nwidart-stubs/policy.plain.stub
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class $CLASS$
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
/**
|
||||
* Create a new policy instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
28
stubs/nwidart-stubs/provider.stub
Normal file
28
stubs/nwidart-stubs/provider.stub
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class $CLASS$ extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
30
stubs/nwidart-stubs/request.stub
Normal file
30
stubs/nwidart-stubs/request.stub
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class $CLASS$ extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
19
stubs/nwidart-stubs/resource-collection.stub
Normal file
19
stubs/nwidart-stubs/resource-collection.stub
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
|
||||
class $CLASS$ extends ResourceCollection
|
||||
{
|
||||
/**
|
||||
* Transform the resource collection into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return parent::toArray($request);
|
||||
}
|
||||
}
|
19
stubs/nwidart-stubs/resource.stub
Normal file
19
stubs/nwidart-stubs/resource.stub
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class $CLASS$ extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return parent::toArray($request);
|
||||
}
|
||||
}
|
69
stubs/nwidart-stubs/route-provider.stub
Normal file
69
stubs/nwidart-stubs/route-provider.stub
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class $CLASS$ extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The module namespace to assume when generating URLs to actions.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $moduleNamespace = '$MODULE_NAMESPACE$\$MODULE$\$CONTROLLER_NAMESPACE$';
|
||||
|
||||
/**
|
||||
* Called before routes are registered.
|
||||
*
|
||||
* Register any model bindings or pattern based filters.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map()
|
||||
{
|
||||
$this->mapApiRoutes();
|
||||
|
||||
$this->mapWebRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapWebRoutes()
|
||||
{
|
||||
Route::middleware('web')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('$MODULE$', '$WEB_ROUTES_PATH$'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapApiRoutes()
|
||||
{
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('$MODULE$', '$API_ROUTES_PATH$'));
|
||||
}
|
||||
}
|
18
stubs/nwidart-stubs/routes/api.stub
Normal file
18
stubs/nwidart-stubs/routes/api.stub
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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:api')->get('/$LOWER_NAME$', function (Request $request) {
|
||||
return $request->user();
|
||||
});
|
16
stubs/nwidart-stubs/routes/web.stub
Normal file
16
stubs/nwidart-stubs/routes/web.stub
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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::prefix('$LOWER_NAME$')->group(function() {
|
||||
Route::get('/', '$STUDLY_NAME$Controller@index');
|
||||
});
|
40
stubs/nwidart-stubs/rule.stub
Normal file
40
stubs/nwidart-stubs/rule.stub
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Contracts\Validation\Rule;
|
||||
|
||||
class $CLASS$ implements Rule
|
||||
{
|
||||
/**
|
||||
* Create a new rule instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the validation rule passes.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function passes($attribute, $value)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation error message.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function message()
|
||||
{
|
||||
return 'The validation error message.';
|
||||
}
|
||||
}
|
5
stubs/nwidart-stubs/scaffold/config.stub
Normal file
5
stubs/nwidart-stubs/scaffold/config.stub
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => '$STUDLY_NAME$'
|
||||
];
|
114
stubs/nwidart-stubs/scaffold/provider.stub
Normal file
114
stubs/nwidart-stubs/scaffold/provider.stub
Normal file
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Database\Eloquent\Factory;
|
||||
|
||||
class $CLASS$ extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* @var string $moduleName
|
||||
*/
|
||||
protected $moduleName = '$MODULE$';
|
||||
|
||||
/**
|
||||
* @var string $moduleNameLower
|
||||
*/
|
||||
protected $moduleNameLower = '$LOWER_NAME$';
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
$this->loadMigrationsFrom(module_path($this->moduleName, '$MIGRATIONS_PATH$'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerConfig()
|
||||
{
|
||||
$this->publishes([
|
||||
module_path($this->moduleName, '$PATH_CONFIG$/config.php') => config_path($this->moduleNameLower . '.php'),
|
||||
], 'config');
|
||||
$this->mergeConfigFrom(
|
||||
module_path($this->moduleName, '$PATH_CONFIG$/config.php'), $this->moduleNameLower
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerViews()
|
||||
{
|
||||
$viewPath = resource_path('views/modules/' . $this->moduleNameLower);
|
||||
|
||||
$sourcePath = module_path($this->moduleName, '$PATH_VIEWS$');
|
||||
|
||||
$this->publishes([
|
||||
$sourcePath => $viewPath
|
||||
], ['views', $this->moduleNameLower . '-module-views']);
|
||||
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerTranslations()
|
||||
{
|
||||
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom($langPath);
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path($this->moduleName, '$PATH_LANG$'), $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom(module_path($this->moduleName, '$PATH_LANG$'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
private function getPublishableViewPaths(): array
|
||||
{
|
||||
$paths = [];
|
||||
foreach (\Config::get('view.paths') as $path) {
|
||||
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
|
||||
$paths[] = $path . '/modules/' . $this->moduleNameLower;
|
||||
}
|
||||
}
|
||||
return $paths;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user