Issues (20)

src/Traits/HasFetchScope.php (1 issue)

1
<?php
2
3
namespace PrismX\Schemaless\Traits;
4
5
trait HasFetchScope
6
{
7
    public function scopeFetch($query, $locale = null)
8
    {
9
        return $query
10
            ->where('collection', $this->collection)
11
            ->where('locale', $locale ?? app()->getLocale())
0 ignored issues
show
The method getLocale() does not exist on Illuminate\Container\Container. Are you sure you never get this type here, but always one of the subclasses? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

11
            ->where('locale', $locale ?? app()->/** @scrutinizer ignore-call */ getLocale())
Loading history...
12
            ->firstOrFail();
13
    }
14
15
    public function scopeFetchAll($query, $locale = null)
16
    {
17
        return $query
18
            ->where('collection', $this->collection)
19
            ->where('locale', $locale ?? app()->getLocale())
20
            ->get();
21
    }
22
}
23