Support the ongoing development of Laravel.io →
Session IOC Validation
Last updated 1 year ago.
0

I'm pretty sure you need to build and register your own Facade class to Notify::add() like that.

Otherwise, you would need to type-hint a Container-resolved object (such as a controller) which will then use method injection to deliver an instance of your class:

// controller method
function doThing(NotifyHelper $notify)
{
	$notify->add('make sense?');
}

PS you have your optional arguments the wrong way round in that example.

Last updated 8 years ago.
0

Thank you, that's what I needed. I ended up leaving MessageBag alone and creating my standalone class which will merge errors from Laravel, it seems Laravel only uses 'errors' anyway.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.