Support the ongoing development of →
Configuration IOC Architecture
Last updated 2 years ago.

I am an idiot. This is totally possible, but I had my service provider order wrong.

This is what I do now:

class AppServiceProvider extends ServiceProvider {

	 * Register services.
	public function register() {
		$this->app->singleton(MyFormBuilder::class, function ($app) {
			return new MyFormBuilder($app, $app[FormHelper::class], $app['events']);

		$this->app->alias(MyFormBuilder::class, 'laravel-form-builder');
		$this->app->alias(MyFormBuilder::class, 'Kris\LaravelFormBuilder\FormBuilder');


And that makes every call resolve to my FormBuilder. Injections, app() calls, everything. Perfect.

Last updated 7 years ago.

Sign in to participate in this thread!


Your banner here too?

rudiedirkx rudiedirkx Joined 19 Feb 2017


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.