Skip to content

Add A Customized Controller And View

Serverfire edited this page Dec 26, 2018 · 1 revision

Add A Customized Controller And View

If you need to create a customized controller and view under panel, please read this section.

First create a controller and extend it from the Controller class (instead of the CrudController), for example if the controller is named TestCustomController :

<?php

namespace App\Http\Controllers;

class TestController extends Controller
{
    public function all($entity)
    {
        return view('test_custom_view');
    }
    public function __construct() { }

    public function index()
    {
        // Code

        return view('test_custom_view');
    }

}

Then you should create your view file, for example if your view is named test_custom_view, create the test_custom_view.blade.php file under the resources/views folder and to load templates of panel, you should include the following lines in your view file :

@extends('panelViews::mainTemplate')
@section('page-wrapper')

<!-- Code -->

@stop

Create a model with same name of controller and insert it in link table