はじめに
databaseにも繋げない、非常にシンプルな方法でrouterとcontrollerを繋げる
routerの編集
“` routes/web.php“`
<?php /* |-------------------------------------------------------------------------- | 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('/', 'PostsController@index');
controllerの作成
“` php artisan make:controller PostsController “`
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; class PostsController extends Controller { // public function index(){ return 'hello'; } }
結果