filament-types

Manage any type on your app in Database with easy to use Resource for FilamentPHP

Screenshot

Filament Types

Latest Stable Version License Downloads

Manage any type on your app in Database with easy to use Resource for FilamentPHP

Screenshots

Types Filters Type Col Form

Installation

composer require tomatophp/filament-types

after install your package please run this command

php artisan filament-types:install

finally reigster the plugin on /app/Providers/Filament/AdminPanelProvider.php

->plugin(\TomatoPHP\FilamentTypes\FilamentTypesPlugin::make())

Register New Type

you can add new type using config file config/filament-types.php or you can register a type from your provider using our Facade

use TomatoPHP\FilamentTypes\Facades\FilamentTypes;

FilamentTypes::register([
    'types',
    'groups'
], 'accounts');

Use Type Helper

you can find any type with the helper method to use it anywhere

type_of(key: 'pending',for: 'notes',type: 'groups');

it will return type model for you.

Use Type Column

you can use type column in your table like this

use TomatoPHP\FilamentTypes\Components\TypeColumn;

TypeColumn::make('type')->searchable(),

Auto Caching

on your .env add this

CACHE_STORE=array
MODEL_CACHE_STORE=array

supported cache stores are

+ Redis
+ MemCached
+ APC
+ Array

Use Type Base Page

you can create a page for selected type by just extand base type page

use TomatoPHP\FilamentTypes\Pages\BaseTypePage;

use TomatoPHP\FilamentTypes\Services\Contracts\Type;

class NotesGroups extends BaseTypePage
{
     public function getTitle(): string
    {
        return "Notes Groups";
    }

    public function getType(): string
    {
        return "groups";
    }

    public function getFor(): string
    {
        return "notes";
    }

    public function getBackUrl()
    {
        return ManageNotes::getUrl(); // TODO: Change the autogenerated stub
    }

    public function getTypes(): array
    {
        return [
            Type::make('todo')
                ->name([
                    "ar" => "مهام",
                    "en" => "TODO"
                ])
                ->color('#1461e3')
                ->icon('heroicon-o-list-bullet'),
            Type::make('ideas')
                ->name([
                    "ar" => "أفكار",
                    "en" => "Ideas"
                ])
                ->color('#13e0da')
                ->icon('heroicon-o-sparkles'),
            Type::make('saved')
                ->name([
                    "ar" => "محفوظ",
                    "en" => "Saved"
                ])
                ->color('#29a82e')
                ->icon('heroicon-o-arrow-down-on-square'),
        ];
    }
}

it will be not appear on the navigation menu by default but you can change that by just use this method

public static function shouldRegisterNavigation(): bool
{
    return true;
}

Use Type Component

if you like to use a type as a package we create a blade component for you to make it easy to use anywhere on your app like this

<x-tomato-type :type="$type" label="Group"/>

Publish Assets

you can publish config file by use this command

php artisan vendor:publish --tag="filament-types-config"

you can publish views file by use this command

php artisan vendor:publish --tag="filament-types-views"

you can publish languages file by use this command

php artisan vendor:publish --tag="filament-types-lang"

you can publish migrations file by use this command

php artisan vendor:publish --tag="filament-types-migrations"

Other Filament Packages

Support

you can join our discord server to get support TomatoPHP

Docs

you can check docs of this package on Docs

Changelog

Please see CHANGELOG for more information on what has changed recently.

Security

Please see SECURITY for more information about security.

Credits

License

The MIT License (MIT). Please see License File for more information.

شارك على الشبكات الاجتماعية