ルーティング:アクセスしたアドレスを元に処理を振り分ける。
コントローラ:どういう処理か実装する。
コントローラの作成
php artisan make:controller HelloController
プロジェクトファイル内でartisan(アーティザン)を実行
php artisan make:controller コントローラー名
app\Http\Controllers に作成される。
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class HelloController extends Controller
{
//
}
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class HelloController extends Controller
{
public function index() {
return <<<EOF
<html>
<head>
<title>Hello/Index</title>
<style>
body {font-size:16pt; color:#999; }
h1 { font-size:100pt; text-align:right; color:#eee;
margin:-40px 0px -50px 0px; }
</style>
</head>
<body>
<h1>Index</h1>
<p>これは、Helloコントローラのindexアクションです。</p>
</body>
</html>
EOF;
}
}

