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

Time:01-20

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?

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

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

CodePudding user response:

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

  • Related