Skip to content

Commit f1efdf8

Browse files
committedJul 21, 2020
Resolve schema builder instance from model
1 parent b95dbb4 commit f1efdf8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed
 

‎src/Traits/HasUuid.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace YourAppRocks\EloquentUuid\Traits;
1313

1414
use Illuminate\Database\Eloquent\ModelNotFoundException;
15-
use Illuminate\Support\Facades\Schema;
1615
use Ramsey\Uuid\Uuid as RamseyUuid;
1716
use YourAppRocks\EloquentUuid\Exceptions\MissingUuidColumnException;
1817

@@ -82,7 +81,7 @@ public function scopeFindByUuid($query, $uuid, $firstOrFail = true)
8281
*/
8382
private function hasColumnUuid($model)
8483
{
85-
if (! Schema::hasColumn($model->getTable(), $model->getUuidColumnName())) {
84+
if (! $model->getConnection()->getSchemaBuilder()->hasColumn($model->getTable(), $model->getUuidColumnName())) {
8685
throw new MissingUuidColumnException("You don't have a '{$model->getUuidColumnName()}' column on '{$model->getTable()}' table.");
8786
}
8887
}

0 commit comments

Comments
 (0)
Please sign in to comment.