php - Laravel delete action inside foreach loop -
For each of the results displayed, I want to remove an affiliate action.
Route: function: When I give the Any help would be highly appreciated. does not pass the HTML id attribute on PHP, I will try to do this Are: Route: form: Controller / Model: As far as I know that the IDs are attributes, only really are used to select the elements within the DOM. Edit: Change the following: > (* 'path' => Array ('collection', $ warning-> ID), 'foreach loop I have: > < Former>
role '= & gt;' form '))}} & lt; Table class = "table-table-responsive" id = "alert" & gt; & Lt; Thead & gt; & Lt; TR & gt; & Lt; th class = "header" & gt; Id & lt; / Th & gt; & Lt; Th class = "header" & gt; Collection & lt; / Th & gt; & Lt; / TR & gt; & Lt; / Thead & gt; & Lt; Tbody & gt; @Vernak ($ Warning-> Alerts as Alert) & lt; Tr & gt; & Lt; Td> & Lt; Button type = "submit" class = "btn btn-warning" name = "archive" & gt; Collection & lt; / Button & gt; & Lt; / Td> & Lt; / TR & gt; @earnchach & lt; / Tbody & gt; & Lt; / Table & gt; {{Form :: Closed ()}}
Root :: post ('agent / blast / {id}', array ( 'Like' = & gt; 'Archive', 'Usage' => Agent Controller @ Post Destroyer ')); Delete the
public function postDestroy ($ id) {$ alert = alert :: find ($ id); $ Alert-> remove (); }
dd ($ id) , it blank, as if it is not taking the 'id' from the submit button.
Route: post ('agent / blast / {id}', array ('as' =>> archive ',' Usage '= & gt;' blah @ postDestroy '));
{{form :: open (array ('path' => array ('collection', $ warning-> gt; ; Id), "role" = & gt; 'form'))}} & lt; Td> & Lt; Button type = "submit" class = "btn btn-warning" name = "archive" & gt; Collection & lt; / Button & gt; & Lt; / TD & gt; {{Form :: close} ()}
Public work postDestroy ($ id) {$ alert = alert :: find ($ Id); $ Alert-> remove (); }
& lt; Table class = "table diameter table-responsive" id = "alert" & gt; & Lt; Thead & gt; & Lt; TR & gt; & Lt; Th class = "header" & gt; Id & lt; / Th & gt; & Lt; th class = "header" & gt; Collection & lt; / Th & gt; & Lt; / TR & gt; & Lt; / Thead & gt; & Lt; Tbody & gt; @Vernak ($ Warning-> Alerts as Alert) & lt; Tr & gt; {{Form :: open (array ('path' = & gt; array ('collection', $ warning- & gt; id), 'role' = & gt; 'form'))}} & lt; Td> & Lt; Button type = "submit" class = "btn btn-warning" name = "archive" & gt; Collection & lt; / Button & gt; & Lt; / Td> {{Form :: off ()}} & lt; / Tr & gt; @earnchach & lt; / Tbody & gt; & Lt; / Table & gt;
Comments
Post a Comment