Skip to content

Commit

Permalink
Merge pull request #52 from Senexis/fix-model-menu-doc
Browse files Browse the repository at this point in the history
Update the Model Menu Panel example to include the trait
  • Loading branch information
datlechin authored Nov 9, 2024
2 parents 36e3f9c + 26f8595 commit d960b03
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,17 @@ The model menu panel allows you to add menu items from a model.

To create a model menu panel, your model must implement the `\Datlechin\FilamentMenuBuilder\Contracts\MenuPanelable` interface and `\Datlechin\FilamentMenuBuilder\Concerns\HasMenuPanel` trait.

Then you will need to implement the following methods:
Then you must also implement the `getMenuPanelTitleColumn` and `getMenuPanelUrlUsing` methods. A complete example of this implementation is as follows:

```php
use Illuminate\Database\Eloquent\Model;
use Datlechin\FilamentMenuBuilder\Concerns\HasMenuPanel;
use Datlechin\FilamentMenuBuilder\Contracts\MenuPanelable;
use Illuminate\Database\Eloquent\Model;

class Category extends Model implements MenuPanelable
{
use HasMenuPanel;

public function getMenuPanelTitleColumn(): string
{
return 'name';
Expand Down

0 comments on commit d960b03

Please sign in to comment.