Skip to content

Commit

Permalink
fix get model
Browse files Browse the repository at this point in the history
  • Loading branch information
atmonshi committed Sep 13, 2023
1 parent 1c91f89 commit df81b12
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Widgets/Classes/FaqWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function form(): Builder\Block
->required()
->options(
// @phpstan-ignore-next-line
\LaraZeus\Sky\SkyPlugin::get()->getTagModel()::query()
\LaraZeus\Sky\SkyPlugin::get()->getModel('Tag')::query()
->where('type', 'faq')
->get()
->pluck('name', 'slug')
Expand Down
2 changes: 1 addition & 1 deletion src/Widgets/Classes/LibraryWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function form(): Builder\Block
->required()
->options(
// @phpstan-ignore-next-line
\LaraZeus\Sky\SkyPlugin::get()->getTagModel()::query()
\LaraZeus\Sky\SkyPlugin::get()->getModel('Tag')::query()
->where('type', 'library')
->get()
->pluck('name', 'slug')
Expand Down
6 changes: 3 additions & 3 deletions src/Widgets/Classes/PostsWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function form(): Builder\Block

Select::make('category')
// @phpstan-ignore-next-line
->options(\LaraZeus\Sky\SkyPlugin::get()->getTagModel()::query()
->options(\LaraZeus\Sky\SkyPlugin::get()->getModel('Tag')::query()
->withType('category')
->pluck('name', 'id')),

Expand All @@ -61,11 +61,11 @@ public function form(): Builder\Block
public function viewData(array $data): array
{
// @phpstan-ignore-next-line
$posts = \LaraZeus\Sky\SkyPlugin::get()->getPostModel()::query();
$posts = \LaraZeus\Sky\SkyPlugin::get()->getModel('Post')::query();

if ($data['category'] !== null) {
// @phpstan-ignore-next-line
$category = \LaraZeus\Sky\SkyPlugin::get()->getTagModel()::where('type', 'category')->find($data['category']);
$category = \LaraZeus\Sky\SkyPlugin::get()->getModel('Tag')::where('type', 'category')->find($data['category']);
if ($category !== null) {
$posts = $category->postsPublished();
}
Expand Down

0 comments on commit df81b12

Please sign in to comment.