Skip to content

Deprecated since 7.2

This page documents the classic module layer (CBController and cbInit()). It still works in every 7.x release, but new code should use resources and pages.

Use instead: Override detail() on the resource, or a page for a fully custom screen.

How To Make A Custom View Of Detail Method ​

A way to make a custom view of detail method is override it. This is a best way if CB can't handle the layout that you want.

php
public function getDetail($id) {
  //Create an Auth
  if(!CRUDBooster::isRead() && $this->global_privilege==FALSE || $this->button_edit==FALSE) {    
    CRUDBooster::redirect(CRUDBooster::adminPath(),trans("crudbooster.denied_access"));
  }
  
  $data = [];
  $data['page_title'] = 'Detail Data';
  $data['row'] = DB::table('products')->where('id',$id)->first();
  
  //Please use view method instead view method from laravel
  return $this->view('custom_detail_view',$data);
}

Then, create your own detail view

php
<!-- First, extends to the CRUDBooster Layout -->
@extends('crudbooster::admin_template')
@section('content')
  <!-- Your html goes here -->
  <div class='panel panel-default'>
    <div class='panel-heading'>Edit Form</div>
    <div class='panel-body'>      
        <div class='form-group'>
          <label>Name</label>
          <p>{{$row->name}}</p>
        </div>
         
        <!-- etc .... -->
        
      </form>
    </div>
  </div>
@endsection

What's Next ​

Table Of Contents ​

Released under the MIT License.