Skip to content

Commit

Permalink
fixed getOrderValueForTags escaping raw column names
Browse files Browse the repository at this point in the history
  • Loading branch information
frasmage committed Nov 13, 2016
1 parent 0fcdb7a commit d1974e1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Mediable.php
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,11 @@ protected function handleMediableDeletion()
*/
private function getOrderValueForTags($tags)
{
$q = $this->media()->newPivotStatement();
$tags = (array) $tags;
$result = $this->media()->newPivotStatement()
->selectRaw('`tag`, max(`order`) as aggregate')
$grammar = $q->getConnection()->getQueryGrammar();

$result = $q->selectRaw($grammar->wrap('tag').', max('.$grammar->wrap('order').') as aggregate')
->where('mediable_type', $this->getMorphClass())
->where('mediable_id', $this->getKey())
->whereIn('tag', $tags)
Expand Down

0 comments on commit d1974e1

Please sign in to comment.