I am working on an application with Laravel which saves files in the database and in the destination folder. I am trying to remove a record from the database, but I get an error which says that the controller method is not found.
Error:
Symphony \ Component \ HTPKLL \ Exception \ NotFoundHttpException Controller method was not found. New NotFoundHttpException Throw ("Controller Method Not Found.");
View alluploads.blade.php is a form where it should end up id / pass function to upload.
{{form :: open (array ('method' => 'DELETE', 'url' = & gt; array ('upload / delete', $ upload-> gt; ;}} {{Form: submit ('delete', array ('class' =' gtc: 'btn-btn-danger'))}} {{form :: closed ()}}
and the function of my controller that removes the row
public function getDestroy ($ id) {$ this- & gt; Upload-> Search ($ id) - & gt; Remove (); Redire ('Upload / All Uploads') Redirection - & gt; ('Message', 'thanks, delete is successful!'); } The following are the routes for using the work under
Upload Controller
Root :: Controller ('Upload', 'Uploads Controller').
You are using the HTTP method DELETE, so your administrator should be the method:
Public Function deleteDestroy ($ id) {$ this- & gt; Upload-> Search ($ id) - & gt; Remove (); Redire ('Upload / All Uploads') Redirection - & gt; ('Message', 'thanks, delete is successful!'); }
Take a look at your routes:
php artisan routes
at least something like this It is like this:
+ -------- + ------------------------- - ------------------------------------ + ----------- - --------- + -------------------------------------- --------------- + -------------------------------- + - -------------- + | Domain | URI | Name | Action | Before filter | After filter + -------- + ---------------------------------------- ----------------------- + ---------------------- + --- -------------------------------------------------- - + -------------------------------- + -------------- - + | | Delete / upload / delete / {a}} / {two?} / {Three?} / {Four?} / {Five?} | | Upload controller @hotanadstore | | | | | GET upload / {_ missing} | | Upload controller @ missingMethod | | | + -------- + ---------------------------------------- ----------------------- + ---------------------- + --- -------------------------------------------------- - + -------------------------------- + -------------- - +
In order to use your form, it must be used as your form is open line:
form :: open (array ('Method' = & gt; GET ',' url '= & gt; array (' Upload / Destroy ', $ Upload-> ID)))
It seems that this is better now, just rename your method.
Comments
Post a Comment