xsanisty / SlimBoard

Starter Application built on Slim Framework in MVC (and HMVC) environment
http://www.xsanisty.com/project/slim-starter
MIT License
288 stars 71 forks source link

Pagination facility #15

Open rajneeshojha opened 9 years ago

rajneeshojha commented 9 years ago

This framework is good but i am really missing a nice pagination class , I hope anyone can help with this

ikhsan017 commented 9 years ago

you can add "illuminate/pagination": "~4.2" into composer.json and try Model::paginate(15)

I didn't try it, but I think it should works fine

rajneeshojha commented 9 years ago

i added that in composer and updated trying to use it like use Illuminate\Pagination;

then in controller function Capsule::table('Test')->paginate(5); also tried Test::paginate(15)

but getting error

Type: ReflectionException Code: -1 Message: Class paginator does not exist File: /Users/rajneesh/htdocs/slim/vendor/illuminate/container/Illuminate/Container/Container.php Line: 504

Trace

#0 /Users/rajneesh/htdocs/slim/vendor/illuminate/container/Illuminate/Container/Container.php(504): ReflectionClass->__construct('paginator')
#1 /Users/rajneesh/htdocs/slim/vendor/illuminate/container/Illuminate/Container/Container.php(428): Illuminate\Container\Container->build('paginator', Array)
#2 /Users/rajneesh/htdocs/slim/vendor/illuminate/container/Illuminate/Container/Container.php(806): Illuminate\Container\Container->make('paginator')
#3 /Users/rajneesh/htdocs/slim/vendor/illuminate/database/Illuminate/Database/DatabaseManager.php(209): Illuminate\Container\Container->offsetGet('paginator')
#4 [internal function]: Illuminate\Database\DatabaseManager->Illuminate\Database\{closure}()
#5 /Users/rajneesh/htdocs/slim/vendor/illuminate/database/Illuminate/Database/Connection.php(992): call_user_func(Object(Closure))
#6 /Users/rajneesh/htdocs/slim/vendor/illuminate/database/Illuminate/Database/Query/Builder.php(1600): Illuminate\Database\Connection->getPaginator()
#7 /Users/rajneesh/htdocs/slim/app/modules/UserGroup/Controllers/UserController.php(47): Illuminate\Database\Query\Builder->paginate(5)
#8 [internal function]: UserGroup\Controllers\UserController->index()
#9 /Users/rajneesh/htdocs/slim/vendor/slim/slim/Slim/Route.php(173): call_user_func_array(Array, Array)
#10 [internal function]: Slim\Route->Slim\{closure}()
#11 /Users/rajneesh/htdocs/slim/vendor/slim/slim/Slim/Route.php(462): call_user_func_array(Object(Closure), Array)
#12 /Users/rajneesh/htdocs/slim/vendor/slim/slim/Slim/Slim.php(1326): Slim\Route->dispatch()
#13 /Users/rajneesh/htdocs/slim/vendor/slim/slim/Slim/Middleware/Flash.php(85): Slim\Slim->call()
#14 /Users/rajneesh/htdocs/slim/vendor/slim/slim/Slim/Middleware/MethodOverride.php(92): Slim\Middleware\Flash->call()
#15 /Users/rajneesh/htdocs/slim/vendor/slim/slim/Slim/Middleware/PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call()
#16 /Users/rajneesh/htdocs/slim/vendor/slim/slim/Slim/Slim.php(1271): Slim\Middleware\PrettyExceptions->call()
#17 /Users/rajneesh/htdocs/slim/src/SlimStarter/Bootstrap.php(299): Slim\Slim->run()
#18 /Users/rajneesh/htdocs/slim/index.php(3): SlimStarter\Bootstrap->run()
#19 {main}