草庐IT

laravel-queue

全部标签

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 - 在 Laravel PHPUnit 中测试未经授权的用户限制

Laravel版本5.2在我的项目中,role_id=4的用户具有admin角色,可以管理用户。我在AuthServiceProvider中定义了以下能力:publicfunctionboot(GateContract$gate){$this->registerPolicies($gate);$gate->define('can-manage-users',function($user){return$user->role_id==4;});}我已经在UserController__construct方法中使用了这种能力,如下所示:publicfunction__construct()

php - 我们可以在 controller laravel 中使用 helper 吗?

我是laravel的新手,我在Cakephp方面有很好的经验。在Cakephp中,我们仅对View使用帮助程序但我已经在laravel中看到了我退出的代码,我们也在Controller中使用了帮助程序。在controller中使用helper好不好?如果是,那么请告诉我,在Controller中使用助手有什么缺点或优点?请建议我... 最佳答案 如果您谈论的是全局Laravelhelpers,那么是的,您可以在应用程序的任何地方使用它们(Controller、模型、View、中间件、routes.php等),因为它们是全局助手。您还

php - 如何在 Laravel 中使用 JSON 对象中的 POST 方法获取数据?

这是我的route.phpRoute::post('users',array('uses'=>'Userscontroller@index'));这是我的Userscontroller.phppublicfunctionindex(){$email_id=Input::get('email_id');$name=Input::get('name');return$email_id.''.$name;}当我在postman中运行它时,我得到错误作为'>'unexpectedinJSON.我哪里漏了?谢谢。 最佳答案 如果你像这样发送j

php - 如何在 laravel 测试中获取 header 值

这就是我在测试用例中得到响应的方式$response=$this->call('POST','/api/auth/login',['username'=>'xx','password'=>'xxx'],[/*cookies*/],[/*files*/],['HTTP_ClientSecret'=>'xxxx']);然后我们可以这样获取响应内容$response->getContents()我想知道如何获取响应头数据? 最佳答案 做类似的事情:$response->headers->get('content-type');或者任何你需

php - Laravel 后 Controller 方法和 PostController 不工作

我的Laravel博客项目postcontroller的get方法可以工作,但post方法不工作。我重定向Post方法。但是根据我的代码,它应该返回到我的管理页面。我的Controller代码是validate($request,['title'=>'required|max:120|unique:posts','author'=>'required|max:80','body'=>'required']);$post=newPost();$post->title=$request['title'];$post->author=$request['author'];$post->bod

php - 强制用户选择至少一个复选框 - Laravel

如何通过在Laravel5.2中的服务器端验证来验证用户是否至少选中了一个复选框我有一个简单的选择框:KFZFührerschein:NeinJa和一个隐藏的div:B(Autobis3,49t)BE(AutomitAnhänger)C1(LKWbis7,49t)C(LKWbis40t)CE(LKWmitAnhänger)FahrerkarteGabelstaplerführerscheinGeländestaplerführerscheinIPAF–Arbeitsbühnen当用户选择yes/ja时,他应该选择他拥有的类别。

php - Laravel - 从 ajax 响应数据中的产品 (belongsTo) 访问子类别。

一个产品有一个子类别。在我的产品表中,我有subcategory_id字段。我还在Product和Subcategory模型之间建立了belongsTo关系。所以我有一个方法可以返回具有特定标签ID的所有产品。这是我的代码:publicfunctiongetProductsByTag($tag_id){$tag=Tag::find($tag_id);$products=$tag->products;//belongsTorelationshipreturnjson_encode(['products'=>$products]);}然后,在我的ajax请求成功后,我需要访问产品的子类别,

php - Laravel Controller 获取限制数量的项目

在我的Controller中$items=Item::all();我只想得到前6个项目如何更改代码? 最佳答案 使用take()方法:$items=Item::take(6)->get(); 关于php-LaravelController获取限制数量的项目,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/38930388/

php - 找不到 Laravel 包特征

我正在开发一个包并在我的PSR-4结构中添加了一个“Traits”目录,这反射(reflect)在包的composer.json中。{"name":"my-private-repo/prefs","description":"Preferencespackage.","type":"package","keywords":["prefs","preferences"],"require":{"php":">=5.5.9","illuminate/support":"5.2.*","laravelcollective/html":"5.2.*","anahkiasen/former":"