I have simple Laravel 5.1 code and I get ErrorException Missing argument 1 for Illuminate\Support\Collection::get(). Here is the code:
public function boot()
{
$news = News::all()->take(5)->get();
view()->share('sideNews', $news);
}
Whenever I delete ->get();, it works. This is my first time using eloquent. I remember when I use the query builder, I always add ->get()to the last line of code. Am I doing it right? Thanks.
source
share