0

This is My code which is used in function -

foreach($allcourses as $allcourse) {
  $tl_class[] = $allcourse['title_of_class'];
  // $trn_email[] = $allcourse['trainer_email'];
}
$rating = new RatingController;
Log::info(print_r($tl_class, true). ' : RatingController tl_class data');

I want to send array data a parameter as below-

$rating = new RatingController;
$rating_data = $rating->getAllPublicRatting($tl_class);

but Showing error. So, How to pass this array value as a parameter?

2
  • What error did you get? Commented Nov 5, 2021 at 9:29
  • Call to a member function all() on array {"userId":40,"email":"[email protected]","exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function all() on array at C:\\xampp\\htdocs\\ds-student-ms\\app\\Http\\Controllers\\PassportAPI\\ClassController.php:27) Commented Nov 5, 2021 at 9:35

1 Answer 1

1
$tl_class[];
foreach ($allcourses as $allcourse) {
            tl_class->push($allcourse['title_of_class']);
           // $trn_email[] = $allcourse['trainer_email'];
        }

you need to push data to your array cause your each loop when return always your array define empty.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.