yokana
yokana

Reputation: 309

Laravel : how to call method in model from controller

I have model tracking and method getTarcking with return is response from API, i want call those response from controller and parsing to view

I my controller create index method

$Mrespone = $this->Tracking->getTracking();

return view('tracking/index'['respon'=>$Mrespone]);

But, In controller I got error

Upvotes: 0

Views: 88

Answers (2)

Kaung Khant
Kaung Khant

Reputation: 71

You forgot a comma(,). Try dd($Mrespone) just to be sure whether you are getting a response or not.

$Mrespone = $this->Tracking->getTracking();

return view('tracking/index',['respon'=>$Mrespone]);

Upvotes: 1

Rajkumar Sharma
Rajkumar Sharma

Reputation: 584

first debug whether you getTracking() is getting response or not.

dd($Mrespone)

if data is showing then comment dd() and for view you can do like this

return view('tracking/index')->with('respon', $Mrespone);

Upvotes: 0

Related Questions