* #355 Calculate distance button in add/edit Flight page * Styling * Move add/edit flight logic out of controller and into service layer * Styling * Formatting * Run styleci against modules dir * Styleci config * Style fixes in /modules
This commit is contained in:
@@ -6,7 +6,6 @@ use App\Contracts\Award;
|
||||
|
||||
/**
|
||||
* Class SampleAward
|
||||
* @package Modules\Sample\Awards
|
||||
*/
|
||||
class SampleAward extends Award
|
||||
{
|
||||
@@ -16,7 +15,9 @@ class SampleAward extends 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'Sample'
|
||||
'name' => 'Sample',
|
||||
];
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Modules\Sample\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class SampleDatabaseSeeder extends Seeder
|
||||
{
|
||||
|
||||
@@ -7,7 +7,6 @@ use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* Class AdminController
|
||||
* @package Modules\Sample\Http\Controllers\Admin
|
||||
*/
|
||||
class AdminController extends Controller
|
||||
{
|
||||
|
||||
@@ -7,13 +7,14 @@ use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* Class SampleController
|
||||
* @package Modules\Sample\Http\Controllers\Api
|
||||
*/
|
||||
class SampleController extends Controller
|
||||
{
|
||||
/**
|
||||
* Just send out a message
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function index(Request $request)
|
||||
@@ -23,6 +24,7 @@ class SampleController extends Controller
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function hello(Request $request)
|
||||
@@ -33,5 +35,4 @@ class SampleController extends Controller
|
||||
'name' => Auth::user()->name,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* Class SampleController
|
||||
* @package Modules\Sample\Http\Controllers
|
||||
*/
|
||||
class SampleController extends Controller
|
||||
{
|
||||
@@ -29,7 +28,8 @@ class SampleController extends Controller
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param Request $request
|
||||
*
|
||||
* @param Request $request
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
# This is the admin path. Comment this out if you don't have
|
||||
# an admin panel component.
|
||||
// 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');
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
/**
|
||||
* This is publicly accessible
|
||||
*/
|
||||
Route::group(['middleware' => []], function() {
|
||||
Route::group(['middleware' => []], function () {
|
||||
Route::get('/', 'SampleController@index');
|
||||
});
|
||||
|
||||
/**
|
||||
/*
|
||||
* This is required to have a valid API key
|
||||
*/
|
||||
Route::group(['middleware' => [
|
||||
'api.auth'
|
||||
]], function() {
|
||||
'api.auth',
|
||||
]], function () {
|
||||
Route::get('/hello', 'SampleController@hello');
|
||||
});
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?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
|
||||
'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');
|
||||
});
|
||||
|
||||
@@ -10,7 +10,8 @@ class TestEventListener
|
||||
/**
|
||||
* Handle the event.
|
||||
*/
|
||||
public function handle(TestEvent $event) {
|
||||
public function handle(TestEvent $event)
|
||||
{
|
||||
Log::info('Received event', [$event]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ use App\Contracts\Model;
|
||||
|
||||
/**
|
||||
* Class SampleTable
|
||||
* @package Modules\Sample\Models
|
||||
*/
|
||||
class SampleTable extends Model
|
||||
{
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace Modules\Sample\Providers;
|
||||
|
||||
use App\Events\TestEvent;
|
||||
use Modules\Sample\Listeners\TestEventListener;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
use Modules\Sample\Listeners\TestEventListener;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace Modules\Sample\Providers;
|
||||
|
||||
use App\Services\ModuleService;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Database\Eloquent\Factory;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Route;
|
||||
|
||||
class SampleServiceProvider extends ServiceProvider
|
||||
@@ -26,7 +26,7 @@ class SampleServiceProvider extends ServiceProvider
|
||||
$this->registerLinks();
|
||||
|
||||
$this->registerFactories();
|
||||
$this->loadMigrationsFrom(__DIR__ . '/../Database/migrations');
|
||||
$this->loadMigrationsFrom(__DIR__.'/../Database/migrations');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,43 +54,43 @@ class SampleServiceProvider extends ServiceProvider
|
||||
*/
|
||||
protected function registerRoutes()
|
||||
{
|
||||
/**
|
||||
/*
|
||||
* Routes for the frontend
|
||||
*/
|
||||
Route::group([
|
||||
'as' => 'sample.',
|
||||
'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');
|
||||
'namespace' => 'Modules\Sample\Http\Controllers',
|
||||
], function () {
|
||||
$this->loadRoutesFrom(__DIR__.'/../Http/Routes/web.php');
|
||||
});
|
||||
|
||||
/**
|
||||
/*
|
||||
* Routes for the admin
|
||||
*/
|
||||
Route::group([
|
||||
'as' => 'sample.',
|
||||
'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');
|
||||
'namespace' => 'Modules\Sample\Http\Controllers\Admin',
|
||||
], function () {
|
||||
$this->loadRoutesFrom(__DIR__.'/../Http/Routes/admin.php');
|
||||
});
|
||||
|
||||
/**
|
||||
/*
|
||||
* Routes for an API
|
||||
*/
|
||||
Route::group([
|
||||
'as' => 'sample.',
|
||||
'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');
|
||||
'namespace' => 'Modules\Sample\Http\Controllers\Api',
|
||||
], function () {
|
||||
$this->loadRoutesFrom(__DIR__.'/../Http/Routes/api.php');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -117,8 +117,8 @@ class SampleServiceProvider extends ServiceProvider
|
||||
$sourcePath = __DIR__.'/../Resources/views';
|
||||
|
||||
$this->publishes([
|
||||
$sourcePath => $viewPath
|
||||
],'views');
|
||||
$sourcePath => $viewPath,
|
||||
], 'views');
|
||||
|
||||
$paths = array_map(
|
||||
function ($path) {
|
||||
@@ -141,18 +141,19 @@ class SampleServiceProvider extends ServiceProvider
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, 'sample');
|
||||
} else {
|
||||
$this->loadTranslationsFrom(__DIR__ .'/../Resources/lang', 'sample');
|
||||
$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');
|
||||
if (!app()->environment('production')) {
|
||||
app(Factory::class)->load(__DIR__.'/../Database/factories');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user