草庐IT

php - VerifyCsrfToken.php 中的 TokenMismatchException 第 67 行 : while integrating paytm with laravel 5. 3

tokenmismatchexceptioninverifyCsrfToken我通过在laravel5.3中引用“https://github.com/anandsiddharth/laravel-paytm-wallet”来集成paytm,在付款时它重定向到paytm站点,当它重定向回我的站点时它给出错误“VerifyCsrfToken.php第67行中的TokenMismatchException”查看.phpfirst_name}}"/>email}}"/>cost?>"readonly/>mid?>"readonly/>mobile}}"readonly/>PayControl

php - Laravel 5.5 - 邮件无法使用 `mail` 驱动程序

在我的Laravel设置中,邮件一直有效,直到我将框架升级到5.5(从5.4)。现在它总是在以下地方失败:请注意以下事项:本地环境中的邮件服务器=http://www.toolheap.com/test-mail-server-tool/users-manual.html我从5年前就开始使用它(这是一个一键安装/无戏剧/无配置/无错误测试邮件服务器),直到昨天它仍然有效,所以我没有将它更改为其他内容如果直接调用php的mail()函数就可以工作我设置的邮件驱动程序只是mail但它仍然会转到sendmail(你可以转储$command并且它说/usr/sbin/发送邮件-bs)这是邮件的

php - 如何在 Laravel 5.5 中将数据从请求自动映射到模型

我想提交包含许多字段的表单。作为documentation$flight=newFlight;$flight->name=$request->name;$flight->param1=$request->param1;$flight->param2=$request->param2;...$flight->param_n=$request->param_n;$flight->save();如果有太多的领域是个坏主意。我正在寻找任何脚本,例如:$flight=newFlight;$flight->save($request->all());但是$request->all()函数得到了不必

PHP Laravel 5.5 集合展平并保留整数键?

我有以下数组:$array=['2'=>['3'=>['56'=>'2'],'6'=>['48'=>'2']],'4'=>['4'=>['433'=>'2','140'=>'2'],'8'=>['421'=>'2','140'=>'2']],'5'=>['5'=>['88'=>'4','87'=>'2']]];下面的代码(扁平化)应该通过保留键来返回它,但它没有?collect($array)->flatten(1);应该给我['3'=>['56'=>'2'],'6'=>['48'=>'2'],'4'=>['433'=>'2','140'=>'2'],'8'=>['421'=>'2',

php - 运行 php artisan db :seed more than one and continue for duplicate keys insert

我创建了一个用于在数据库中插入默认值的播种器。如果我多次运行这个播种器,mysql返回重复键错误,所以我的问题是处理此错误的最佳方法是什么?以及如何继续运行其他种子? 最佳答案 您不应该多次运行db:seed命令。更好的方法是重新创建所有表并使用此命令播种数据:phpartisanmigrate:refresh--seed或者在运行phpartisanmigrate:refresh命令后运行一次db:seed。https://laravel.com/docs/5.5/migrations#rolling-back-migration

php - 检查 laravel 中验证是否失败

我想知道使用这种代码编写的验证何时失败(我正在使用laravel5.4)$this->validate($request,['name'=>'required|min:2|max:255']);我知道我可以使用这个:$validator=Validator::make($request->all(),['name'=>'required|min:2|max:255']);if($validator->fails()){//Notokay}但我想通过使用$this->validate而不是使用Validator模型来保留这种验证方式。那么...是否可以使用类似的东西://Thisisno

Php 变量没有传递到 whereHas 函数 - Laravel Eloquent

总结:我无法访问whereHas函数中的$domain变量(如下);Laravel返回以下错误:"Undefinedvariable:domain"我将我的关系包括在内,因为我不确定Eloquent性质以及我尝试调用此查询的方式是否会导致问题。我有一个调用模型(Org)的中间件Org模型有字段subdomain组织模型有publicfunctiondomains(){return$this->hasMany('App\Domain');}域模型(表名域)有字段domain,org_id还有功能publicfunctionorg(){return$this->belongsTo('App

php - 在 Laravel 中使用迁移重命名表

我正在运行迁移以重命名表,但出现奇怪的错误。publicfunctionup(){Schema::rename($accounts,$feeds);}publicfunctiondown(){Schema::rename($feeds,$accounts);}错误:undefinedvariable:accounts表肯定存在。知道可能是什么问题吗? 最佳答案 你应该使用字符串而不是变量:publicfunctionup(){Schema::rename('accounts','feeds');}publicfunctiondown

PHP 或 Laravel 辅助函数将变量收集到数组中

我依稀记得有一个PHP或Laravel辅助函数将变量收集到命名数组中,使用变量名称作为数组键。那个函数又叫什么名字?与$foo=1;$bar=2;这个电话some_function($foo,$bar);会回来["foo"=>1,"bar"=>2] 最佳答案 使用compact():compact('foo','bar'); 关于PHP或Laravel辅助函数将变量收集到数组中,我们在StackOverflow上找到一个类似的问题: https://stack

php - 错误 : You made a reference to a non-existent script @php artisan package:discover

我在laravel项目中运行composerdump-autoload时出错composerdump-autoloadGeneratingautoloadfiles>Illuminate\Foundation\ComposerScripts::postAutoloadDumpYoumadeareferencetoanon-existentscript@phpartisanpackage:discover然后执行phpartisanpackage:discover返回DiscoveredPackage:barryvdh/laravel-ide-helperDiscoveredPackag