Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.1K
Views
Llamar a una función miembro links () en una matriz en error de Laravel

Estaba trabajando con Laravel y estoy tratando de paginar mi tabla de libros. Recibí este error "Llamar a un enlace de función miembro () en una matriz en Laravel". Puede ser como el error del duplicado, pero todavía no puedo encontrar la manera de resolver mi problema.

Violín BookController:

 public function index() { $books = Book::simplePaginate(3)->all(); $authors = Author::all(); $genres = Genre::all(); return view('books.all')->withBooks($books)->withAuthors($authors)->withGenres($genres); }

libros/all.blade.php violín

 <table class="table table-hover"> <tr class="info"> <td>#</td> <td>Name</td> <td>Author</td> <td><center>Visit</center></td> </tr> @foreach($books as $book) <tr> <td width="50px"><img width="50px" height="75px" src="{{ asset('images/' . $book->image) }}"></td> <td width="50px">{{ $book->name }}</td> <td width="50px">{{ $book->author->name }}</td> <td width="50px"><center><a href="{{ url('books', $book->id) }}"><button class="btn btn-success">Visit</button></a></td> </tr> @endforeach </table> {{ $books->links() }}
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Simplemente elimine el método ->all() de la variable $books.

 $books = Book::paginate(10);

La función paginate () considera tomar todo el contenido de la tabla, que es tomado aquí por el modelo Book

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!