我在我的Web应用程序上使用Bllim/Datatables包作为数据表; 但我无法检索所有相关的行.
我使用下面的代码:
$books= $client->books()->where('books.type', 0);
Run Code Online (Sandbox Code Playgroud)
我将它发送到Datatables :: of method如下:
return Datatables::of($books)
->edit_column('type', '{{$type}}')
->edit_column('created_at', function($obj) {
return $obj->created_at->format('d/m/Y (h:i)');
})
->set_index_column('id')
->make();
Run Code Online (Sandbox Code Playgroud)
但所有这些都返回内部服务器错误(500),并带有以下消息:
{"error":
{
"type":"ErrorException",
"message":"Undefined property: Illuminate\\Database\\Eloquent\\Builder::$columns",
"file":"\/var\/www\/clients\/myapp\/vendor\/bllim\/datatables\/src\/Bllim\/Datatables\/Datatables.php",
"line":256
}
}
Run Code Online (Sandbox Code Playgroud)
我的数据库结构:
create table clients(
id int not null auto_increment,
name varchar(10) not null,
password varchar(60) not null,
unique(name),
primary key(id),
created_at timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
updated_at timestamp NOT NULL DEFAULT now() ON UPDATE now()
)CHARSET utf8 COLLATE utf8_spanish_ci;
/* PIVOT TABLE */
create table …Run Code Online (Sandbox Code Playgroud) 假设我们有这样的矩阵A:
10 5 8 6 2
A= 9 3 5 4 1
12 5 7 2 6
Run Code Online (Sandbox Code Playgroud)
如何在没有第三列的情况下选择A的子集(例如)?
像这样:
10 5 6 2
B = 9 3 4 1
12 5 2 6
Run Code Online (Sandbox Code Playgroud)
我知道我可以说:
B = A(:,[1 2 4 5]);
Run Code Online (Sandbox Code Playgroud)
但我需要一个更好的方法