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

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

Open
z4yed opened this issue Apr 22, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@z4yed
Copy link

z4yed commented Apr 22, 2024

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 z4yed added the bug Something isn't working label Apr 22, 2024
@z4yed
Copy link
Author

z4yed commented Apr 22, 2024

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

@lukas-frey
Copy link
Contributor

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

protected static string $relationship = 'lessons';

@z4yed
Copy link
Author

z4yed commented Apr 22, 2024

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
Copy link
Contributor

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants