嗨,即时通讯与数据表及其伟大的工作,但我有这样的问题在复杂的标头
<thead>
<tr><td>some text</td></tr>
<tr><td>some text</td></tr>
</thead>
Run Code Online (Sandbox Code Playgroud)
现在在显示页面上是这样的
当我点击打印预览时,我得到的结果是这样

第一tr中thead走了我打开datatable.js文件,我发现这个
var addRow = function ( d, tag ) {
var str = '<tr>';
for ( var i=0, ien=d.length ; i<ien ; i++ ) {
// null and undefined aren't useful in the print output
var dataOut = d[i] === null || d[i] === undefined ?
'' :
d[i];
var classAttr = columnClasses[i] ?
'class="'+columnClasses[i]+'"' :
'';
str += '<'+tag+' '+classAttr+'>'+dataOut+'</'+tag+'>';
}
return str + '</tr>';
}; …Run Code Online (Sandbox Code Playgroud) 7 项目,我有这个Voucher_detale模型的全局范围
<?php
namespace App\Scopes;
use Illuminate\Database\Eloquent\Scope;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
class getVouchers implements Scope
{
public function apply(Builder $builder, Model $model)
{
$builder->where('vouchers_detale_state', '=', 1);
}
}
Run Code Online (Sandbox Code Playgroud)
我有Voucher模型,里面有很多,这是代码'
public function getDetales()
{
return $this->hasMany('App\Vouchers_detale','vouchers_detale_voucher_id','id')->withTrashed();
}
Run Code Online (Sandbox Code Playgroud)
在刀片里面我有这个代码
@foreach($voucher['getDetales'] as $v)
<tr class='table-warning'>
<td>
<a href='/{{$path}}/Vouchers_detales/{{$v["id"]}}'>{{$v['vouchers_detale_user_id']}}</a>
<div class='selected d-print-none'>
@foreach($v->getUpdate as $update)
<span style='color:black'>{{$update['update_history_old_amount']}}</span>
{{$update['created_at']}}
{{$update['getUserData']['user_name']}}
<hr />
@endforeach
</div>
</td>
<td>{{$v['getUserData']['user_name']}}</td>
@if($v['vouchers_detale_amount'] > 0)
<td>{{$v['vouchers_detale_amount']}}</td>
<td></td>
@php $total_debt += $v['vouchers_detale_amount'] @endphp
@else
<td></td>
<td>{{$v['vouchers_detale_amount'] * -1}}</td> …Run Code Online (Sandbox Code Playgroud) 我正在使用appserv 5.8,在我的phpinfo.php中,php版本是5.6.26,现在我安装了laravel5.5及其所需的phpversion 7所以我将PHP版本从5改为7现在我的phpinfo.php
PHP Version 7.0.11
Run Code Online (Sandbox Code Playgroud)
当我在命令中写
php -v
Run Code Online (Sandbox Code Playgroud)
它给我
PHP 5.6.26 (cli) (built: Sep 15 2016 18:12:07)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
Run Code Online (Sandbox Code Playgroud)
并且我无法使用laravel 5.5 bc安装软件包命令行中的版本是5.6而不是7但是当我在phpinfo中查看它的7我已经读过这个命令php -v从php-cli修复版本所以如何更改php -v为7.0.1作为phpinfo.php谢谢..
我在 Laravel 中有用户模型
public static function searchScoop($keyword)
{
$users = User::where('username','like','%'.$keyword.'%')->
orwhere('email','like','%'.$keyword.'%')->
orwhere('phone','like','%'.$keyword.'%')->
with('user_permission','user_division')->
get(['id','username','email','phone','division','permission']);
return $users;
}
Run Code Online (Sandbox Code Playgroud)
现在我怎么能用用户变量得到垃圾结果我试图把 withTrashed -> before where after get 无处不在但注意工作..
谢谢你
我想知道是否有任何方法可以更改控制器和模型的基本模板laravel5.4。我的意思是当我跑步时:
php artisan make:controller ControllerName --resource
Run Code Online (Sandbox Code Playgroud)
它会生成这个:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class UsersController extends Controller
{
public function index()
{
return view('users.index');
}
public function create()
{
}
public function store(Request $request)
{
}
public function show($id)
{
}
public function edit($id)
{
}
public function update(Request $request, $id)
{
}
public function destroy($id)
{
}
}
Run Code Online (Sandbox Code Playgroud)
我需要更改此模板以实现我想要更改模型的任何内容。
我有带有自定义登录的 Laravel 5.7 项目。在重定向页面等待 2 或 3 分钟等之后,如何让 Laravel 接受三次登录尝试?
public function loginPost(LoginRequest $request)
{
if (Auth::attempt(array('user_name' => $request->user_name, 'password' => $request->user_pass)))
{
if(Auth::check())
return redirect('/');
else
return back();
}
else
{
return "login faled call administrator";
}
}
Run Code Online (Sandbox Code Playgroud) 我有这个带有自定义属性的选择选项 html
<select id='voucher_dealer' name='voucher_dealer' class='form-control'><option value=''>???? ????</option>
@foreach($dealers as $dealer)
<option dealername='awad' value='{{$dealer->id}}'>{{$dealer->dealer_name}}</option>
@endforeach
</select>
Run Code Online (Sandbox Code Playgroud)
现在我想获得dealername的值我做到了
$("#voucher_dealer").change(function(){
var dealer = $(this).val();
var dealername = $(this).attr("dealername");
alert(dealername);
});
Run Code Online (Sandbox Code Playgroud)
我未定义如何获取属性经销商名称的值
我正在使用laravel 5.5和vuejs2以及lodash项目.我想跳过结果中的第一个数据,如下图所示.这是我的vuejs2代码.
new Vue({
el:'#users',
data:{
message:'',
ok:false,
noresult:false,
arrayresults: [{id:'' ,username: '',useremail: '',userphone:'',}],
},
methods:{
searchData: _.debounce(function(){
if(this.message != '')
{
this.noresult = false;
this.arrayresults = [{id:'' ,username: '',useremail: '',userphone:'',}],
$.ajax({
type:'POST',
url: path+'usersearch',
data: {data:this.message},
success:(data) => {
if(data.length >= 1)
{
for(i = 0;i<data.length;i++)
{
this.arrayresults.push({id:data[i]['id'],username:data[i]['user_name'],useremail:data[i]['user_email'],userphone:data[i]['user_phone']})
}
this.ok = true;
}
else
{
this.ok = false;
this.noresult = true;
}
},
error:function()
{
console.log("error");
}
});
}
else
{
this.ok = false;
this.arrayresults = [{id:'' ,username: '',useremail: …Run Code Online (Sandbox Code Playgroud) 7 项目和VueJs2 这是我的VueJs2代码
mounted: function() {
if(this.edit != null)
{
var token = document.head.querySelector('meta[name="csrf-token"]');
console.log(token);
$.ajax({
type:'POST',
url: path+'get_voucher_data',
data: [{'_token':token}],
success:(data) => {
console.log(data);
}
});
}
}
Run Code Online (Sandbox Code Playgroud)
POST http://localhost/test/public/get_voucher_data 419 (unknown status)
Run Code Online (Sandbox Code Playgroud)
另外,这是我的刀片代码:
<meta name="csrf-token" content="{{ csrf_token() }}">
Run Code Online (Sandbox Code Playgroud)
有谁知道为什么会发生这种情况,我该如何解决?
if ( is_array( $u ) ) {
while( list( $key ) = each( $u ) ) {
$u = $u[$key];
break;
}
}
Run Code Online (Sandbox Code Playgroud)
当我在 laravel 框架上运行它时,我的 php 版本是 7.2 我得到了这个错误
The each() function is deprecated. This message will be suppressed on further calls
Run Code Online (Sandbox Code Playgroud)
我发现那是我必须将每个更改为 foreach 在此处输入链接描述
任何人都将代码更改给我以在 php 7.2 上工作,谢谢
6个项目并且有用户模型,这是用户模型中的一种方法
public function setPasswordAttribute($password)
{
$this->attributes['password'] = bcrypt($password);
}
Run Code Online (Sandbox Code Playgroud)
当我在这样的laravel中使用get()时,一切正常
User::get();
Run Code Online (Sandbox Code Playgroud)
它返回所有用户.我的问题是,有没有办法在模型中编写方法,可以返回有条件的用户,而不是像这样的所有用户
public function setRoleToGetData()
{
$user = Auth::user()->getSex // getSex is method in the model
if($user == 1)
return users in the whole program like this
User::where('user_sex','=',1)->get();
else
// return the reverse
}
Run Code Online (Sandbox Code Playgroud)
我不想写where('user_sex','=',1) in every time i want to get users
感谢