* Remove the Sample module * 593-Fix-Modules-From-Composer * Fix pre/post install scripts in composer #593 * Formatting
This commit is contained in:
1
modules/.gitignore
vendored
1
modules/.gitignore
vendored
@@ -6,6 +6,5 @@
|
||||
!/Awards
|
||||
!/Importer
|
||||
!/Installer
|
||||
!/Sample
|
||||
!/Updater
|
||||
!/Vacentral
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Sample\Awards;
|
||||
|
||||
use App\Contracts\Award;
|
||||
|
||||
/**
|
||||
* Class SampleAward
|
||||
*/
|
||||
class SampleAward extends Award
|
||||
{
|
||||
public $name = 'Sample Award';
|
||||
|
||||
/**
|
||||
* This is the method that needs to be implemented.
|
||||
* You have access to $this->user, which holds the current
|
||||
* user the award is being checked against
|
||||
*
|
||||
* @param null $params Parameters passed in from the UI
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function check($params = null): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'Sample',
|
||||
];
|
||||
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Sample\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class SampleDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Model::unguard();
|
||||
|
||||
// $this->call("OthersTableSeeder");
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Sample\Http\Controllers\Admin;
|
||||
|
||||
use App\Contracts\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* Class AdminController
|
||||
*/
|
||||
class AdminController extends Controller
|
||||
{
|
||||
/**
|
||||
* 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,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Sample\Http\Controllers\Api;
|
||||
|
||||
use App\Contracts\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* Class SampleController
|
||||
*/
|
||||
class SampleController extends Controller
|
||||
{
|
||||
/**
|
||||
* Just send out a message
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
return $this->message('Hello, world!');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function hello(Request $request)
|
||||
{
|
||||
// Another way to return JSON, this for a custom response
|
||||
// It's recommended to use Resources for responses from the database
|
||||
return response()->json([
|
||||
'name' => Auth::user()->name,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Sample\Http\Controllers;
|
||||
|
||||
use App\Contracts\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* Class SampleController
|
||||
*/
|
||||
class SampleController extends Controller
|
||||
{
|
||||
/**
|
||||
* 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,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
// This is the admin path. Comment this out if you don't have
|
||||
// an admin panel component.
|
||||
Route::group([], function () {
|
||||
Route::get('/', 'AdminController@index');
|
||||
Route::get('/create', 'AdminController@create');
|
||||
});
|
||||
@@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This is publicly accessible
|
||||
*/
|
||||
Route::group(['middleware' => []], function () {
|
||||
Route::get('/', 'SampleController@index');
|
||||
});
|
||||
|
||||
/*
|
||||
* This is required to have a valid API key
|
||||
*/
|
||||
Route::group(['middleware' => [
|
||||
'api.auth',
|
||||
]], function () {
|
||||
Route::get('/hello', 'SampleController@hello');
|
||||
});
|
||||
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
Route::group(['middleware' => [
|
||||
'role: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');
|
||||
});
|
||||
@@ -1,17 +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,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Sample\Models;
|
||||
|
||||
use App\Contracts\Model;
|
||||
|
||||
/**
|
||||
* Class SampleTable
|
||||
*/
|
||||
class SampleTable extends Model
|
||||
{
|
||||
public $table = '';
|
||||
|
||||
protected $fillable = [];
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Sample\Providers;
|
||||
|
||||
use App\Events\TestEvent;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
use Modules\Sample\Listeners\TestEventListener;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event listener mappings for the application.
|
||||
*/
|
||||
protected $listen = [
|
||||
TestEvent::class => [TestEventListener::class],
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any events for your application.
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
parent::boot();
|
||||
}
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Sample\Providers;
|
||||
|
||||
use App\Services\ModuleService;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Route;
|
||||
|
||||
class SampleServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected $moduleSvc;
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->moduleSvc = app(ModuleService::class);
|
||||
|
||||
$this->registerRoutes();
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
|
||||
$this->registerLinks();
|
||||
|
||||
$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', '/admin/sample');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the routes
|
||||
*/
|
||||
protected function registerRoutes()
|
||||
{
|
||||
/*
|
||||
* Routes for the frontend
|
||||
*/
|
||||
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/web.php');
|
||||
});
|
||||
|
||||
/*
|
||||
* Routes for the admin
|
||||
*/
|
||||
Route::group([
|
||||
'as' => 'sample.',
|
||||
'prefix' => 'admin/sample',
|
||||
// If you want a RESTful module, change this to 'api'
|
||||
'middleware' => ['web', 'role:admin'],
|
||||
'namespace' => 'Modules\Sample\Http\Controllers\Admin',
|
||||
], function () {
|
||||
$this->loadRoutesFrom(__DIR__.'/../Http/Routes/admin.php');
|
||||
});
|
||||
|
||||
/*
|
||||
* Routes for an API
|
||||
*/
|
||||
Route::group([
|
||||
'as' => 'sample.',
|
||||
'prefix' => 'api/sample',
|
||||
// If you want a RESTful module, change this to 'api'
|
||||
'middleware' => ['api'],
|
||||
'namespace' => 'Modules\Sample\Http\Controllers\Api',
|
||||
], function () {
|
||||
$this->loadRoutesFrom(__DIR__.'/../Http/Routes/api.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');
|
||||
|
||||
$paths = array_map(
|
||||
function ($path) {
|
||||
return $path.'/modules/sample';
|
||||
},
|
||||
\Config::get('view.paths')
|
||||
);
|
||||
|
||||
$paths[] = $sourcePath;
|
||||
$this->loadViewsFrom($paths, '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');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*/
|
||||
public function provides(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
@extends('sample::layouts.admin')
|
||||
|
||||
@section('title', 'Sample Create')
|
||||
@section('actions')
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="content">
|
||||
<div class="header"><h4 class="title">Create something!</h4></div>
|
||||
<p>Add a form!</p>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -1,18 +0,0 @@
|
||||
@extends('sample::layouts.admin')
|
||||
|
||||
@section('title', 'Sample')
|
||||
@section('actions')
|
||||
<li>
|
||||
<a href="{{ url('/admin/sample/create') }}">
|
||||
<i class="ti-plus"></i>
|
||||
Add New</a>
|
||||
</li>
|
||||
@endsection
|
||||
@section('content')
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="content">
|
||||
<div class="header"><h4 class="title">Admin Scaffold!</h4></div>
|
||||
<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('app')
|
||||
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"name": "phpvms/sample-module",
|
||||
"type": "laravel-module",
|
||||
"description": "",
|
||||
"require": {
|
||||
"joshbrw/laravel-module-installer": "0.1.x"
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Modules\\Sample\\Providers\\SampleServiceProvider",
|
||||
"Modules\\Sample\\Providers\\EventServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\Sample\\": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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": []
|
||||
}
|
||||
Reference in New Issue
Block a user