草庐IT

illuminate-container

全部标签

php - 交响乐 2.8 : concept of container scopes is deprecated

更新到Symfony2.8后,我发现了这个弃用警告:Theconceptofcontainerscopesisdeprecatedsinceversion2.8andwillberemovedin3.0.Omitthethirdparameter.(5times)来自synfony分析器的堆栈:Container::set()(calledfrombootstrap.php.cacheatline2284)Container::leaveScope()(calledfrombootstrap.php.cacheatline3309)ContainerAwareHttpKernel::h

php - 无法在类 App\bill、Laravel 中使非静态方法 Illuminate\Database\Eloquent\Model::getTable() 静态化

我在模型中创建了如下方法:classbillextendsModel{publicstaticfunctiongetTable(){$tables=Bill::where('order_type','0')->where('table_no','','')->groupBy('table_no')->get();return$tables;}}在Controller中我访问这个方法是publicfunctionbill(){$data=Bill::getTable();returnview('bill.bills');}它给出错误,因为Cannotmakenonstaticmethod

php - 调用未定义的方法 Illuminate\Database\Query\Builder::post()

我在使用查询构建器时遇到问题,在路由文件中使用post()时会出现未定义的方法错误。一般我用的是returnofUser::find($id)->post;但是当我将post作为函数调用时,它不起作用并给我:CalltoundefinedmethodIlluminate\Database\Query\Builder::post()用户模型hasOne('App\Post');}}路线Route::get('/',function(){returnview('welcome');});Route::get('/user/{id}/post',function($id){returnUse

php - Laravel: PHP Parse error: syntax error, unexpected '?' in/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php 第500行

自从我将我的php版本从5.6升级到7.2后,我的php_errors.log上一直存在错误:PHP解析错误:语法错误,意外的“?”在/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php第500行500号线:return$factory->of($arguments[0],$arguments[1])->times($arguments[2]??null);我在stackoverflow上搜索了一下,主要是服务器还在用php5.6,不过我觉得不是这个原因。平台是Laravel5.7,显然一切正常。如果我从终端运行

php - Laravel 4 PHP fatal error : Class 'Illuminate\Foundation\Testing\TestCase' not found

当我使用Laravel4运行phpunit时出现以下错误。PHPFatalerror:Class'Illuminate\Foundation\Testing\TestCase'notfoundinComposer.json"require":{"laravel/framework":"4.0.*","phpunit/phpunit":"3.7.*"},应用.php'Illuminate\Foundation\Testing\TestCase'我应该做什么? 最佳答案 看起来自动加载不包含新要求。请务必运行composerupdate

php - 传递参数给 Pimple->container->factory

所以我基本上想这样做:$this->container['Menu_builder']=$this->container->factory(function($c){returnnewMenu_builder($parameter_1,$parameter_2);});其中$parameter_1和$parameter_2从调用中传入,如下所示:$menu_builder=$this->container['Menu_builder']('account','reset_password');我知道上面的语法不正确,但我想将这些字符串传递到对$this->container->fact

php - Prestashop : how to override a module class contained in a file that includes other classes?

prestashop覆盖系统通过使用文件命名方案与许多其他系统一样工作。所以基本上,我将在/overrides/classes中创建一个与/classes中另一个具有相同类和文件名的类,只是为了简化。好吧,我必须覆盖它(使用最新的prestashop版本可以覆盖模块,而以前我们不能):include_once(dirname(__FILE__).'/MailAlert.php');classMailAlertsextendsModule{[....]}我可以用这个覆盖它:classMailAlertsOverrideextendsMailAlerts{[....]}好吧,它有效,文件和

php - 未找到特征 'Illuminate\Foundation\Bus\DispatchesJobs'

我正在使用http://www.maatwebsite.nl/laravel-excel/docs导出和导入数据库到excel文件。一切都运行得很好,但几天后,我发现这个库有问题。这不是突然发生的,确实,我在应用程序中添加了更多功能,终于发现了这个错误。FatalErrorExceptioninLaravelExcelReader.phpline29:Trait'Illuminate\Foundation\Bus\DispatchesJobs'notfound从Maatwebsite库中使用的库似乎有问题。在尝试找出问题所在几个小时后,我找不到任何DispatchesJobs的来源线索

php - Laravel 错误未捕获异常 'ReflectionException',消息为 'Class App\Http\Kernel does not exist'

当我想在我的laravel5.2项目中添加表单时,我在composer中遇到了一些错误。之后我的整个项目都出现了一个奇怪的错误:Fatalerror:Uncaughtexception'ReflectionException'withmessage'ClassApp\Http\Kerneldoesnotexist'inC:\xampp\htdocs\gifkadeh\vendor\laravel\framework\src\Illuminate\Container\Container.php:738Stacktrace:#0C:\xampp\htdocs\gifkadeh\vendor

php - 从两个相关的 Illuminate Eloquent 模型中获取数据

目前在我们使用直接sql查询的项目之一中,决定删除它们并实现ORM,因此我们决定使用IlluminateEloquentModel组件为了那个原因。由于我们是新手,我对两个相互关联的模型之间的关系了解不多。当前的sql查询select*fromloginasA,user_profileasBwhereA.user_id=B.login_idandA.user_id=$user_id我创建了两个模型,一个User扩展Illuminate\Database\Eloquent\Model和另一个UserProfile扩展Illuminate\数据库\Eloquent\模型。模型实现是这样的用