mgallegos / laravel-jqgrid

@Laravel jqGrid package allows you to easily integrate the popular @jQuery Grid Plugin (jqGrid) into your Laravel application.
mariogallegos.com
Other
69 stars 44 forks source link

Is it working in Laravel 5.2 #50

Closed tarunhere closed 7 years ago

tarunhere commented 8 years ago

Is it compulsory to user Repositories to use jqgrid? I tried to Learn and implement repositories but now luck!

Can any one guide me in right direction to use jqgrid with laravel 5.2.? Thanks in advance.

mgallegos commented 8 years ago

Have you seen the turorials, there aren't too many differences with Laravel 5.

tarunhere commented 8 years ago

yes I tried. I got confused with Repository Part. I haven't used before. Can you guide me in detailed steps. Thanks in advance.

davidvd commented 7 years ago

@mgallegos I'm having the exact same problem than you. I have created an app/ModelnameRepository.php file (because there's no models folder in L5) and I have added the following code (adding a namespace declaration at the top):

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Mgallegos\LaravelJqgrid\Repositories\EloquentRepositoryAbstract;

class ExampleRepository extends EloquentRepositoryAbstract {
  public function __construct(Model $Model) {
    $this->Database = $Model;
    $this->visibleColumns = array('col1','col2');
    $this->orderBy = array(array('col1', 'desc'), array('col2','asc'));
  }
}

I get the following error:

FatalErrorException in routes.php line 34:
Class 'ExampleRepository' not found

I tried to do a composer dump-autoload, but still no success. What's wrong in your opinion?

davidvd commented 7 years ago

I was able to have this working by adding those lines at the top of the routes.php file:

use Mgallegos\LaravelJqgrid\Facades\GridEncoder;
use App\ExampleRepository;
use App\Example;
use Illuminate\Support\Facades\Input;