我现在要从表中获取last_id,我想从控制器发送以进行查看。我收到以下错误
“ htmlspecialchars()期望参数1为字符串,给定对象(视图:D:\ xampp \ htdocs \ playout \ resources \ views \ category.blade.php) “
控制器:
public function categoryLastId()
{
$category_type_id = DB::table('table_category_type')->orderBy('category_type_id','DESC')->first();
return view('category',compact('category_type_id'));
}
刀片:
<div class="form-group row">
<label class="col-sm-2 col-form-label"></label>
<label class="col-sm-2 col-form-label">Category id</label>
<div class="col-sm-6">
<input type="text" class="form-control" placeholder="Category Id" name="id" readonly value="{{ $category_type_id}}">
</div>
</div>