本文整理汇总了PHP中Illuminate\Support\Facades\Facade::getFacadeApplication方法的典型用法代码示例。如果您正苦于以下问题:PHP Facade::getFacadeApplication方法的具体用法?PHP Facade::getFacadeApplication怎么用?PHP Facade::getFacadeApplication使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Facade
的用法示例。
在下文中一共展示了Facade::getFacadeApplication方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getApp
protected function getApp($service = null)
{
if ($service) {
return Facade::getFacadeApplication()->make($service);
}
return Facade::getFacadeApplication();
}
示例2: __callStatic
public static function __callStatic($method, $args)
{
// subhelper
if (empty($args)) {
return LaravelFacade::getFacadeApplication()->helpers->subhelper($method);
}
}
示例3: make
/**
* Create a new Console application.
*
* @param null $app
*
* @return Artisan
*/
public static function make($app = null)
{
if (!static::$instance) {
/** @var Application $app */
$app = Facade::getFacadeApplication();
/** @var Artisan $console */
$console = with($console = new static('Laravel Database', '4.2.*'))->setLaravel($app)->setExceptionHandler($app['exception'])->setAutoExit(false);
$app->instance('artisan', $console);
static::registerServiceProviders($app);
$console->add(new AutoloadCommand());
$console->add(new ServeCommand());
$console->add(new ModelMakeCommand($app['files']));
$console->add(new CommandMakeCommand($app['files']));
$console->add(new EnvironmentCommand());
$console->add(new EnvironmentCommand());
static::$instance = $console;
}
return static::$instance;
}
示例4: isRunningWithFacades
protected function isRunningWithFacades()
{
return Facade::getFacadeApplication() !== null;
}
示例5: routeNeedsRoleOrPermission
/**
* Filters a route for the permission. If the third parameter
* is null then return 403. Overwise the $result is returned
*
* @param string $route Route pattern. i.e: "admin/*"
* @param array|string $roles The role(s) needed.
* @param array|string $permissions The permission needed.
* @param mixed $result i.e: Redirect::to('/')
* @param bool $cumulative Must have all permissions
*
* @access public
*
* @return void
*/
public function routeNeedsRoleOrPermission($route, $roles, $permissions, $result = null, $cumulative = false)
{
if (!is_array($roles)) {
$roles = array($roles);
}
if (!is_array($permissions)) {
$permissions = array($permissions);
}
$filter_name = implode('_', $roles) . '_' . implode('_', $permissions) . '_' . substr(md5($route), 0, 6);
if (!$result instanceof Closure) {
$result = function () use($roles, $permissions, $result, $cumulative) {
$hasARole = array();
foreach ($roles as $role) {
if ($this->hasRole($role)) {
$hasARole[] = true;
} else {
$hasARole[] = false;
}
}
$hasAPermission = array();
foreach ($permissions as $permission) {
if ($this->can($permission)) {
$hasAPermission[] = true;
} else {
$hasAPermission[] = false;
}
}
// Check to see if it is false and then
// check additive flag and that the array only contains false.
if ((in_array(false, $hasARole) || in_array(false, $hasAPermission)) && ($cumulative || count(array_unique(array_merge($hasARole, $hasAPermission))) == 1)) {
if (!$result) {
Facade::getFacadeApplication()->abort(403);
}
return $result;
}
};
}
// Same as Route::filter, registers a new filter
$this->_app['router']->filter($filter_name, $result);
// Same as Route::when, assigns a route pattern to the
// previously created filter.
$this->_app['router']->when($route, $filter_name);
}
示例6: view
/**
* Return a new view response from the application.
*
* @param string $view
* @param array $data
* @param int $status
* @param array $headers
* @return \Illuminate\Http\Response
*/
public static function view($view, $data = array(), $status = 200, array $headers = array())
{
$app = Facade::getFacadeApplication();
return static::make($app['view']->make($view, $data), $status, $headers);
}
示例7: testServiceProvider
public function testServiceProvider()
{
$this->assertCount(3, Facade::getFacadeApplication()->getLoadedProviders());
}