Skip to content

Commit

Permalink
Fix CurrentModel not initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
felixgilles committed Sep 26, 2024
1 parent c8549b7 commit 10fc17a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion resources/views/meta.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@php
/** @var \Illuminate\Database\Eloquent\Model&\Novius\LaravelMeta\Traits\HasMeta|null $model */
$model = \Novius\LaravelMeta\Facades\CurrentModel::getModel();
if (!in_array(\Novius\LaravelMeta\Traits\HasMeta::class, class_uses_recursive($model), true)) {
if ($model === null || !in_array(\Novius\LaravelMeta\Traits\HasMeta::class, class_uses_recursive($model), true)) {
$model = null;
}
@endphp
Expand Down
2 changes: 1 addition & 1 deletion src/Services/CurrentModelService.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class CurrentModelService
{
public ?Model $model;
public ?Model $model = null;

public function setModel(Model $model): void
{
Expand Down

0 comments on commit 10fc17a

Please sign in to comment.