How to call public function in .vue

Hello,
I’m trying to call function in sample app notestutorial in app.vue,
this was added to the app.vue file:

  			<RecycleScroller
  			id="device-list"
  			:items="allnotes"
  			key-field="id">
  			<h2>{{ allnotes.name }}</h2>
  		</RecycleScroller>

and in computed part I add this function:

  allnotes() {
  	return this.notes.findAll('testuser')
  },

there is findAll function in files NoteService.php, NoteMapper.php and I add it to the NoteController.php as well:

public function findAll(string $user_id) {
    return $this->service->findAll($user_id);
}

The result is TypeError: "this.notes.findAll is not a function"

Thank you in advance for any help!
Bob

Hello Bob,

you cannot call PHP Controller methods from the client directly. You need to return e.g. a JSON response in your controller, expose your controller method as a route in routes.php and then fetch that URL on the client.

Thank you!