GuavaCZ / filament-nested-resources

MIT License
107 stars 17 forks source link

[Bug]: Access to undeclared static property App\Filament\Resources\CourseResource\Pages\CreateCourseLesson::$relationship #30

Open z4yed opened 6 months ago

z4yed commented 6 months ago

What happened?

When I am trying to navigate to the create page I am getting the below error.

Access to undeclared static property App\Filament\Resources\CourseResource\Pages\CreateCourseLesson::$relationship

This is the content of my CourseResource\Pages\CreateCourseLesson.php file.

<?php

namespace App\Filament\Resources\CourseResource\Pages;

use App\Filament\Resources\CourseResource;
use Guava\FilamentNestedResources\Concerns\NestedPage;
use Guava\FilamentNestedResources\Pages\CreateRelatedRecord;

class CreateCourseLesson extends CreateRelatedRecord
{
    use NestedPage;

    protected static string $resource = CourseResource::class;

}

Did I miss something here?

How to reproduce the bug

When creating lesson from the relation page.

Package Version

1.0

PHP Version

8.3

Laravel Version

11

Which operating systems does with happen with?

macOS

Notes

No response

z4yed commented 6 months ago

Also could you please provide the source code of the example given for Artist/Albums/Songs too?

lukas-frey commented 6 months ago

@z4yed You need to implement the $relationship property. I guess in your case it will be something like:

protected static string $relationship = 'lessons';
z4yed commented 6 months ago

This worked. However, when I am in view/edit page of any lesson, the root navigation section Courses is not active (highlighted). Please see attached image.

image

lukas-frey commented 6 months ago

This worked. However, when I am in view/edit page of any lesson, the root navigation section Courses is not active (highlighted). Please see attached image.

image

Great catch, thanks. Will fix it in the next release. :)

Khant-Nyar commented 4 months ago

dear all i use to create but it don't fixin with my require

here is what i want i have series, seasons,episodes

but record is only one get how do i make

Model

Series have many Season Season have belongto series and have many episodes episodes have belongto series

So route should be like that series/{record}/seasons/{record}/episodes