A simple Tag system for Filament.
These two commmands are all you need to install the package:
composer require moox/tag
php artisan mooxtag:install
Curious what the install command does? See manual installation below.
This Laravel Package Template can be used to create a package including a powerful Filament resource called Tag.
Name and table for the Resource can be changed while building your package.
- Go to https://github.com/mooxphp/tag
- Press the
Use this template
button - Create a new repository based on the template
- Clone the repository locally
- Run
php build.php
in the repo's directory and follow the steps- Author Name (Default: Moox Developer): Your Name
- Author Email (Default: [email protected]): [email protected]
- Package Name (Default: Blog Package): Your Package
- Package Description (Default: This is my package Blog Package)
- Package Entity (Default: Tag): e.g. Post
- Tablename (Default: tags): e.g. posts
After building the package, you can push the changes to GitHub and create an installable package on Packagist.org. Don't forget to adjust the README to your composer namespace.
After that the Resource is highly configurable.
Moox Core features like Dynamic Tabs and Translatable Config. See the config file for more details, but as a quick example:
/*
|--------------------------------------------------------------------------
| Tabs
|--------------------------------------------------------------------------
|
| Define the tabs for the Resource table. They are optional, but
| pretty awesome to filter the table by certain values.
| You may simply do a 'tabs' => [], to disable them.
|
*/
'tabs' => [
'all' => [
'label' => 'trans//core::core.all',
'icon' => 'gmdi-filter-list',
'query' => [
[
'field' => 'deleted_at',
'operator' => '=',
'value' => null,
],
],
],
'published' => [
'label' => 'trans//core::core.published',
'icon' => 'gmdi-check-circle',
'query' => [
[
'field' => 'publish_at',
'operator' => '<=',
'value' => function () {
return now();
},
],
[
'field' => 'deleted_at',
'operator' => '=',
'value' => null,
],
],
],
'scheduled' => [
'label' => 'trans//core::core.scheduled',
'icon' => 'gmdi-schedule',
'query' => [
[
'field' => 'publish_at',
'operator' => '>',
'value' => function () {
return now();
},
],
[
'field' => 'deleted_at',
'operator' => '=',
'value' => null,
],
],
],
'draft' => [
'label' => 'trans//core::core.draft',
'icon' => 'gmdi-text-snippet',
'query' => [
[
'field' => 'publish_at',
'operator' => '=',
'value' => null,
],
[
'field' => 'deleted_at',
'operator' => '=',
'value' => null,
],
],
],
'deleted' => [
'label' => 'trans//core::core.deleted',
'icon' => 'gmdi-delete',
'query' => [
[
'field' => 'deleted_at',
'operator' => '!=',
'value' => null,
],
],
],
],
],
All options for Tabs are explained in Moox Core docs.
The item also support 'item' types, means you are able to configure selectable types for your Entity. By default, we provide "Post" and "Page" as example. If you don't want to use types, just empty the array and the field and column become invisible.
/*
|--------------------------------------------------------------------------
| Tag Types
|--------------------------------------------------------------------------
|
| This array contains the types of tags entities. You can delete
| the types you don't need and add new ones. If you don't need
| types, you can empty this array like this: 'types' => [],
|
*/
'types' => [
'post' => 'Post',
'page' => 'Page',
],
You can configure the user model used for displaying Authors. By default it is tied to App User:
/*
|--------------------------------------------------------------------------
| Author Model
|--------------------------------------------------------------------------
|
| This sets the user model that can be used as author. It should be an
| authenticatable model and support the morph relationship.
| It should have fields similar to Moox User or WpUser.
|
*/
'user_model' => \App\Models\User::class,
You may probably use Moox User
'user_model' => \Moox\User\Models\User::class,
or Moox Press User instead:
'user_model' => \Moox\Press\Models\WpUser::class,
Instead of using the install-command php artisan mooxtag:install
you are able to install this package manually step by step:
// Publish and run the migrations:
php artisan vendor:publish --tag="tag-migrations"
php artisan migrate
// Publish the config file with:
php artisan vendor:publish --tag="tag-config"
Please see CHANGELOG for more information on what has changed recently.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.