php - Dynamic Laravel Style Facade -


i'm using laravel's facade architecture (the aliasloader class , facade class) create facades app. working initially, add aliases loader , register them, create facade class , boom, facades everywhere.

but i'm trying clean model calls.

currently i'm loading model theme::model('sale/order') so, creates model_sale_order object on container. i'd add facade on fly can call model more elegantly saleorder::getorders($customer_id)

adding alias no big deal, point it? there no facade file point too.

is possible set class dynamically detect object we're looking container?

class dynamicfacade extends facade {      protected static function getfacadeaccessor() {         return 'my.dynamically.created.object';     } } 


Comments