Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to create Filament resource for models inside a vendor folder?

To begin, I am using Filament to create an admin panel where the admin can create Topics, Questions, and Answers for quizzes. Meanwhile, for the quizzes, I am using this package https://github.com/harishdurga/laravel-quiz. The package contains models and relationships for topics, questions, question options, etc.

Now, to create a Filament resource, the command is php artisan make:filament-resource Customer. This will create a Filament resource for App\Models\Customer.php. However in my case, I want to create this Filament resource for the models from the package, which are inside the vendor folder.

How do I create the resource and reference it to the models inside the vendor folder?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

The file structure to reach the models in the package is:

vendor/harishdurga/laravel-quiz/src/Models/Question.php

>Solution :

You can specify in Filament CustomerResource which model to use, for example :

public static $model = Customer::class;

Documentation for it :
https://filamentphp.com/docs/1.x/admin/resources

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading