Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix get page image and multiple panels #171

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Models/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ public function parent(): BelongsTo
return $this->belongsTo(self::class, 'parent_id', 'id');
}

public function image(): Collection | string | null
public function image(string $collection = 'posts'): Collection | string | null
{
if (! $this->getMedia('posts')->isEmpty()) {
return $this->getFirstMediaUrl('posts');
if (! $this->getMedia($collection)->isEmpty()) {
return $this->getFirstMediaUrl($collection);
} else {
return $this->featured_image ?? config('zeus-sky.defaultFeaturedImage');
}
Expand Down
11 changes: 7 additions & 4 deletions src/SkyServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,14 @@ protected function getMigrations(): array

private function bootFilamentNavigation(): void
{
if (! defined('__PHPSTAN_RUNNING__') && (! app('filament')->hasPlugin('zeus-sky') || ! app('filament')->hasPlugin('navigation'))) {
return;
}

Filament::serving(function () {
if (! defined('__PHPSTAN_RUNNING__') &&
! app('filament')->hasPlugin('zeus-sky') &&
! app('filament')->hasPlugin('navigation')
) {
return;
}

NavigationResource::navigationGroup(SkyPlugin::get()->getNavigationGroupLabel());
NavigationResource::navigationSort(999);
NavigationResource::navigationIcon('heroicon-o-queue-list');
Expand Down