Search code examples
databaselaravelmethodsviewproduction

Error on Laravel 4 production: Call to undefined method Illuminate\Database\QueryException::message()


I'm managed to set up a L4 project on to a sub directory: http://secure.myultratrust.com/test/users/create#b

I have it on a subdomain too: http://test3-l4.ultratrust.com/users/create#b

I get this error on submitting: Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_ERROR) Call to undefined method Illuminate\Database\QueryException::message()

(BTW, ignore the #b at the end of the URL. I'm using a backbutton javascript functionality called backb). =)

Both have the exact same message. I have it completely working on my local environment. I thought it may be the database settings so I tested the database on another test file (not connected to the l4 app) to see if the db settings were corret. The db connections work but again the test connect file isn't using l4.

The l4 route seems to be working for, at least, getting to blade views to show. However, the form submissions aren't working. I was trying to get my PHPStorm to step through but I can't get it to work right now so I find it's hard to track down this problem. =(

So what could be the problem? Any help is much appreciated!

Thanks and have a blessed day<><, Victor


Solution

  • Replace message() with getMessage(). So your line 116 on UsersController.php should read like this:

    $error = $e->getMessage();
    

    This should fix the particular error. However since the PDException is being thrown, it should cause another exception which will then show to the screen to enable further debugging.

    How did I figure this out? the $e variable is an instance of PDOException. If you look at the public API for this class, you find that there is no method called message() you can call. However this is getMessage() and that's probably what you meant to do in the first place. Access the public API here:

    http://php.net/manual/en/class.pdoexception.php