-
Couldn't load subscription status.
- Fork 92
Closed
Description
Visiting /* will throw an exception.
The error comes from line 46 here:
Statamic\Eloquent\Taxonomies\Taxonomy::fromModel(): Argument #1 ($model) must be of type Illuminate\Database\Eloquent\Model, array given
eloquent-driver/src/Taxonomies/TaxonomyRepository.php
Lines 40 to 47 in a67cb95
| public function findByHandle($handle): ?TaxonomyContract | |
| { | |
| $taxonomyModel = Blink::once("eloquent-taxonomies-{$handle}", function () use ($handle) { | |
| return app('statamic.eloquent.taxonomies.model')::whereHandle($handle)->first(); | |
| }); | |
| return $taxonomyModel ? app(TaxonomyContract::class)->fromModel($taxonomyModel) : null; | |
| } |
This is because when you provide a key ending with * to Blink, it returns an array of values.
$blink->get('key'); // Returns 'value'
$blink->get('prefix*'); // Returns an array of values whose keys start with 'prefix'Maybe line 46 should be changed to
return $taxonomyModel instanceof Model ? ...Metadata
Metadata
Assignees
Labels
No labels