We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| 1 | <?php |
||
| 7 | trait SluggableScopeHelpers |
||
| 8 | { |
||
| 9 | use SluggableScopeHelpers; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * Query scope for finding a model by its primary slug. |
||
| 13 | * |
||
| 14 | * @param \Illuminate\Database\Eloquent\Builder $scope |
||
| 15 | * @param string $slug |
||
| 16 | * @return \Illuminate\Database\Eloquent\Builder |
||
| 17 | */ |
||
| 18 | public function scopeWhereSlug($scope, $slug) |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Find a model by its primary slug. |
||
| 25 | * |
||
| 26 | * @param string $slug |
||
| 27 | * @param array $columns |
||
| 28 | * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|static[]|static|null |
||
| 29 | */ |
||
| 30 | public static function findBySlug($slug, array $columns = ['*']) |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Find a model by its primary slug or throw an exception. |
||
| 37 | * |
||
| 38 | * @param string $slug |
||
| 39 | * @param array $columns |
||
| 40 | * @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection |
||
| 41 | * |
||
| 42 | * @throws \Illuminate\Database\Eloquent\ModelNotFoundException |
||
| 43 | */ |
||
| 44 | public static function findBySlugOrFail($slug, array $columns = ['*']) |
||
| 48 | } |
||
| 49 |
Let’s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let’s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.phpHowever, as
OtherDir/Foo.phpdoes not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: