Merge branch 'testing-modules' into dev

This commit is contained in:
Michal Kváček
2016-01-21 11:33:52 +01:00
28 changed files with 267 additions and 52 deletions
+1
View File
@@ -27,6 +27,7 @@ class AppServiceProvider extends ServiceProvider
$this->app->register('Iber\Generator\ModelGeneratorProvider');
}
// register PingPong module extension
$this->app->register('Pingpong\Modules\ModulesServiceProvider');
}
}
Regular → Executable
View File
+57 -52
View File
@@ -1,55 +1,60 @@
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"phpmailer/phpmailer": "^5.2",
"pingpong/modules": "~2.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*",
"ignasbernotas/laravel-model-generator": "^1.0"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"pre-update-cmd": [
"php artisan clear-compiled"
],
"post-update-cmd": [
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"phpmailer/phpmailer": "^5.2",
"pingpong/modules": "~2.0",
"league/flysystem": "^1.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*",
"ignasbernotas/laravel-model-generator": "^1.0"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/",
"Modules\\": "modules/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"pre-update-cmd": [
"php artisan clear-compiled"
],
"post-update-cmd": [
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}
+1
View File
@@ -147,6 +147,7 @@ return [
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
Pingpong\Modules\ModulesServiceProvider::class,
/*
* Application Service Providers...
+5
View File
@@ -0,0 +1,5 @@
<?php
return [
'name' => 'TestingModule'
];
@@ -0,0 +1,20 @@
<?php namespace Modules\Testingmodule\Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
class TestingModuleDatabaseSeeder extends Seeder {
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
// $this->call("OthersTableSeeder");
}
}
@@ -0,0 +1,12 @@
<?php namespace Modules\Testingmodule\Http\Controllers;
use Pingpong\Modules\Routing\Controller;
class TestingModuleController extends Controller {
public function index()
{
return view('testingmodule::index');
}
}
+6
View File
@@ -0,0 +1,6 @@
<?php
Route::group(['middleware' => 'web', 'prefix' => 'testingmodule', 'namespace' => 'Modules\TestingModule\Http\Controllers'], function()
{
Route::get('/', 'TestingModuleController@index');
});
@@ -0,0 +1,97 @@
<?php namespace Modules\Testingmodule\Providers;
use Illuminate\Support\ServiceProvider;
class TestingModuleServiceProvider extends ServiceProvider {
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Boot the application events.
*
* @return void
*/
public function boot()
{
$this->registerTranslations();
$this->registerConfig();
$this->registerViews();
}
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
//
}
/**
* Register config.
*
* @return void
*/
protected function registerConfig()
{
$this->publishes([
__DIR__.'/../Config/config.php' => config_path('testingmodule.php'),
]);
$this->mergeConfigFrom(
__DIR__.'/../Config/config.php', 'testingmodule'
);
}
/**
* Register views.
*
* @return void
*/
public function registerViews()
{
$viewPath = base_path('resources/views/modules/testingmodule');
$sourcePath = __DIR__.'/../Resources/views';
$this->publishes([
$sourcePath => $viewPath
]);
$this->loadViewsFrom(array_merge(array_map(function ($path) {
return $path . '/modules/testingmodule';
}, \Config::get('view.paths')), [$sourcePath]), 'testingmodule');
}
/**
* Register translations.
*
* @return void
*/
public function registerTranslations()
{
$langPath = base_path('resources/lang/modules/testingmodule');
if (is_dir($langPath)) {
$this->loadTranslationsFrom($langPath, 'testingmodule');
} else {
$this->loadTranslationsFrom(__DIR__ .'/../Resources/lang', 'testingmodule');
}
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return array();
}
}
@@ -0,0 +1,11 @@
@extends('testingmodule::layouts.master')
@section('content')
<h1>Hello World</h1>
<p>
This view is loaded from module: {!! config('testingmodule.name') !!}
</p>
@stop
@@ -0,0 +1,12 @@
<!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 TestingModule</title>
</head>
<body>
@yield('content')
</body>
</html>
+15
View File
@@ -0,0 +1,15 @@
{
"name": "pingpong-modules/testingmodule",
"description": "",
"authors": [
{
"name": "Pingpong Labs",
"email": "pingpong.labs@gmail.com"
}
],
"autoload": {
"psr-4": {
"Modules\\TestingModule\\": ""
}
}
}
+15
View File
@@ -0,0 +1,15 @@
{
"name": "TestingModule",
"alias": "testingmodule",
"description": "",
"keywords": [],
"active": 1,
"order": 0,
"providers": [
"Modules\\TestingModule\\Providers\\TestingModuleServiceProvider"
],
"aliases":{},
"files": [
"start.php"
]
}
+15
View File
@@ -0,0 +1,15 @@
<?php
/*
|--------------------------------------------------------------------------
| Register Namespaces And Routes
|--------------------------------------------------------------------------
|
| When a module starting, this file will executed automatically. This helps
| to register some namespaces like translator or view. Also this file
| will load the routes file for each module. You may also modify
| this file as you want.
|
*/
require __DIR__ . '/Http/routes.php';