我有这样的方法
function manage(Request $params) {
$orderBy = $params->order;
$show = function($filter) {
switch ($filter) {
case 'published':
return 1;
break;
case 'draft':
return 2;
break;
case 'pending':
return 0;
break;
default :
return false;
}
}
$this->pagination = $params->pagination ?? 10;
if (Auth::id() == 1) {
$post = Post::where('status', $show($params->show) ?? true)
->orderBy($orderBy ?? 'created_at')
->paginate(10);
} else {
$post = Post::where('user_id', Auth::id())
->where('status', $show($params->show) ?? true)
->orderBy($orderBy ?? 'created_at')
->paginate(10);
}
return view('dashboard.post.manage')->with(['post' => $post]);
}
我有这样的错误
syntax error, unexpected '$this' (T_VARIABLE)
我在$this->pagination = $params->pagination ?? 10;
附近感觉到错误
我已经检查了代码,但是我找不到错误,请检查我的代码