0
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.

#8 ルーティングの実装 ~laravel×AWSで掲示板を作ろう~

Posted at

#laravel×AWSで掲示板を作ろう
本記事は、laravel×AWSの第8回です。
作ったサイト:https://vible.jp

#ルーティング
laravel的な考え方です。
どこのURLにどのようにアクセス(get,post)したかに応じて、実行するコントローラを指定するものです。
参考までに記載しておきます。

web.php
<?php

use Illuminate\Support\Facades\Route;
use App\Http\Middleware\HelloMiddleware;
use Illuminate\Auth\Middleware\Authenticate;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/


Route::get('/', 'QuestionController@index')->name('toppage');
Route::delete('test/destroy/{id}', 'QuestionController@nayami_destroy')->name('destroy');
Route::delete('test/mypage/destroy/{id}', 'TweetController@tweet_destroy')->name('tweet.destroy');

Route::get('test', 'QuestionController@index')->name('toppage');
Route::post('/questionlike', 'QuestionController@ajaxlike');

Route::get('test/mypage', 'TweetController@mypage')->middleware('auth');
Route::get('/test/mypage/tweet/{id}', 'TweetController@detail');
Route::post('/tweetlike', 'TweetController@tweetlike');
Route::post('/answertweetlike', 'TweetController@answer_tweet_like');

//名前のリンクから飛んでくるとき用
Route::post('test/mypage', 'TweetController@gotomypage')->middleware('auth');
Route::post('test/mypage/tweet', 'TweetController@tweet_add')->middleware('auth');
Route::post('/test/mypage/tweet/{id}', 'TweetController@tw_comment')->middleware('auth');


Route::get('test/add', 'QuestionController@nayami_add')->middleware('auth');
Route::post('test/add', 'QuestionController@nayami_create')->middleware('auth');


Route::get('/logout', 'Auth\LoginController@logout');

//ホーム画面のLogin,Registerの表示をしてくれる
Route::auth();


Route::get('/nayami/{id}', 'QuestionController@detail')->middleware('auth');
Route::post('/nayami/{id}', 'QuestionController@nayami_answer');
Route::post('answerquestionlike', 'QuestionController@answer_question_like');

?>
0
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
0
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?