Skip to content

Commit

Permalink
Fix the module stubs and sample module for admin closes #201
Browse files Browse the repository at this point in the history
  • Loading branch information
nabeelio committed Feb 28, 2018
1 parent 208b6e7 commit e786886
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 10 deletions.
2 changes: 1 addition & 1 deletion modules/Sample/Http/Controllers/Admin/AdminController.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Modules\Sample\Http\Controllers;
namespace Modules\Sample\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
Expand Down
1 change: 1 addition & 0 deletions modules/Sample/Http/Routes/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
# an admin panel component.
Route::group([], function () {
Route::get('/', 'AdminController@index');
Route::get('/create', 'AdminController@create');
});
4 changes: 2 additions & 2 deletions modules/Sample/Providers/SampleServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function registerLinks()
// $this->moduleSvc->addFrontendLink('Sample', '/sample', '', $logged_in=true);

// Admin links:
$this->moduleSvc->addAdminLink('Sample', '/sample/admin');
$this->moduleSvc->addAdminLink('Sample', '/admin/sample');
}

/**
Expand All @@ -73,7 +73,7 @@ protected function registerRoutes()
*/
Route::group([
'as' => 'sample.',
'prefix' => 'api/sample/admin',
'prefix' => 'admin/sample',
// If you want a RESTful module, change this to 'api'
'middleware' => ['web', 'role:admin'],
'namespace' => 'Modules\Sample\Http\Controllers\Admin'
Expand Down
14 changes: 14 additions & 0 deletions modules/Sample/Resources/views/admin/create.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@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
4 changes: 2 additions & 2 deletions modules/Sample/Resources/views/admin/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
@section('title', 'Sample')
@section('actions')
<li>
<a href="{!! url('/sample/admin/create') !!}">
<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="header"><h4 class="title">Admin Scaffold!</h4></div>
<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>
Expand Down
2 changes: 1 addition & 1 deletion resources/stubs/modules/controller-admin.stub
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace $MODULE_NAMESPACE$\$STUDLY_NAME$\Http\Controllers;
namespace $MODULE_NAMESPACE$\$STUDLY_NAME$\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
Expand Down
3 changes: 1 addition & 2 deletions resources/stubs/modules/routes-admin.stub
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?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');
});
4 changes: 2 additions & 2 deletions resources/stubs/modules/scaffold/provider.stub
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class $CLASS$ extends ServiceProvider
// $this->moduleSvc->addFrontendLink('$STUDLY_NAME$', '/$LOWER_NAME$', '', $logged_in=true);

// Admin links:
$this->moduleSvc->addAdminLink('$STUDLY_NAME$', '/$LOWER_NAME$/admin');
$this->moduleSvc->addAdminLink('$STUDLY_NAME$', '/admin/$LOWER_NAME$');
}

/**
Expand All @@ -73,7 +73,7 @@ class $CLASS$ extends ServiceProvider
*/
Route::group([
'as' => '$LOWER_NAME$.',
'prefix' => 'api/$LOWER_NAME$/admin',
'prefix' => 'admin/$LOWER_NAME$',
// If you want a RESTful module, change this to 'api'
'middleware' => ['web', 'role:admin'],
'namespace' => '$MODULE_NAMESPACE$\$STUDLY_NAME$\Http\Controllers\Admin'
Expand Down

0 comments on commit e786886

Please sign in to comment.