swap the modules
This commit is contained in:
4
modules/.gitignore
vendored
4
modules/.gitignore
vendored
@@ -3,5 +3,5 @@
|
|||||||
/*
|
/*
|
||||||
/*/
|
/*/
|
||||||
!.gitignore
|
!.gitignore
|
||||||
!/Sample/
|
!/Sample
|
||||||
!/vacentral/
|
!/vacentral
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return [
|
|
||||||
'name' => 'Sample'
|
|
||||||
];
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Modules\Sample\Database\Seeders;
|
|
||||||
|
|
||||||
use Illuminate\Database\Seeder;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class SampleDatabaseSeeder extends Seeder
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the database seeds.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function run()
|
|
||||||
{
|
|
||||||
Model::unguard();
|
|
||||||
|
|
||||||
// $this->call("OthersTableSeeder");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Modules\Sample\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('sample::admin.index');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the form for creating a new resource.
|
|
||||||
*/
|
|
||||||
public function create()
|
|
||||||
{
|
|
||||||
return view('sample::admin.create');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Store a newly created resource in storage.
|
|
||||||
*/
|
|
||||||
public function store(Request $request)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the specified resource.
|
|
||||||
*/
|
|
||||||
public function show()
|
|
||||||
{
|
|
||||||
return view('sample::admin.show');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the form for editing the specified resource.
|
|
||||||
*/
|
|
||||||
public function edit()
|
|
||||||
{
|
|
||||||
return view('sample::admin.edit');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the specified resource in storage.
|
|
||||||
*/
|
|
||||||
public function update(Request $request)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the specified resource from storage.
|
|
||||||
*/
|
|
||||||
public function destroy()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Modules\Sample\Http\Controllers;
|
|
||||||
|
|
||||||
use App\Http\Controllers\AppBaseController;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
|
|
||||||
|
|
||||||
class SampleController extends AppBaseController
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Display a listing of the resource.
|
|
||||||
*/
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
return view('sample::index');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the form for creating a new resource.
|
|
||||||
*/
|
|
||||||
public function create()
|
|
||||||
{
|
|
||||||
return view('sample::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('sample::show');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the form for editing the specified resource.
|
|
||||||
*/
|
|
||||||
public function edit()
|
|
||||||
{
|
|
||||||
return view('sample::edit');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the specified resource in storage.
|
|
||||||
*/
|
|
||||||
public function update(Request $request)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the specified resource from storage.
|
|
||||||
*/
|
|
||||||
public function destroy()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
Route::group(['middleware' => [
|
|
||||||
'role:admin|user' # leave blank to make this public
|
|
||||||
]], function() {
|
|
||||||
|
|
||||||
# all your routes are prefixed with the above prefix
|
|
||||||
# e.g. yoursite.com/sample
|
|
||||||
Route::get('/', 'SampleController@index');
|
|
||||||
|
|
||||||
# This is the admin path. Comment this out if you don't have
|
|
||||||
# an admin panel component.
|
|
||||||
Route::group([
|
|
||||||
'middleware' => ['role:admin'],
|
|
||||||
], function () {
|
|
||||||
Route::get('/admin', 'AdminController@index');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Modules\Sample\Listeners;
|
|
||||||
|
|
||||||
use App\Events\TestEvent;
|
|
||||||
use Log;
|
|
||||||
|
|
||||||
class TestEventListener
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Handle the event.
|
|
||||||
*/
|
|
||||||
public function handle(TestEvent $event) {
|
|
||||||
Log::info('Received event', [$event]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,132 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Modules\Sample\Providers;
|
|
||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
|
||||||
use Illuminate\Database\Eloquent\Factory;
|
|
||||||
use Route;
|
|
||||||
|
|
||||||
|
|
||||||
class SampleServiceProvider 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()
|
|
||||||
{
|
|
||||||
// Show this link if logged in
|
|
||||||
// $this->moduleSvc->addFrontendLink('Sample', '/sample', '', $logged_in=true);
|
|
||||||
|
|
||||||
// Admin links:
|
|
||||||
$this->moduleSvc->addAdminLink('Sample', '/sample/admin');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register the routes
|
|
||||||
*/
|
|
||||||
protected function registerRoutes()
|
|
||||||
{
|
|
||||||
Route::group([
|
|
||||||
'as' => 'sample.',
|
|
||||||
'prefix' => 'sample',
|
|
||||||
// If you want a RESTful module, change this to 'api'
|
|
||||||
'middleware' => ['web'],
|
|
||||||
'namespace' => 'Modules\Sample\Http\Controllers'
|
|
||||||
], function() {
|
|
||||||
$this->loadRoutesFrom(__DIR__ . '/../Http/routes.php');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register config.
|
|
||||||
*/
|
|
||||||
protected function registerConfig()
|
|
||||||
{
|
|
||||||
$this->publishes([
|
|
||||||
__DIR__.'/../Config/config.php' => config_path('sample.php'),
|
|
||||||
], 'config');
|
|
||||||
|
|
||||||
$this->mergeConfigFrom(
|
|
||||||
__DIR__.'/../Config/config.php', 'sample'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register views.
|
|
||||||
*/
|
|
||||||
public function registerViews()
|
|
||||||
{
|
|
||||||
$viewPath = resource_path('views/modules/sample');
|
|
||||||
$sourcePath = __DIR__.'/../Resources/views';
|
|
||||||
|
|
||||||
$this->publishes([
|
|
||||||
$sourcePath => $viewPath
|
|
||||||
],'views');
|
|
||||||
|
|
||||||
$this->loadViewsFrom(array_merge(array_map(function ($path) {
|
|
||||||
return $path . '/modules/sample';
|
|
||||||
}, \Config::get('view.paths')), [$sourcePath]), 'sample');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register translations.
|
|
||||||
*/
|
|
||||||
public function registerTranslations()
|
|
||||||
{
|
|
||||||
$langPath = resource_path('lang/modules/sample');
|
|
||||||
|
|
||||||
if (is_dir($langPath)) {
|
|
||||||
$this->loadTranslationsFrom($langPath, 'sample');
|
|
||||||
} else {
|
|
||||||
$this->loadTranslationsFrom(__DIR__ .'/../Resources/lang', 'sample');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
@extends('sample::layouts.admin')
|
|
||||||
|
|
||||||
@section('title', 'Sample')
|
|
||||||
@section('actions')
|
|
||||||
<li>
|
|
||||||
<a href="{!! url('/sample/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('sample.name') !!}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endsection
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
@extends('sample::layouts.frontend')
|
|
||||||
|
|
||||||
@section('content')
|
|
||||||
<h1>Hello World</h1>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
This view is loaded from module: {!! config('sample.name') !!}
|
|
||||||
</p>
|
|
||||||
@endsection
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
{{--
|
|
||||||
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')
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
{{--
|
|
||||||
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')
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "Sample",
|
|
||||||
"alias": "sample",
|
|
||||||
"description": "",
|
|
||||||
"keywords": [],
|
|
||||||
"active": 1,
|
|
||||||
"order": 0,
|
|
||||||
"providers": [
|
|
||||||
"Modules\\Sample\\Providers\\SampleServiceProvider",
|
|
||||||
"Modules\\Sample\\Providers\\EventServiceProvider"
|
|
||||||
],
|
|
||||||
"aliases": {},
|
|
||||||
"files": [],
|
|
||||||
"requires": []
|
|
||||||
}
|
|
||||||
5
modules/vacentral/Config/config.php
Normal file
5
modules/vacentral/Config/config.php
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'name' => 'vacentral'
|
||||||
|
];
|
||||||
18
modules/vacentral/Listeners/PirepAcceptedEventListener.php
Normal file
18
modules/vacentral/Listeners/PirepAcceptedEventListener.php
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Vacentral\Listeners;
|
||||||
|
|
||||||
|
use Log;
|
||||||
|
use App\Events\PirepAccepted;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
|
||||||
|
class PirepAcceptedEventListener implements ShouldQueue
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle the event.
|
||||||
|
*/
|
||||||
|
public function handle(PirepAccepted $pirep) {
|
||||||
|
Log::info('Received event', [$pirep]);
|
||||||
|
}
|
||||||
|
}
|
||||||
38
modules/vacentral/Providers/AppServiceProvider.php
Normal file
38
modules/vacentral/Providers/AppServiceProvider.php
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Vacentral\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
class AppServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Boot the application events.
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
$this->registerConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the service provider.
|
||||||
|
*/
|
||||||
|
public function register()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register config.
|
||||||
|
*/
|
||||||
|
protected function registerConfig()
|
||||||
|
{
|
||||||
|
$this->publishes([
|
||||||
|
__DIR__.'/../Config/config.php' => config_path('vacentral.php'),
|
||||||
|
], 'config');
|
||||||
|
|
||||||
|
$this->mergeConfigFrom(
|
||||||
|
__DIR__.'/../Config/config.php', 'vacentral'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Modules\Sample\Providers;
|
namespace Modules\Vacentral\Providers;
|
||||||
|
|
||||||
use App\Events\TestEvent;
|
use App\Events\PirepAccepted;
|
||||||
use Modules\Sample\Listeners\TestEventListener;
|
use Modules\Vacentral\Listeners\PirepAcceptedEventListener;
|
||||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||||
|
|
||||||
class EventServiceProvider extends ServiceProvider
|
class EventServiceProvider extends ServiceProvider
|
||||||
@@ -12,7 +12,7 @@ class EventServiceProvider extends ServiceProvider
|
|||||||
* The event listener mappings for the application.
|
* The event listener mappings for the application.
|
||||||
*/
|
*/
|
||||||
protected $listen = [
|
protected $listen = [
|
||||||
TestEvent::class => [TestEventListener::class],
|
PirepAccepted::class => [PirepAcceptedEventListener::class],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "nabeel/sample",
|
"name": "nabeel/vacentral",
|
||||||
"type": "laravel-module",
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"type": "laravel-module",
|
||||||
"description": "",
|
"description": "",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
@@ -15,8 +15,8 @@
|
|||||||
"extra": {
|
"extra": {
|
||||||
"laravel": {
|
"laravel": {
|
||||||
"providers": [
|
"providers": [
|
||||||
"Modules\\Sample\\Providers\\SampleServiceProvider",
|
"Modules\\Vacentral\\Providers\\AppServiceProvider",
|
||||||
"Modules\\Sample\\Providers\\EventServiceProvider"
|
"Modules\\Vacentral\\Providers\\EventServiceProvider"
|
||||||
],
|
],
|
||||||
"aliases": {
|
"aliases": {
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Modules\\Sample\\": ""
|
"Modules\\Vacentral\\": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
15
modules/vacentral/module.json
Normal file
15
modules/vacentral/module.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "vacentral",
|
||||||
|
"alias": "",
|
||||||
|
"description": "",
|
||||||
|
"keywords": [],
|
||||||
|
"active": 1,
|
||||||
|
"order": 0,
|
||||||
|
"providers": [
|
||||||
|
"Modules\\Vacentral\\Providers\\AppServiceProvider",
|
||||||
|
"Modules\\Vacentral\\Providers\\EventServiceProvider"
|
||||||
|
],
|
||||||
|
"aliases": {},
|
||||||
|
"files": [],
|
||||||
|
"requires": []
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user