vendredi 31 janvier 2020

Laravel do i need two controllers to handel two store functions?

Basically what i want to do is that 1 Controller handels two store functions called like this:

public function singleupload(){

..some code
}

and

public function multiupload(){
..some code too
}

as i continued to define the routes (get/post)

Route::get('/MultiUpload', 'controller@MultiUpload');
Route::get('/SingleUpload', 'controller@SingleUpload');

Route::post('/MultiUpload', 'controller@storeMulti');
Route::post('/SingleUpload', 'controller@storeSingle');

and as i tried to post some data to my database it tells me that there is no 'store' function. So i opened the docs and found this:

POST    /photos store   photos.store

So my question is can i create two store functions in one controller or do i have to create a different one so every route has its own controller with its own store function?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire