草庐IT

laravel-censor

全部标签

php - 在 View laravel 中从 Controller 调用函数

这实际上是一件简单的事情,但由于我是laravel的新手,这让我很麻烦,我有这个功能classHomeControllerextendsController{public$layout='layouts.master';publicfunction__construct(){$this->middleware('auth');}publicfunctionindex(){returnview('landing-page')->with('title','LandingPage')->with('users',User::member()->get());}publicfunctiong

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 - 在 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('/