简体   繁体   中英

How to fix "Method Illuminate\Database\Eloquent\Collection::links does not exist."?

First I use pagination and I want to change to all in my Controller, but I got the error above.

This is what I tried :

$c = CarModel::all();

My code :

 public function index()
{
    //$c = CarModel::all(); //got error when use this
    $c = CarModel::paginate(3);

    return view('car.car',compact('c'));
}

I want to change to $c = CarModel::all(); but I got error.

看起来您在“car.car”视图中使用 ->links() 方法,此方法仅在您使用分页时可用

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM