prism-x /
laravel-schemaless
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace PrismX\Schemaless\Support; |
||||
| 4 | |||||
| 5 | use App\Nova\Resource; |
||||
|
0 ignored issues
–
show
|
|||||
| 6 | use Illuminate\Http\Request; |
||||
| 7 | use Illuminate\Support\Str; |
||||
| 8 | use Laravel\Nova\Fields\Text; |
||||
|
0 ignored issues
–
show
The type
Laravel\Nova\Fields\Text was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||
| 9 | use Laravel\Nova\Http\Requests\NovaRequest; |
||||
|
0 ignored issues
–
show
The type
Laravel\Nova\Http\Requests\NovaRequest was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||
| 10 | |||||
| 11 | class DocumentResource extends Resource |
||||
| 12 | { |
||||
| 13 | public static $collection = 'documents'; |
||||
| 14 | |||||
| 15 | public static $model = 'PrismX\Schemaless\Document'; |
||||
| 16 | |||||
| 17 | public static $title = 'model'; |
||||
| 18 | |||||
| 19 | public static $search = ['model']; |
||||
| 20 | |||||
| 21 | public function __construct($resource) |
||||
| 22 | { |
||||
| 23 | if ($resource->model) { |
||||
| 24 | static::$model = $resource->model; |
||||
| 25 | $this->resource = (new $resource->model())->find($resource->id); |
||||
|
0 ignored issues
–
show
|
|||||
| 26 | } |
||||
| 27 | } |
||||
| 28 | |||||
| 29 | public function fields(Request $request) |
||||
| 30 | { |
||||
| 31 | return array_merge([ |
||||
| 32 | Text::make('Document', function () { |
||||
| 33 | return Str::normalize(Str::afterLast($this->model, '\\')); |
||||
| 34 | })->onlyOnIndex(), |
||||
| 35 | ], $this->resource->getNovaFields() |
||||
| 36 | ); |
||||
| 37 | } |
||||
| 38 | |||||
| 39 | public static function indexQuery(NovaRequest $request, $query) |
||||
| 40 | { |
||||
| 41 | return $query |
||||
| 42 | ->where('collection', static::$collection) |
||||
| 43 | ->where('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
Loading history...
|
|||||
| 44 | } |
||||
| 45 | |||||
| 46 | public static function detailQuery(NovaRequest $request, $query) |
||||
| 47 | { |
||||
| 48 | return parent::detailQuery($request, $query |
||||
| 49 | ->where('collection', static::$collection) |
||||
| 50 | ->where('locale', app()->getLocale())); |
||||
| 51 | } |
||||
| 52 | |||||
| 53 | public static function authorizedToCreate(Request $request) |
||||
| 54 | { |
||||
| 55 | return false; |
||||
| 56 | } |
||||
| 57 | |||||
| 58 | public function authorizedToDelete(Request $request) |
||||
| 59 | { |
||||
| 60 | return false; |
||||
| 61 | } |
||||
| 62 | } |
||||
| 63 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths