jjzjj

php - Laravel 5.4 是否已完成记录作业的解决方案?

我在我的项目中使用Laravel5.4和MySQL。远程服务器是PHPServer7当用户将记录保存到数据库时,它还会创建一个队列作业以通知相关公司官员。我的代码在Controller文件中foreach($audit->mailusersAS$mailuser){$this->dispatch(newSendAuditEmail($audit->id,$mailuser->name,$mailuser->email));}我正在为QUEUEDRIVER使用数据库。我的意思是它是这样写在.env文件中的:QUEUE_DRIVER=database如您所知,如果您使用“数据库”而不是“r

php - 拉维尔 5.4 : get products with favorite and display favorites product for each user

我正在尝试获取收藏夹中的所有产品并像用户登录一样显示它们,收藏夹中的该产品将显示为收藏夹,否则他可以将它们添加到收藏夹。这是我的Controller$products=(newProduct)->where('quantity','>',0)->with('favorite')->orderBy('price',$sort)->get();现在如果我制作dd($product->favorite)我会像这样得到最喜欢的数组[{"id":1,"product_id":7,"user_id":1,"created_at":"2018-04-0109:16:23","updated_at":

php - PHP 5.4 的 Dreamweaver CS5 代码提示和语法错误

我做了一些研究,但没有找到完全适合我的情况的东西。我正在将DreamweaverCS5与PHP文件一起使用,Dreamweaver提醒我我的代码中存在以下行的错误:if(explode("_","some_variable")[0]=="some"){如果我删除方括号[]那么错误消息就会消失,使行成为if(explode("_","some_variable")=="some"){//nevertrueobviously我知道我可以将展开的数组分配给一个变量,然后调用该变量的第一个值来删除这段代码,但我试图找到一个能够编写更多速记代码的解决方案。我从这里的答案中发现PHP5.4版支持这

php - 在 Laravel 5.4 中从迁移中删除列

我使用像这样的迁移创建了一个表:Schema::create('listings',function(Blueprint$table){$table->increments('id');$table->decimal('original_price',10,2);$table->decimal('discouted_price',10,2);$table->integer('city_id')->index()->unsigned()->nullable();$table->foreign('city_id')->references('id')->on('cities');$tabl

php - laravel 5.4 php artisan serve 无效请求(意外的 EOF)

我正在使用Windows10和wamp服务器,我刚刚安装了laravel,我得到的只是这条错误消息,每次我打开laravel时是否有必要执行phpartisanserve?只要我关闭cmd提示localhost:8000refusedtoconnect。Phpartisan服务错误 最佳答案 我认为您正在通过phpartisanserve命令运行Laravel项目blog并且您正在通过localhost:8000或127.0.0.1:8000浏览您的应用程序您的屏幕截图显示,当您尝试访问未在routes/web.php中定义的url

php - 在 Laravel 5.4 中找不到类 'NumberFormatter'

我正在尝试使用PHP的国际扩展将金额转换为单词。例如,1450->OneThousandFourHundredandFifty我使用的是在XAMPP3.2.2服务器上运行的Laravel5.4和PHP5.6.24。正如在类似问题中提到的,我已经通过在PHP.ini文件中取消对extension=ext/php_intl.dll行的注释来启用intlPHP扩展,并且之后重新启动了我的服务器。$inWords=new\NumberFormatter('en',\NumberFormatter::SPELLOUT);echo$inWords->format(1450);产生错误:FatalE

php - 在 Laravel 5.4 中执行批量删除语句时,如何根据 Eloquent 'deleting' 事件执行操作?

我的项目中有2个Eloquent模型:App\StoredFile和App\StoredImageSize。StoredFile模型负责保存上传的文件信息。如果上传的文件是图像,则2个缩略图将存储在存储中,它们的属性存储在数据库中(StoredImageSize模型)。关系如下:存储文件.php:publicfunctionsizes(){return$this->hasMany('App\StoredImageSize');}StoredImageSize.php:publicfunctionoriginalImage(){return$this->belongTo('App\Sto

php - 如何使用 Laravel 5.4 中的 Controller 从我的数据库传递 5 个不同数据的总和数据?

我是laravel5.4的新手,当我在数据库中查看具有id的特定guest时,我想从我的数据库中获取5个不同数据的总和?我无法得到总和或总数这是我的代码:publicfunctionshow($id){$forPayment=ForPayment::where('application_number',$id)->get()->last();if(empty($forPayment)){Flash::error('ForPaymentnotfound');returnredirect(route('forPayments.index'));}$inspection_fee=$forPa

php - Axios CORS/Preflight 因 Laravel 5.4 API 调用而失败

我在使用Laravel5.4和使用Axios处理请求的React应用程序时遇到问题。这是我遇到的错误。这是我对失败的预检响应的请求header。这是预检后失败的请求:这是我的Axios请求配置:letreq=axios({method:"GET",url:https://api.vendorgraphs.com/{queryStringHere}headers:{'Accept':'application/json','Content-Type':'application/json','Authorization':'Bearer'+accessToken}});需要注意的一件有趣的事

php - 如何在 Laravel 5.4 中获取多选值

我正在使用adminlte的多选.我不想获得多选的值(value),我怎么能得到它dd($request)的输出查看AlabamaAlaskaCaliforniaDelawareTennesseeTexasWashingtonControllerfunctionsearchLeaveStatus(Request$request){$status=$request->input('leave_status');$status=implode(',',$status);$leave_list=LeaveStatus::whereIn('leave_status',$status)->get