Hello guys i am working on a laravel project and i have download a package for laravel crud generator from [InfyOm][1] but when i use the --datatables=true tag and i go to the view i am getting the errror:
FatalThrowableError in ProiodaController.php line 32:
Call to undefined method App\DataTables\ProiodaDataTable::render()
I am using the [yajra/laravel-datatables]
[2] such the generator to works need it.
The Generator has generate all the view files controller request model repositories and in a folder called DataTables has generate a file named ProiodaDataTable.php.
Below is The ProiodaController.php
<?php
namespace App\Http\Controllers;
use App\DataTables\ProiodaDataTable;
use App\Http\Requests;
use App\Http\Requests\CreateProiodaRequest;
use App\Http\Requests\UpdateProiodaRequest;
use App\Repositories\ProiodaRepository;
use Flash;
use App\Http\Controllers\AppBaseController;
use Response;
class ProiodaController extends AppBaseController
{
/* @var ProiodaRepository */
private $proiodaRepository;
public function __construct(ProiodaRepository $proiodaRepo)
{
$this->proiodaRepository = $proiodaRepo;
}
[1]: https://github.com/InfyOmLabs/laravel-generator
[2]: https://github.com/yajra/laravel-datatables.
**Here is The ProiodaDataTable.php**
<?php
namespace App\DataTables;
use App\Models\Proioda;
use Form;
use Yajra\Datatables\Facades\Datatables;
use Illuminate\Support\Facades\View;
class ProiodaDataTable extends Datatables
{
/*
* @return \Illuminate\Http\JsonResponse
*/
public function ajax()
{
return $this->datatables
->eloquent($this->query())
->addColumn('action', 'proiodas.datatables_actions')
->make(true);
}
/**
* Get the query object to be processed by datatables.
*
* @return \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder
*/
public function query()
{
$proiodas = Proioda::query();
return $this->applyScopes($proiodas);
}
/**
* Optional method if you want to use html builder.
*
* @return \Yajra\Datatables\Html\Builder
*/
public function html()
{
return $this->builder()
->columns($this->getColumns())
->addAction(['width' => '10%'])
->ajax('')
->parameters([
'dom' => 'Bfrtip',
'scrollX' => false,
'buttons' => [
'print',
'reset',
'reload',
[
'extend' => 'collection',
'text' => '<i class="fa fa-download"></i> Export',
'buttons' => [
'csv',
'excel',
'pdf',
],
],
'colvis'
]
]);
}
/**
* Get columns.
*
* @return array
*/
private function getColumns()
{
return [
'onoma' => ['name' => 'onoma', 'data' => 'onoma'],
'perigrafi' => ['name' => 'perigrafi', 'data' => 'perigrafi'],
'timi' => ['name' => 'timi', 'data' => 'timi']
];
}
/**
* Get filename for export.
*
* @return string
*/
protected function filename()
{
return 'proiodas';
}
}
Can someone please help why im getting this error i am using Laravel 5.4
via Elouert Moukia