<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                現在介紹 CRUD 中的 D,從數據庫中刪除文章。按照 REST 架構的約定,刪除文章的路由是: > DELETE articles/{articles} | articles.destroy | ArticlesController@destroy 刪除資源時使用 DELETE 請求。如果還使用 GET 請求,可以構建如下所示的惡意地址: ~~~ <a href='http://example.com/articles/1/destroy'>look at this cat!</a> ~~~ 刪除資源使用 DELETE 方法,路由會把請求發往 app/controllers/ArticlesController.php 中的 destroy 動作。修改 destroy 動作: ~~~ public function destroy($id) { Article::destroy($id); return Redirect::route('articles.index'); } ~~~ 想把記錄從數據庫刪除,可以在模型對象上調用 destroy 方法。注意,我們無需為這個動作編寫視圖,因為它會轉向 index 動作。 最后,在 index 動作的模板(app/views/articles/index.blade.php)中加上“Destroy”鏈接: ~~~ <table> <tr> <th>Title</th> <th>Text</th> <th colspan="2"></th> </tr> @foreach ($articles as $article) <tr> <td>{{ $article->title }}</td> <td>{{ $article->text }}</td> <td>{{ link_to_route('articles.show', 'Show', $article->id) }}</td> <td>{{ link_to_route('articles.edit', 'Edit', $article->id) }}</td> <td> {{ Form::open(array('method' => 'DELETE', 'route' => array('articles.destroy', $article->id))) }} {{ Form::submit('Delete') }} {{ Form::close() }} </td> </tr> @endforeach </table> ~~~ 恭喜,現在你可以新建、顯示、列出、更新、刪除文章了。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看