- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
首先,我必须说我对 Laravel 是全新的,所以如果你认为我的方式有误,请纠正我。
请注意,我的应用程序上安装了 Laravel 5.1。
我创建了一个应用程序,我喜欢将面包屑放在一个数组中,所以我决定创建一个服务提供者,服务提供者的代码如下:
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;
class BreadCrumbsServiceProvider extends ServiceProvider
{
// This will contain all the breadcrumb crumbs
protected $crumbs = [];
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
$this->createBreadcrumb();
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
$this->app->singleton(
'crumbs',
function() {
return $this->crumbs;
}
);
}
protected function createBreadcrumb( ) {
dd( Route::current() );
}
}
dd
仅返回
null
.有人可以帮我解决这种情况吗?
最佳答案
在您的服务提供者类中 Route::Class 将不起作用。试试这些
当前请求 uri - $this->app->request->getRequestUri()
当前请求方法 - $this->app->request->getMethod()
关于php - 在 Laravel 中获取服务提供者内部的当前路线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30915040/
我一直在寻找文件系统的 Java 命名和目录接口(interface) (JNDI) 服务提供商。 据我所知,Oracle 与 JDK 捆绑在一起,仅提供 RMI、DNS、LDAP 和 COS 服务提
我不熟悉单点登录的概念。我们已经有一个管理其用户的 Java Web 应用程序。现在的要求是,身份验证将由客户端的 SSO Idp(使用 SAML)提供,之后请求将被转发到我们的应用程序。由于我以前没
当我访问 laravel 时,它说 Symfony \ Component \ Debug \ Exception \ FatalErrorException 'Krucas\Notification
我(我们)正在创建一个包,作为我们 future CMS 的核心组件,当然,该包需要一些单元测试。当包注册时,它做的第一件事就是像这样设置后台/前端上下文: class FoundationServi
有没有办法在 Laravel 中仅为某些路由/URL 注册服务提供商?我想知道是否可以仅在需要的地方绑定(bind)服务,以及它是否有助于减少启动时的压力。 最佳答案 我不确定是否可以仅在特定路线上注
有没有办法在 Laravel 中仅为某些路由/URL 注册服务提供商?我想知道是否可以仅在需要的地方绑定(bind)服务,以及它是否有助于减少启动时的压力。 最佳答案 我不确定是否可以仅在特定路线上注
我正在开发一个 Laravel 5 应用程序,现在应用程序的代码应该在多个 laravel 5 应用程序中重复使用,这就是为什么我要创建一个 composer 包,然后我想在任何地方安装这个包具有相同
当使用预配置的服务提供者元数据时,在 spring security 中,扩展元数据委托(delegate)是否应该有 2 个 beans 定义?一个用于 IDP 元数据,一个用于 SP 元数据?
我知道如何绑定(bind)单个类: public function register() { $this->app->bind('search', 'Laracasts\Search\Sear
我创建了扩展 XeroServiceProvide 的自定义服务提供程序,基本上,我有多个 Xero 帐户,我想更改两个配置参数值运行时 消费者 key 和 消费者 secret .有没有快速的方法。
我有一个小程序需要调用JAXP,具体是SAXParserFactory .现在,正如您从 Javadoc 中看到的那样,这在内部使用了服务提供者机制,如文档中所述 here : 具体来说,如果它在我的
我试图找出一个涉及 Spring Security 和 SAML 的问题。我们正在尝试使用 Spring Security (spring-security-core-3.1.1.RELEASE.ja
我需要创建一个 RESTful WCF 服务,它需要使用 OAuth 2.0 对调用者进行身份验证。过去一周我一直在学习 OAuth 和它的提供者实现,这些是我发现的资源,它们接近我想要的。 (1)
我的 someModule 模块有一个服务: someModule.provider('someService', function() { this.options = {}; th
在 view composer documentation 之后我为我的基本 View 创建了一个类 ComposerServiceProvider 和一个 ViewComposer。我想为我站点的管
我收到此错误: BindingResolutionException in compiled.php line 1029: Target [App\Models\Contracts\Repositor
我正在考虑使用 Oracle 数据库作为 Web 服务提供程序并通过 PL/SQL 存储过程实现 Web 服务逻辑的选项。我以前曾编写过存储过程代码,但我不确定我应该朝哪个方向发展才能使用最新的解决方
在 AngularJS 2.0 Heroes 教程解释中指出,如果一个子组件在其 @Component Providers 列表中包含一个服务,那么 Angular 将创建该服务特定于该子组件的单独实
我正在构建一个 Web 应用程序,它将使用 DotNetOpenAuth 提供一个 api 和一个授权服务。我找到了 this example关于如何使用已经存在的服务提供者进行授权,但我想要一个关于
我正在努力在 Websphere Liberty 服务器上启用 samlWeb-2.0。我需要使用我的雇主提供的现有身份提供商来实现服务提供商部分进行身份验证。 samlWeb-2.0 功能已安装并启
我是一名优秀的程序员,十分优秀!