dazzz1er / confer

Easy real-time chat for laravel 5 based websites and applications
133 stars 47 forks source link

Error 500 in conversation controller on line 148 #12

Closed jetwes closed 8 years ago

jetwes commented 8 years ago

I get a 500 - with this error: Illegal operator and value combination. InvalidArgumentException in Builder.php line 457: Illegal operator and value combination. in Builder.php line 457 at Builder->where('id', '<', null) at call_user_func_array(array(object(Builder), 'where'), array('id', '<', null)) in Builder.php line 526 at Builder->where('id', '<', null) at call_user_func_array(array(object(Builder), 'where'), array('id', '<', null)) in Relation.php line 283 at Relation->__call('where', array('id', '<', null)) in ConversationController.php line 148 at HasMany->where('id', '<', null) in ConversationController.php line 148 at ConversationController->showMoreMessages(object(Conversation), object(Request)) at call_user_func_array(array(object(ConversationController), 'showMoreMessages'), array('conferconversation' => object(Conversation), object(Request))) in Controller.php line 246 at Controller->callAction('showMoreMessages', array('conferconversation' => object(Conversation), object(Request))) in ControllerDispatcher.php line 162 at ControllerDispatcher->call(object(ConversationController), object(Route), 'showMoreMessages') in ControllerDispatcher.php line 107 at ControllerDispatcher->Illuminate\Routing{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 141 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Authenticate.php line 47 at Authenticate->handle(object(Request), object(Closure)) in Pipeline.php line 125 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 101 at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 108 at ControllerDispatcher->callWithinStack(object(ConversationController), object(Route), object(Request), 'showMoreMessages') in ControllerDispatcher.php line 67 at ControllerDispatcher->dispatch(object(Route), object(Request), 'DJB\Confer\Http\Controllers\ConversationController', 'showMoreMessages') in Route.php line 204 at Route->runWithCustomDispatcher(object(Request)) in Route.php line 134 at Route->run(object(Request)) in Router.php line 701 at Router->Illuminate\Routing{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 141 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 101 at Pipeline->then(object(Closure)) in Router.php line 703 at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 670 at Router->dispatchToRoute(object(Request)) in Router.php line 628 at Router->dispatch(object(Request)) in Kernel.php line 214 at Kernel->Illuminate\Foundation\Http{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 141 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in VerifyCsrfToken.php line 43 at VerifyCsrfToken->handle(object(Request), object(Closure)) in VerifyCsrfToken.php line 21 at VerifyCsrfToken->handle(object(Request), object(Closure)) in Pipeline.php line 125 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in ShareErrorsFromSession.php line 55 at ShareErrorsFromSession->handle(object(Request), object(Closure)) in Pipeline.php line 125 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in StartSession.php line 61 at StartSession->handle(object(Request), object(Closure)) in Pipeline.php line 125 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 36 at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in Pipeline.php line 125 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in EncryptCookies.php line 40 at EncryptCookies->handle(object(Request), object(Closure)) in Pipeline.php line 125 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in CheckForMaintenanceMode.php line 42 at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 125 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 101 at Pipeline->then(object(Closure)) in Kernel.php line 115 at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 84 at Kernel->handle(object(Request)) in index.php line 53

jetwes commented 8 years ago

The error occurs if you write a new note in a conversation. The conversation is not updated unless you reload the page and open the conversation again...

jetwes commented 8 years ago

ok, got it. The Problem is, that you hardcoded the model associations (participant for example). I had to update the statement with my user model incl. Namespace. Best practise would be to define the user model in the config file and then use this value instead. I manually updated all statements. Another point is that the entries in conversation_participants table are not correct. You switsche user_id and conversation_id...

dazzz1er commented 8 years ago

Hi @jetwes, Sorry for the extremely late response but very happy you managed to solve the issue yourself! The hardcoding (I hated doing it too) was unfortunately a by-product of the time schedule I was on when writing the project - I simply made it fit what I was currently working with. I would like to revisit and implement a more flexible solution, but currently other projects are taking up my time!

Thanks for taking the time to raise the issue, find a solution, and explore some of my code :)

huyle2607 commented 8 years ago

Could you please show me how to fix this error? I got this error in the console: 500 (Internal Server Error) but I don't know how to fix it! Please help me with this one.