In one of the components of my plugin, I've got a function which reads user input (using Input::get()
), creates a Model
and saves it to the database. The data is submitted to this function via a html form. Now I want to allow users to add new data via Rest API
too. So I create a file called routes.php
in the root directory of my plugin and define a route for posting data. As it's logical to reuse the code that is already available in my plugins component, I tried to map the route to the already available component function:
Route::post('/items', 'Acme\Plugin\Components\ItemsList@addItem');
But this does not work and I get the following error:
The component Acme\Plugin\Components\ItemsList does not contain a method getAfterFilters
Is this how the code should be reused in my Rest API? Why am I getting this error?