filament-nested-resources icon indicating copy to clipboard operation
filament-nested-resources copied to clipboard

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

Open z4yed opened this issue 1 year ago • 5 comments

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 avatar Apr 22 '24 07:04 z4yed

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

z4yed avatar Apr 22 '24 08:04 z4yed

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

protected static string $relationship = 'lessons';

lukas-frey avatar Apr 22 '24 08:04 lukas-frey

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

z4yed avatar Apr 22 '24 08:04 z4yed

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. :)

lukas-frey avatar Apr 22 '24 16:04 lukas-frey

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

Khant-Nyar avatar Jun 10 '24 18:06 Khant-Nyar