LoginSignup
0
0

More than 1 year has passed since last update.

Laravelのルーティング

Last updated at Posted at 2021-06-03

ルーティング(web.php)

/アプリ名/routes/web.php

取得するパスは【/sample_action】で、SampleControllersampleActionというメソッドを利用する

<?php

Route::get('/sample_action', 'SampleController@sampleAction');

ルートパスを指定

<?php

Route::get('/', function () {
    return 'シンプルなルーティング!';
});

ルートパス/other/のパスを指定


<?php

Route::get('/other', function () {
    return 'ここは/otherです。';
});

/アプリ名/resources/views/samples/blade_example.blade.phpのパスを指定


<?php

Route::get('/blade_example', function(){
    return view('samples.blade_example');
});

blade_example/パスを指定する

resources/viewディレクトリの
samplesディレクトリの
blade_example.blade.phpファイル

が呼び出される

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