mardi 30 mai 2017

backpack-for-laravel pass query results to overwritten index

I want to pass the results of my query and display it on a custom view the way backpack list a model from a database.

this is my query result:(this should show 3 columns, name, station, parameter)

  $eq_parametro = Equipo::with('parametros')->with('estaciones')
                  ->buscarparametro($request->get('parametros'))
                  ->paginate(10);

to integrate on a custom view i need to override backpack index function on my controller

public function index()
{
$this->crud->hasAccessOrFail('list');

$this->data['crud'] = $this->crud;
$this->data['title'] = ucfirst($this->crud->entity_name_plural);

// get all entries if AJAX is not enabled
if (! $this->data['crud']->ajaxTable()) {
    $this->data['entries'] = $this->data['crud']->getEntries();
}

// load the view from /resources/views/vendor/backpack/crud/ if it exists, otherwise load the one in the package
// $this->crud->getListView() returns 'list' by default, or 'list_ajax' if ajax was enabled
return view('your_view_name', $this->data);
}

how do i pass the query result to the function index and it shows a list of the 3 columns. need a real example.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire