# How To Make A Custom View Of Index Method A way to custom the index method is override the existing index method. This is best way if CB can't handle the layout that you want ```php public function getIndex() { //First, Add an auth if(!CRUDBooster::isView()) CRUDBooster::redirect(CRUDBooster::adminPath(),trans('crudbooster.denied_access')); //Create your own query $data = []; $data['page_title'] = 'Products Data'; $data['result'] = DB::table('products')->orderby('id','desc')->paginate(10); //Create a view. Please use `view` method instead of view method from laravel. return $this->view('your_custom_view_index',$data); } ``` Create your own view in `/resources/views/your_custom_view_index.blade.php' ```php @extends('crudbooster::admin_template') @section('content')
Name | Description | Price | Action |
---|---|---|---|
{{$row->name}} | {{$row->description}} | {{$row->price}} | @if(CRUDBooster::isUpdate() && $button_edit) Edit @endif @if(CRUDBooster::isDelete() && $button_edit) Delete @endif |
{!! urldecode(str_replace("/?","?",$result->appends(Request::all())->render())) !!}
@endsection ``` ## What's Next - [How To Make A Custom View Of Add Method](./how-custom-view-add.md) ## Table Of Contents - [Back To Index](./index.md)