Integration with Laravel

QuestionsIntegration with Laravel
Ananda Theerthan asked 10 years ago

Can I integrate phpgrid with Laravel framework. If Yes, can you send some basic example.

8 Answers
Abu Ghufran answered 10 years ago


The example would be little difficult now, but here is how it works.
PHP Grid works independently from the framework lib and don't use data access layers of framework.

To integrate in MVC, You can divide code in 2 sections. And put first in controller and pass the $out variable to view, where you can render it with rest of JS/CSS files.


$g = new jqgrid();

$out = $g->render("list1");



<link rel="stylesheet" type="text/css" media="screen" href="js/themes/redmond/jquery-ui.custom.css"></link>
<link rel="stylesheet" type="text/css" media="screen" href="js/jqgrid/css/ui.jqgrid.css"></link>

<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="js/themes/jquery-ui.custom.min.js" type="text/javascript"></script>

<div style="margin:10px">
<?php echo $out?>

Ananda Theerthan answered 10 years ago

I tried this but getting error "Couldn't execute query. No database selected ". How do I set the connection to use from the framework.

Ananda Theerthan answered 10 years ago

I managed to get the DB part working, but when I try to update any data,the framework throws HttpNotAllowed exception. It is because of the routes mechanism defined in the framework. Any way to fix this?

Abu Ghufran answered 10 years ago

thanks for sharing

Alex answered 10 years ago

I'm also having this problem. The table is loading fine but I can't edit because of the HttpNotAllowed exception.

Alex answered 10 years ago

Ok, so I solved it by adding a POST route to the page. The MethodNotAllowed exception happens because phpgrid is trying to post to a GET only page. So I made a POST route for my page and it is fine!

Brigitte answered 8 years ago

There still so much to do for the grid to work with Laravel. Laravel needs to pass in a token with every POST. So how do we intercept the POST to add the data, value pair _token = 'xxxxxx' to the post data?

Your Answer

5 + 12 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.

How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?