本文整理汇总了PHP中Illuminate\Support\Facades\App::bind方法的典型用法代码示例。如果您正苦于以下问题:PHP App::bind方法的具体用法?PHP App::bind怎么用?PHP App::bind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\App
的用法示例。
在下文中一共展示了App::bind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register
/**
* Register the service provider.
*/
public function register()
{
App::bind('toolbox.commands.controllers', function () {
return new \Impleri\Toolbox\Commands\ControllersCommand();
});
App::bind('toolbox.commands.models', function () {
return new \Impleri\Toolbox\Commands\ModelsCommand();
});
App::bind('toolbox.commands.routes', function () {
return new \Impleri\Toolbox\Commands\RoutesCommand();
});
App::bind('toolbox.commands.schema', function () {
return new \Impleri\Toolbox\Commands\SchemaCommand();
});
App::bind('toolbox.commands.views', function () {
return new \Impleri\Toolbox\Commands\ViewsCommand();
});
App::bind('toolbox.commands.build', function () {
return new \Impleri\Toolbox\Commands\BuildCommand();
});
$this->commands($this->provides());
// Subscribe our own commands to toolbox.compile
Event::listen('toolbox.build', function ($app) {
$app->call('toolbox:routes');
$app->call('toolbox:controllers');
$app->call('toolbox:models');
$app->call('toolbox:schema');
$app->call('toolbox:views');
});
}
示例2: register
/**
* Register the application services.
*
* @return void
*/
public function register()
{
$this->app->register('Intervention\\Image\\ImageServiceProvider');
App::bind('Uploader', function ($app) {
return new Uploader($app['request']);
});
}
示例3: register
/**
* Register the application services.
*
* @return void
*/
public function register()
{
$this->mergeConfigFrom(__DIR__ . '/../../config/smsc.php', 'smsc');
App::bind('smsc', function () {
return new Smsc();
});
}
示例4: register
/**
* Register any package services.
*
* @return void
*/
public function register()
{
App::bind('VKAPI', function () {
return new VKAPIClass(config('VKAPI.access_token'), config('VKAPI.version'), config('VKAPI.api_url'));
});
$this->publishes([__DIR__ . '/../config/VKAPI.php' => config_path('VKAPI.php')]);
}
示例5: register
/**
* Register the application services.
*
* @return void
*/
public function register()
{
$this->mergeConfigFrom(__DIR__ . '/../../config/yandexpdd.php', 'yandexpdd');
App::bind('yandexpdd', function () {
return new YandexPdd();
});
}
示例6: boot
public function boot()
{
$this->package('mrosati84/laradmin');
$prefix = Config::get('laradmin::prefix');
$namespace = Config::get('laradmin::namespace');
$entities = Config::get('laradmin::entities');
foreach ($entities as $entity => $properties) {
$fullClassName = $namespace . '\\' . $entity . 'Admin';
$baseAdminController = 'Mrosati84\\Laradmin\\BaseAdminController';
// register admin classes bindings
App::bind($fullClassName, function () use($fullClassName, $entity) {
return new $fullClassName($entity);
});
// register custom filters classes
App::bind('AuthenticationFilter', 'Mrosati84\\Laradmin\\Filters\\AuthenticationFilter');
// register custom route filters
Route::filter('laradmin.auth', 'AuthenticationFilter');
// register laradmin index route (just a redirect to default entity)
Route::get($prefix, array('as' => 'laradmin.index', function () use($prefix) {
return Redirect::route($prefix . '.' . strtolower(Config::get('laradmin::defaultEntity')) . '.index');
}));
// register entities routes
Route::group(array('prefix' => $prefix, 'before' => 'laradmin.auth'), function () use($entity, $fullClassName) {
Route::resource(strtolower($entity), $fullClassName);
});
}
}
示例7: register
/**
* Register any package services.
*
* @return void
*/
public function register()
{
$this->mergeConfigFrom(__DIR__ . '/config/config.php', 'l5-sugarcrm');
App::bind('sugarcrm', function () {
return new SugarAPI();
});
}
示例8: register
/**
* Register the application services.
*
* @return void
*/
public function register()
{
App::bind('zendesk', function () {
return new \Zendesk\Resource\Zendesk();
});
$this->mergeConfigFrom(__DIR__ . '/../config.php', 'zendesk-config');
}
示例9: register
/**
* Register any package services.
*
* @return void
*/
public function register()
{
App::bind('citizen', function () {
return new Citizen();
});
// use this if your package has a config file
config(['config/erepapi.php']);
}
示例10: register
/**
* Register the application services.
*
* @return void
*/
public function register()
{
$this->handleConfig();
$this->registerEvents();
$this->registerCommands();
App::bind('slug', function ($app, $parameters) {
return new \AlexeyMezenin\LaravelRussianSlugs\Slugs($parameters);
});
}
示例11: boot
/**
* Register any other events for your application.
*
* @param \Illuminate\Contracts\Events\Dispatcher $events
* @return void
*/
public function boot(DispatcherContract $events)
{
parent::boot($events);
Log::info("Booting Datatext service");
$this->publishes([__DIR__ . '/../database/migrations/' => database_path('migrations')], 'migrations');
App::bind("datatext.user_provider", '\\Jvelo\\Datatext\\LaravelUserProvider');
App::bind("datatext.assets_manager", '\\Jvelo\\Datatext\\Assets\\DefaultAssets');
App::bind("datatext.shortcodes", '\\Jvelo\\Datatext\\Shortcodes\\Shortcodes');
App::bind("datatext.api.pages", '\\Jvelo\\Datatext\\Api\\Pages');
}
示例12: registerModuleFacades
/**
* Registers the current Model and the current Controllers to the IoC.
* Required for theirs facades
*/
public function registerModuleFacades()
{
$className = ucfirst($this->module);
App::bind('platform.core.module.model', function () use($className) {
$modelName = 'Spescina\\PlatformCore\\Models\\' . $className;
return new $modelName();
});
App::singleton('platform.core.module.controller', function () use($className) {
$controllerName = 'Spescina\\PlatformCore\\Controllers\\' . $className . 'Controller';
return new $controllerName();
});
}
示例13: boot
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
$this->publishes([__DIR__ . '/migrations/' => database_path('/migrations')], 'migrations');
$this->publishes([__DIR__ . '/config/mercadopago.php' => config_path('mercadopago.php')], 'config');
$this->loadViewsFrom(__DIR__ . '/Views', 'MercadoPago');
App::bind('mercadopago', function () {
return new Mercadopago(config('services.mercadopago.CLIENT_ID'), config('services.mercadopago.CLIENT_SECRET'), config('services.mercadopago.SANDBOXMODE'));
});
//$routeConfig = [
// 'namespace' => 'jorgelsaud\MercadoPago\Controllers',
// 'prefix' => $this->app['config']->get('debugbar.route_prefix'),
//];
include __DIR__ . '/routes/routes.php';
}
示例14: boot
public function boot()
{
App::register(\MatthC\Privileges\PrivilegesServiceProvider::class);
App::register(\HieuLe\Active\ActiveServiceProvider::class);
App::bind('Active', function () {
return new \HieuLe\Active\Facades\Active();
});
$this->loadViewsFrom(__DIR__ . '/../../resources/views', 'laradmin');
$this->publishes([__DIR__ . '/../config/laradmin.php' => config_path('laradmin.php')]);
$this->publishes([__DIR__ . '/../../public' => public_path('vendor/laradmin')], 'public');
if (!$this->app->routesAreCached()) {
require __DIR__ . '/../routes.php';
}
}
示例15: register
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
// Register Package
$this->package('j42/laravel-firebase', null, __DIR__ . '/../../../');
// Get pseudo-connection from config
$config = Config::get('database.connections.firebase');
// Dependency Injection: Main Service
App::singleton('firebase', function ($app) use($config) {
return new Client($config);
});
// Dependency Injection: Token Provider
App::bind('firebase.token', function ($app) use($config) {
return new Token($config['token']);
});
}