Extending Daalder

As Daalder is built atop Laravel, it benefits from all advantages of Laravel built-in IoC implementation. Besides, your fresh Daalder application is nothing but a fresh Laravel project, with a backoffice/pionect library installed.

In such a way, extending Daalder relies strongly upon service bindings. If, for instance, your e-commerce project needs a customized validation logic, you can easily add new validation rules, by:

  1. creating rules that implement the Pionect\Backoffice\Http\Validators\Validates contract and

  2. extending the Validator facade within your project-specific service provider:

// CustomRule.php
use Pionect\Backoffice\Http\Validators\Validates;

class CustomRule implements Validates
{
    public function validate($attribute, $value, array $parameters)
    {
        // your validation logic
    }
}

// YourServiceProvider.php
use Illuminate\Support\ServiceProvider;

class YourServiceProvider extends ServiceProvider
{
    public function boot()
    {
        Validator::extend('custom_rule', CustomRule::class . '@validate');
    }
}

Similar approach applies to all cases when extending of the core-level Daalder features is necessary. Also, it allows for keeping the core logic untouched and easily revertable if some extension is no longer necessary.