Skip to content

Commit 5614531

Browse files
committed
Add alias prefix indicator
1 parent 82d4657 commit 5614531

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/Repositories/AbstractRepository.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ abstract class AbstractRepository implements RepositoryContract
4848
/**
4949
* @var \Illuminate\Database\Eloquent\Builder
5050
*/
51-
5251
protected $query;
5352

5453
/**
@@ -703,9 +702,17 @@ public function getErrorMessage($default = '')
703702
*/
704703
protected function appendTableName($column)
705704
{
706-
return (strpos($column, '.') === false)
707-
? $this->modelInstance->getTable() . '.' . $column
708-
: $column;
705+
// If missing prepend the table name
706+
if (strpos($column, '.') === false) {
707+
return $this->modelInstance->getTable() . '.' . $column;
708+
}
709+
710+
// Remove alias prefix indicator
711+
if (substr($column, 0, 2) === '_.') {
712+
return preg_replace('/^_\./', '', $column);
713+
}
714+
715+
return $column;
709716
}
710717

711718
/**

0 commit comments

Comments
 (0)