Scaffolding for Installer module
This commit is contained in:
@@ -3,5 +3,6 @@
|
|||||||
/*
|
/*
|
||||||
/*/
|
/*/
|
||||||
!.gitignore
|
!.gitignore
|
||||||
|
!/Installer
|
||||||
!/Sample
|
!/Sample
|
||||||
!/Vacentral
|
!/Vacentral
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'name' => 'Installer'
|
||||||
|
];
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Installer\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\AppBaseController;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
|
||||||
|
class AdminController extends AppBaseController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return view('installer::admin.index');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('installer::admin.create');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
*/
|
||||||
|
public function show()
|
||||||
|
{
|
||||||
|
return view('installer::admin.show');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit()
|
||||||
|
{
|
||||||
|
return view('installer::admin.edit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Installer\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\AppBaseController;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
|
||||||
|
class InstallerController extends AppBaseController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return view('installer::index');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('installer::create');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
* @param Request $request
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
*/
|
||||||
|
public function show()
|
||||||
|
{
|
||||||
|
return view('installer::show');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit()
|
||||||
|
{
|
||||||
|
return view('installer::edit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
Route::group(['middleware' => []], function() {
|
||||||
|
|
||||||
|
Route::get('/', 'InstallerController@index');
|
||||||
|
|
||||||
|
});
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Installer\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||||
|
|
||||||
|
class EventServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The event listener mappings for the application.
|
||||||
|
*/
|
||||||
|
protected $listen = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register any events for your application.
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
parent::boot();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Installer\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use Illuminate\Database\Eloquent\Factory;
|
||||||
|
use Route;
|
||||||
|
|
||||||
|
|
||||||
|
class InstallerServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
protected $defer = false;
|
||||||
|
protected $moduleSvc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boot the application events.
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
$this->moduleSvc = app('App\Services\ModuleService');
|
||||||
|
|
||||||
|
$this->registerRoutes();
|
||||||
|
$this->registerTranslations();
|
||||||
|
$this->registerConfig();
|
||||||
|
$this->registerViews();
|
||||||
|
|
||||||
|
$this->registerLinks();
|
||||||
|
|
||||||
|
$this->registerFactories();
|
||||||
|
$this->loadMigrationsFrom(__DIR__ . '/../Database/migrations');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the service provider.
|
||||||
|
*/
|
||||||
|
public function register()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add module links here
|
||||||
|
*/
|
||||||
|
public function registerLinks()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the routes
|
||||||
|
*/
|
||||||
|
protected function registerRoutes()
|
||||||
|
{
|
||||||
|
Route::group([
|
||||||
|
'as' => 'installer.',
|
||||||
|
'prefix' => 'installer',
|
||||||
|
// If you want a RESTful module, change this to 'api'
|
||||||
|
'middleware' => ['web'],
|
||||||
|
'namespace' => 'Modules\Installer\Http\Controllers'
|
||||||
|
], function() {
|
||||||
|
$this->loadRoutesFrom(__DIR__ . '/../Http/routes.php');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register config.
|
||||||
|
*/
|
||||||
|
protected function registerConfig()
|
||||||
|
{
|
||||||
|
$this->publishes([
|
||||||
|
__DIR__.'/../Config/config.php' => config_path('installer.php'),
|
||||||
|
], 'config');
|
||||||
|
|
||||||
|
$this->mergeConfigFrom(
|
||||||
|
__DIR__.'/../Config/config.php', 'installer'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register views.
|
||||||
|
*/
|
||||||
|
public function registerViews()
|
||||||
|
{
|
||||||
|
$viewPath = resource_path('views/modules/installer');
|
||||||
|
$sourcePath = __DIR__.'/../Resources/views';
|
||||||
|
|
||||||
|
$this->publishes([
|
||||||
|
$sourcePath => $viewPath
|
||||||
|
],'views');
|
||||||
|
|
||||||
|
$this->loadViewsFrom(array_merge(array_map(function ($path) {
|
||||||
|
return $path . '/modules/installer';
|
||||||
|
}, \Config::get('view.paths')), [$sourcePath]), 'installer');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register translations.
|
||||||
|
*/
|
||||||
|
public function registerTranslations()
|
||||||
|
{
|
||||||
|
$langPath = resource_path('lang/modules/installer');
|
||||||
|
|
||||||
|
if (is_dir($langPath)) {
|
||||||
|
$this->loadTranslationsFrom($langPath, 'installer');
|
||||||
|
} else {
|
||||||
|
$this->loadTranslationsFrom(__DIR__ .'/../Resources/lang', 'installer');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register an additional directory of factories.
|
||||||
|
* @source https://github.com/sebastiaanluca/laravel-resource-flow/blob/develop/src/Modules/ModuleServiceProvider.php#L66
|
||||||
|
*/
|
||||||
|
public function registerFactories()
|
||||||
|
{
|
||||||
|
if (! app()->environment('production')) {
|
||||||
|
app(Factory::class)->load(__DIR__ . '/../Database/factories');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the services provided by the provider.
|
||||||
|
*/
|
||||||
|
public function provides()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
@extends('installer::layouts.admin')
|
||||||
|
|
||||||
|
@section('title', 'Installer')
|
||||||
|
@section('actions')
|
||||||
|
<li>
|
||||||
|
<a href="{!! url('/installer/admin/create') !!}">
|
||||||
|
<i class="ti-plus"></i>
|
||||||
|
Add New</a>
|
||||||
|
</li>
|
||||||
|
@endsection
|
||||||
|
@section('content')
|
||||||
|
<div class="card border-blue-bottom">
|
||||||
|
<div class="header"><h4 class="title">Admin Scaffold!</h4></div>
|
||||||
|
<div class="content">
|
||||||
|
<p>This view is loaded from module: {!! config('installer.name') !!}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
@extends('installer::layouts.frontend')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<h1>Hello World</h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
This view is loaded from module: {!! config('installer.name') !!}
|
||||||
|
</p>
|
||||||
|
@endsection
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
{{--
|
||||||
|
You probably don't want to edit anything here. Just make
|
||||||
|
sure to extend this in your views. It will pass the content section through
|
||||||
|
--}}
|
||||||
|
@extends('admin.app')
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
{{--
|
||||||
|
You probably don't want to edit anything here. Just make
|
||||||
|
sure to extend this in your views. It will pass the content section through
|
||||||
|
--}}
|
||||||
|
@extends('layouts.' . config('phpvms.skin') . '.app')
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"name": "/installer",
|
||||||
|
"description": "",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"email": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"Modules\\Installer\\Providers\\InstallerServiceProvider",
|
||||||
|
"Modules\\Installer\\Providers\\EventServiceProvider"
|
||||||
|
],
|
||||||
|
"aliases": {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Modules\\Installer\\": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "Installer",
|
||||||
|
"alias": "installer",
|
||||||
|
"description": "",
|
||||||
|
"keywords": [],
|
||||||
|
"active": 1,
|
||||||
|
"order": 0,
|
||||||
|
"providers": [
|
||||||
|
"Modules\\Installer\\Providers\\InstallerServiceProvider",
|
||||||
|
"Modules\\Installer\\Providers\\EventServiceProvider"
|
||||||
|
],
|
||||||
|
"aliases": {},
|
||||||
|
"files": [],
|
||||||
|
"requires": []
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user