-
Notifications
You must be signed in to change notification settings - Fork 0
Extending tutorial
Eugene Min edited this page Feb 15, 2016
·
1 revision
Before you start this tutorial you need to install package and add Mconsole middleware first.
Start with overwriting Mconsole routes:
# app/Http/routes.php
Route::group(['prefix' => 'mconsole', 'middleware' => ['web', 'mconsole']], function () {
Route::resource('/pages', 'PagesController');
});You can see all mconsole routes by executing artisan command: php artisan route:list --path=mconsole.
Create a new controller:
$ php artisan make:controller PageController --resourceExtend it with PageController from Mconsole package:
# app/Http/Controllers/PageController.php
use Milax\Mconsole\Http\Controllers\PageController as BasePageController;
class PageController extends BasePageController
{
/**
* Your custom index method.
*/
public function index()
{
// This will load view from resources/views/mconsole/pages/ in APP, not from package
$this->view('mconsole.pages.list');
// To load view from Mconsole package, use $this->view('mconsole::mconsole.pages.list');
}
}Create a view file in resources/views/mconsole/pages/list.blade.php:
@extends('mconsole::app')
@section('title', 'Pages | Mconsole')
@section('content')
<div>Your custom page content</div>
@endsectionThat's it!
You can also create new sections, without extending existing.