Hi @lasseal, What I do for my handlers or repositories is to create a facade so I can call it easily like BookingHandler::getAvailableRooms(); you are not calling static methos like this but things get resolved thought laravel IoC container so you can easily mock your facades if you do tests for your code or if you plan to later on.
you need a service provider to register your facade
<?php
use Illuminate\Support\ServiceProvider;
class BookingHandlerServiceProvider extends ServiceProvider {
public function register()
{
$this->app['bookinghandler'] = $this->app->share(function($app
{
return new BookingHandler;
});
}
})
you need the facade itself
<?php
use Illuminate\Support\Facades\Facade;
class BookingHandlerFacade extends Facade {
protected static function getFacadeAccessor() {
return 'bookinghandler'
}
};
and you need to include the alias for you facade in app.php
'aliases' => array(
....
'BookingHandler' => 'BookingHandler',
///or if you use namespces
'BookingHandler' => 'unitedworx\bookings\BookingHandler',
now you can easily call the booking handler via its facade anywhere in your code
i do this for all my handlers/repositories and it helps a lot and i know i can mock the facade later on if i want to write some tests
BookingHandler::getAvailableRooms();