草庐IT

laravel-response

全部标签

php - 在 Laravel 5.x 配置文件中访问 PHP super 全局变量的最佳方法

我需要在我的配置文件(app.php)中使用来自全局变量$_SERVER的一个参数,这样我就可以访问SERVER_NAME并定义哪个静态资源服务器使用。$staticUrlMap['local.example.com']='localstatic.example.com';$staticUrlMap['dev.example.com']='devstatic.example.com';$staticUrlMap['stage.example.com']='stagestatic.example.com';$staticUrlMap['preprod.example.com']='pre

php - Laravel 布局不起作用

我正在尝试一些非常简单的事情,但无法让它发挥作用。我有2页。admin.blade.php和left.blade.php我正在尝试使用管理页面作为母版页。并包含来自left.blade.php的日期管理页面只打印“test”作为结果,不包含来自left.admin.php的任何内容。我看不出有什么问题。提前致谢文件结构为--resources--views*admin.blade.php*left.blade.php左.blade.php@extends('admin')@section('content')baran@stopadmin.blade.php@yield('title'

php - 类不存在 laravel 5.3

namespaceMyApp\Http\Requests;useIlluminate\Foundation\Http\FormRequest;classCreateAdminGroupextendsFormRequest{publicfunctionauthorize(){returnfalse;}publicfunctionrules(){return[//];}}我的Controller:namespaceMyApp\Http\Controllers\Administration\Resource;useMyApp\Http\Requests\Admin\Admin\CreateA

php - laravel 中 db 的总和值

我正在尝试将数据库中的值与其他值相加。但它只保留插入值而不是值的总和。有什么想法吗?foreach($isisjkirimsas$key=>$isisjkirim){IsiSJKirim::where('IsiSJKir',$isisjkir[$key])->update(['QSisaKemInsert'=>'QSisaKemInsert'+$qtertanda[$key]]);}^ithinkthisone 最佳答案 需要先获取数据再更新:$data=IsiSJKirim::where('IsiSJKir',$isisjkir[

php - Laravel Query Builder 其间

我构建了一个搜索表单,它将从数据选择器中插入日期的数据库中选择标记。这很好用,但是,当我添加时间时,我得到错误。我重建了一个类似这样的查询:$datefrom=$request->input('datefrom');$dateto=$request->input('dateto');$timefrom=$request->input('timefrom');$timfrom=$timefrom.':00';$timeto=$request->input('timeto');$timto=$timeto.':00';$type=$request->input('type');$maps=

php - 如何在后台休眠 PHP(Laravel 5.2)

我创建了一个artisan命令,我想在调用方法后立即运行它。但是该命令包含一个sleep();命令。我想在后台运行artisan命令,因为该方法需要返回立即响应用户。我的示例代码如下:在路由文件中Route::get('test',function(){Artisan::queue('close:bidding',['applicationId'=>1]);return'calledclose:bidding';});在close:bidding命令中publicfunctionhandle(){$appId=$this->argument('applicationId');//fol

php - Laravel - 临时存储数据

我正在尝试临时存储数据并在其他页面中打印。所选数据仅在我刷新页面之前有效。我该如何解决?谢谢。index.blade.php{!!Form::select('first_name',$firstNames)!!}GoDashboardController.phppublicfunctiongetIndex(Request$request){$this->data['online_users']=\DB::table('tb_users')->orderBy('last_activity','desc')->limit(10)->get();$this->data['firstNames

php - 路由资源未定义 laravel 5.3

我正在尝试在Laravel5.3中插入​​数据,我是Laravel的新手,我正在尝试使用资源路由系统。当我加载我的页面时,我得到-InvalidArgumentExceptioninUrlGenerator.phpline314:Route[/admin/register-account.store]notdefined.路线Route::group(['middleware'=>'auth'],function(){//ApplicaionhomeRoute::get('/home','HomeController@index');//AdminroutesRoute::get('/

php - Laravel 5.3 在 API 中过滤搜索数据

我正在为前端和移动应用程序实现一个API,现在我正在开发搜索功能,用户可以在其中键入列名或任何data我应该能够以JSON格式提供他们请求的数据所以我做了这个在我的Controller中publicfunctiongetSearchResults(Request$request){$data=$request->get('data');$search_drivers=Driver::where('agent_id','like',"%{$data}%")->orWhere('registration_center','like',"%{$data}%")->orWhere('regis

php - Laravel 列表 concat 不显示数据(全名)

我在我的项目中使用Laravel5.3,我试图获取多个列并在View的下拉选择元素中显示数据。我正在做这样的查询:$users=User::select(DB::raw("CONCAT(first_name,'',last_name)ASfull_name,id"))->lists('full_name','id')->toArray();但这是我从中得到的数据:array:6[▼14=>""15=>""16=>""17=>""19=>""22=>""]full_name的值为空,我该如何解决? 最佳答案 尽量避免使用full_na