Skip to content

Commit

Permalink
Fix SQL query to support PostgreSQL
Browse files Browse the repository at this point in the history
  • Loading branch information
akazorg committed Oct 11, 2018
1 parent 6c94857 commit 9ccc986
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/MercuriusServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class MercuriusServiceProvider extends ServiceProvider
*/
public function boot(Router $router)
{
$this->registerPublishable();
$this->loadRoutesFrom(__DIR__.'/../routes/web.php');
$this->loadViewsFrom(__DIR__.'/../publishable/views', 'mercurius');
$this->loadTranslationsFrom(__DIR__.'/../publishable/lang', 'mercurius');
Expand All @@ -35,6 +34,7 @@ public function boot(Router $router)
*/
public function register()
{
$this->registerPublishable();
$this->mergeConfigFrom(__DIR__.'/../publishable/config/mercurius.php', 'mercurius');

$this->loadHelpers();
Expand Down
8 changes: 4 additions & 4 deletions src/Repositories/ConversationRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ public function all($user = null)
' FROM',
' (',
' SELECT receiver_id as usr, MAX(id) AS id FROM '.$tbl_messages,
' WHERE deleted_by_sender = 0 AND sender_id ='.$user.' GROUP BY usr',
' WHERE deleted_by_sender = FALSE AND sender_id ='.$user.' GROUP BY usr',
' UNION ALL',
' SELECT sender_id as usr, MAX(id) as id FROM '.$tbl_messages,
' WHERE deleted_by_receiver = 0 AND receiver_id ='.$user.' GROUP BY usr',
' WHERE deleted_by_receiver = FALSE AND receiver_id ='.$user.' GROUP BY usr',
' ) u',
' GROUP BY u.usr',
' ) mm',
Expand Down Expand Up @@ -127,10 +127,10 @@ public function recipients($user = null)
'FROM',
' (',
' SELECT receiver_id as id FROM '.$tbl_messages,
' WHERE sender_id ='.$user.' AND deleted_by_receiver = 0',
' WHERE sender_id ='.$user.' AND deleted_by_receiver = FALSE',
' UNION ALL',
' SELECT sender_id as id FROM '.$tbl_messages,
' WHERE receiver_id ='.$user.' AND deleted_by_sender = 0',
' WHERE receiver_id ='.$user.' AND deleted_by_sender = FALSE',
') u',
]));

Expand Down

0 comments on commit 9ccc986

Please sign in to comment.