1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

laravel5.8ルーティング

1
Last updated at Posted at 2021-07-09

laravelを学ぶ機会があったので、簡単にまとめたいと思います。

全体像

全体流れ-2.jpg

CRUD処理

CRUD処理とは
システムに必要な4つの主要機能である
「Create(生成)」「Read(読み取り)」「Update(更新)」「Delete(削除)」
の頭文字を並べた用語です。

HTTPメソッドを指定するルーティング

GET ・・・ (データを取得する基本的なもの)
POST ・・・ (データの追加に使用)
PUT ・・・ (データの更新に使用)
DELETE ・・・ (データの削除に使用)
※他もある

アクション

スクリーンショット 2021-07-12 21.25.08.png

実装例

routes/web.php

    Route::get('/', 'PostsController@index');
    Route::get('posts/new', 'PostsController@create')->name('posts.create');
    Route::post('posts', 'PostsController@store')->name('posts.store');
    Route::get('post/{id}/edit', 'PostsController@edit')->name('post.edit');
    Route::post('post/{id}', 'PostsController@update')->name('post.update');
    Route::delete('post/{id}', 'PostsController@destroy')->name('post.destroy');
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?