我的错误是:
077cf636f32dba5a90c4b83021f7bfea049823d7.php中的FatalErrorException 0:方法Illuminate \ View \ View :: __ toString()不能抛出异常
我的路线:
library(microbenchmark)
v <- c(2, 4, 6, 8)
rv <- rev(v)
f <- function(vec, pos){z<-rep(NA,length(vec)+1);z[pos]<-0;z[is.na(z)]<-vec;z;}
f_m0h3n <- function(v){t(sapply(5:1, function(x) {if (x%%2==1) f(rv,x) else f(v,x)}))}
f_Roland <- function(v){
m <- matrix(0, length(v), length(v) + 1)
m[, c(FALSE, TRUE)] <- rev(v)
m[, c(TRUE, FALSE)] <- v
m <- t(m)
m1 <- matrix(0, length(v) + 1, length(v) + 1)
m1[upper.tri(m1)] <- m[upper.tri(m, TRUE)]
m1[lower.tri(m1)] <- m[lower.tri(m)]
m1[, rev(seq_len(ncol(m1)))]
}
all(f_m0h3n(v)==f_Roland(v))
# [1] TRUE
microbenchmark(f_m0h3n(v), f_Roland(v))
# Unit: microseconds
# expr min lq mean median uq max neval
# f_m0h3n(v) 106.931 109.4975 115.1818 112.064 119.7625 180.927 100
# f_Roland(v) 114.202 116.3410 128.5183 119.763 126.8210 430.290 100
我的控制器:
Route::get('/delete-status/{status_id}', [
'uses' => 'Classroom@getDeleteStatus',
'as' => 'Status.delete',
'middleware' => 'auth'
]);
我的观点:
public function getDeleteStatus($status_id)
{
$status = Status::where('id', $status_id)->first();
$status->delete();
return redirect()->route('class')->with(['message' => 'Successfully deleted!']);
}
我该怎么办?
答案 0 :(得分:0)
我认为您的路线应该删除。路线::删除
<form action="action('Classroom@getDeleteStatus', {{$status_id}})" method="POST">
<input type="hidden" name="_method" value="DELETE">
{{ csrf_field() }}
<button type="submit" class="btn btn-xs btn-danger pull-left"><i class="fa fa-trash"></i></button>
</form>
我当时做的是资源控制器,但您可以使用Route :: delete 您可以在此处查看有关资源控制器的更多信息:https://laravel.com/docs/5.2/controllers
在您看来:
public function getDeleteStatus($status_id)
{
$status = Status::where('id', $status_id)->first();
$status->delete();
return redirect()->route('class')->with(['message' => 'Successfully deleted!']);
}
然后在您的控制器中
var newItems : [String:String] = [:]
for i in 1..10{
newItems[i.description] = "A new item"
}
答案 1 :(得分:-1)
我的观点应该是
<div style="text-align: right">
<a href="#" class="edit">Edit</a> ||
<a href="{{ route('Status.delete', ['status_id' => $status->id]) }}">Delete</a>