Skip to content

v1.0.7

Compare
Choose a tag to compare
@patiencemanzen patiencemanzen released this 27 Nov 17:22
· 3 commits to main since this release

🎉 New Features

  1. Model Integration with Filterable Trait: Added the ability to specify a model using the --model option when creating a filter. The specified model will automatically have the Filterable trait appended to it.

The command will search for the model file within the app directory recursively, ensuring that models in nested directories are correctly located and updated.

🚀 Enhancements

  1. Improved Namespace Handling:

    Enhanced the namespace generation logic to ensure that namespaces are correctly formatted and trailing slashes are removed.

    The namespace is now derived from the filtan_path configuration, ensuring consistency with the directory structure.

  2. Configuration Documentation:

    Improved the documentation in the filtan.php configuration file to provide clearer explanations of each configuration option.

🐛 Bug Fixes

  1. Directory Creation:
    Fixed an issue where directories were not being created correctly when no directory name was passed in the path info.

    Ensured that the directory structure is correctly formed and that the file is placed in the right location.

📖 Usage

To create a new filter and optionally specify a model to append the Filterable trait to, use the following command:

php artisan filtan:create {filter} --model={model}

Example:

php artisan filtan:create ProductFilter --model=Product

This will create the filter file in the default directory specified in your configuration and append the Filterable trait to the Product model.

⚙️ Configuration

Ensure that your filtan.php configuration file is correctly set up:

return [
    /**
     * -----------------------------------
     * Default Query Filters Directory
     * ------------------------------------
     * 
     * This is the base directory where your query filters will be stored.
     * By default, it is set to 'Http', which means the filters will be
     * placed under the 'app/Http' directory.
     */
    'filtan_folder' => 'Http',

    /**
     * ----------------------------------
     * Default Query Filters Folder Name
     * ----------------------------------
     * 
     * This is the name of the folder that will contain all the query filters.
     * By default, it is set to 'QueryFilters'. If you change this name,
     * make sure to update the namespacing accordingly.
     */
    'filters_folder_name' => 'QueryFilters',
];

🤝 Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository and create a new branch for your contributions.
  2. Make your changes or additions, adhering to the coding guidelines.
  3. Submit a pull request detailing your changes, and our team will review it promptly.

📜 License

MIT