php - Laravel delete action inside foreach loop -


For each of the results displayed, I want to remove an affiliate action.

> (* '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 ()}}

Route:

  Root :: post ('agent / blast / {id}', array ( 'Like' = & gt; 'Archive', 'Usage' => Agent Controller @ Post Destroyer ')); Delete the   

function:

  public function postDestroy ($ id) {$ alert = alert :: find ($ id); $ Alert-> remove (); }   

When I give the dd ($ id) , it blank, as if it is not taking the 'id' from the submit button.

Any help would be highly appreciated.

does not pass the HTML id attribute on PHP, I will try to do this Are:

Route:

  Route: post ('agent / blast / {id}', array ('as' =>> archive ',' Usage '= & gt;' blah @ postDestroy '));   

form:

  {{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} ()}   

Controller / Model:

  Public work postDestroy ($ id) {$ alert = alert :: find ($ Id); $ Alert-> remove (); }   

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:

  & 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

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -