Home > OS >  Undefined Index Array
Undefined Index Array

Time:11-20

I just learning laravel and got this error

route class

calling array on route class using foreach but i got error (undefined index) calling array on route class using foreach but i got error (undefined index)

CodePudding user response:

You're using the wrong variable within the foreach scope.

use $post["title"] instead of $posts["title"]

// @foreach ($posts as $post)

$posts: entire array
$post: an item of array

CodePudding user response:

There is spelling mistake you should use

$post["title"] not $posts["title"]
  • Related