{"id":566,"date":"2018-06-07T04:07:47","date_gmt":"2018-06-06T19:07:47","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=566"},"modified":"2018-06-07T04:07:47","modified_gmt":"2018-06-06T19:07:47","slug":"laravel%e3%83%aa%e3%83%80%e3%82%a4%e3%83%ac%e3%82%af%e3%83%88%e5%ae%9f%e4%be%8b%e3%83%bb%e5%85%a8%ef%bc%95%e3%83%91%e3%82%bf%e3%83%bc%e3%83%b3","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=566","title":{"rendered":"Laravel\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u5b9f\u4f8b\u30fb\u5168\uff15\u30d1\u30bf\u30fc\u30f3"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001Laravel\u306b\u306f\u69d8\u3005\u306a\u6a5f\u80fd\u304c\u305f\u304f\u3055\u3093\u3042\u308a\u307e\u3059\u304c\u3001\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3082\u305d\u306e\u3046\u3061\u306e\uff11\u3064\u3060\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u666e\u6bb5Laravel\u3092\u4f7f\u3063\u3066\u3044\u308b\u3068\u3001\u3064\u3044\u3064\u3044\u5fd8\u308c\u304c\u3061\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3051\u3069\u3053\u306e\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u6a5f\u80fd\u3001\u904e\u53bb\u306bPHP\u306e\u307f\u3067\u5b9f\u88c5\u3057\u305f\u5834\u5408\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30d8\u30c3\u30c0\u30fc\u5185\u306blocation\u3092\u6307\u5b9a\u3057\u3001\u9001\u4fe1\u30c7\u30fc\u30bf\u306f\u3072\u3068\u3064\u3072\u3068\u3064\u30bb\u30c3\u30b7\u30e7\u30f3\u306b\u683c\u7d0d\u3057\u305f\u308a\u3057\u3066\u305f\u3053\u3068\u3092\u601d\u3044\u51fa\u3059\u3068\u3001\u30db\u30f3\u30c8\u306b\u4fbf\u5229\u306b\u306a\u3063\u305f\u306a\u301c\u3068\u5b9f\u611f\u3059\u308b\u4eca\u65e5\u3053\u306e\u3054\u308d\u3067\u3059\u3002<\/p>\n<pre><strong>header('Location: http:\/\/www.example.com\/');\r\ndie();<\/strong><\/pre>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306fLaravel\u306e\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3092\u5b9f\u4f8b\u3068\u3068\u3082\u306b\u307e\u3068\u3081\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-417 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/9.png\" alt=\"\" width=\"370\" height=\"220\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/9.png 370w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/9-300x178.png 300w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/><\/p>\n<h1>\u57fa\u672c\u7684\u306a\u30ea\u30c0\u30a4\u30ec\u30af\u30c8<\/h1>\n<p>\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u306e\u57fa\u672c\u5f62\u306f\u3053\u3046\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre>return <strong>redirect('todofuken\/tokyo')<\/strong>;<\/pre>\n<p>\u3053\u3046\u3059\u308b\u3053\u3068\u3067\u3001\u300c<strong>http:\/\/*****.com\/todofuken\/tokyo<\/strong>\u300d\u3078\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3057\u3066\u304f\u308c\u307e\u3059\u3002\uff08\u3082\u3061\u308d\u3093\u3001\u300chttp\u300d\u3084\u300chttps\u300d\u304b\u3089\u59cb\u307e\u308bURL\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\uff09<\/p>\n<p>\u305d\u3057\u3066\u3001\u3053\u308c\u306f<\/p>\n<pre>return <strong>redirect()-&gt;to('todofuken\/tokyo');<\/strong><\/pre>\n<p>\u3068\u66f8\u3044\u3066\u3082\u540c\u3058\u3053\u3068\u3067\u3059\u3002<br \/>\n\u57fa\u672c\u7684\u306b\u306f\u3067\u304d\u308b\u3060\u3051\u30b3\u30fc\u30c9\u306f\u5c11\u306a\u3044\u307b\u3046\u304c\u3044\u3044\u3068\u306f\u601d\u3044\u307e\u3059\u304c\u3001\u53ef\u8aad\u6027\u3092\u9ad8\u304f\u3057\u305f\u3044\u5834\u5408\u306f\u3053\u3046\u3044\u3046\u66f8\u304d\u65b9\u3082\u3042\u308a\u306a\u306e\u304b\u306a\u3068\u601d\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u3053\u306e\u30d8\u30eb\u30d1\u30fc\u95a2\u6570\u306b\u306f\u5168\u90e8\u3067\uff14\u3064\u306e\u5f15\u6570\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u305d\u308c\u305e\u308c\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>\u5f15\u6570\uff11\uff1a\u30c0\u30a4\u30ec\u30af\u30c8URL\uff08URI\uff09<\/h2>\n<p>\u3055\u304d\u307b\u3069\u7d39\u4ecb\u3057\u305f\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u5148\u306eURL\u3067\u3059\u3002<\/p>\n<h2>\u5f15\u6570\uff12\uff1aHTTP\u30b9\u30c6\u30fc\u30bf\u30b9\u30b3\u30fc\u30c9<\/h2>\n<p>\uff12\u3064\u76ee\u306e\u5f15\u6570\u306f\u3001HTTP\u30b9\u30c6\u30fc\u30bf\u30b9\u30b3\u30fc\u30c9\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<br \/>\n\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u306f\u300c302\u300d\u3067\u3059\u3002<\/p>\n<p>\u5b9f\u969b\u306e\u4f8b\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre>return redirect('todofuken\/tokyo', <strong>301<\/strong>);<\/pre>\n<p>\u3053\u308c\u3092\u5b9f\u884c\u3057\u3066\u30d6\u30e9\u30a6\u30b6\u3067\u78ba\u8a8d\u3057\u3066\u307f\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30b9\u30c6\u30fc\u30bf\u30b9\u30b3\u30fc\u30c9\u304c\u300c301\u300d\u306b\u5909\u308f\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-568\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/06\/Screenshot-from-2018-06-06-18-15-24.png\" alt=\"\" width=\"583\" height=\"171\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/06\/Screenshot-from-2018-06-06-18-15-24.png 583w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/06\/Screenshot-from-2018-06-06-18-15-24-300x88.png 300w\" sizes=\"auto, (max-width: 583px) 100vw, 583px\" \/><\/p>\n<h2>\u5f15\u6570\uff13\uff1aHTTP\u30d8\u30c3\u30c0\u30fc<\/h2>\n<p>\uff13\u3064\u76ee\u306e\u5f15\u6570\u306f\u3001\u8ffd\u52a0\u3057\u305f\u3044\u300cHTTP\u30d8\u30c3\u30c0\u30fc\u300d\u3092\u6307\u5b9a\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u3053\u3093\u306a\u5f62\u3067\u3059\u3002<\/p>\n<pre>return redirect('todofuken\/tokyo', 301,\r\n    <strong>['test-header' =&gt; '(^o^)']<\/strong>\r\n);<\/pre>\n<p>\u3053\u308c\u3092\u5b9f\u884c\u3057\u3066\u3001\u30ec\u30b9\u30dd\u30f3\u30b9\u30d8\u30c3\u30c0\u3092\u78ba\u8a8d\u3057\u3066\u307f\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8ffd\u52a0\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-569\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/06\/Screenshot-from-2018-06-06-18-25-12.png\" alt=\"\" width=\"579\" height=\"136\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/06\/Screenshot-from-2018-06-06-18-25-12.png 579w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/06\/Screenshot-from-2018-06-06-18-25-12-300x70.png 300w\" sizes=\"auto, (max-width: 579px) 100vw, 579px\" \/><\/p>\n<h2>\u5f15\u6570\uff14\uff1ahttps\u306e\u9069\u7528<\/h2>\n<p>\u6700\u5f8c\u306e\u5f15\u6570\u306f\u3001\u30ea\u30c0\u30a4\u30ec\u30af\u30c8URL\u306b\u300c<strong>https:\/\/<\/strong>\u300d\u3092\u4f7f\u3046\u304b\u3069\u3046\u304b\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u300c<strong>true<\/strong>\u300d\u3092\u6307\u5b9a\u3057\u305f\u5834\u5408\u3001<\/p>\n<pre>return redirect('todofuken\/tokyo', 302, [], <strong>true<\/strong>);<\/pre>\n<p>\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3055\u308c\u308bURL\u306f\u3001\u300c<strong>https:\/\/<\/strong>*****.com\/todofuken\/tokyo\u300d\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-570\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/06\/Screenshot-from-2018-06-06-18-32-18.png\" alt=\"\" width=\"446\" height=\"91\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/06\/Screenshot-from-2018-06-06-18-32-18.png 446w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/06\/Screenshot-from-2018-06-06-18-32-18-300x61.png 300w\" sizes=\"auto, (max-width: 446px) 100vw, 446px\" \/><\/p>\n<h1>\u30eb\u30fc\u30c8\u540d\u3092\u4f7f\u3063\u305f\u30ea\u30c0\u30a4\u30ec\u30af\u30c8<\/h1>\n<p>\u4e8b\u524d\u306b\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306b\u540d\u524d\u3092\u3064\u3051\u3066\u304a\u3051\u3070\u3001\u305d\u306e\u540d\u524d\u3092\u6307\u5b9a\u3057\u3066\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u304c\u3042\u308b\u3068\u3057\u307e\u3059\u3002<\/p>\n<pre>Route::get('home\/user_list', 'HomeController@user_list')-&gt;<strong>name('home.user_list');<\/strong><\/pre>\n<p>\u3053\u306e\u5834\u5408\u3001<strong>route()<\/strong>\u306b\u540d\u524d\u3092\u6307\u5b9a\u3059\u308b\u3060\u3051\u3067\u81ea\u52d5\u7684\u306bURL\u3092\u89e3\u6c7a\u3057\u3066\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3057\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n<pre>return redirect()-&gt;<strong>route('home.user_list')<\/strong>;<\/pre>\n<p>\u307e\u305f\u3001\u3082\u3057\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30d1\u30e9\u30e1\u30fc\u30bf\u4ed8\u304d\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u5834\u5408\u306f\u3001route()\u306e\u7b2c\uff12\u5f15\u6570\u3067\u8a72\u5f53\u3059\u308b\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u6307\u5b9a\u3057\u3066\u3084\u308a\u307e\u3059\u3002<\/p>\n<pre>Route::get('user\/<strong>{id}<\/strong>', 'UserController@show')-&gt;name('user.show');<\/pre>\n<pre>return redirect()-&gt;<strong>route('user.show', ['id' =&gt; 100])<\/strong>;<\/pre>\n<p>\u305d\u3057\u3066\u3001\u3082\u3057\u30e2\u30c7\u30eb\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u3042\u308b\u306a\u3089\u76f4\u63a5\u30d1\u30e9\u30e1\u30fc\u30bf\u3068\u3057\u3066\u4f7f\u3046\u3053\u3068\u3082\u3067\u304d\u3066\u3001\u3053\u306e\u5834\u5408\u306f\u300c<strong>id<\/strong>\u300d\u306e\u5024\u304c\u81ea\u52d5\u7684\u306b\u62bd\u51fa\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre><strong>$user<\/strong> = \\App\\User::find(1);\r\nreturn redirect()-&gt;route('user.show', ['id' =&gt; <strong>$user<\/strong>]);<\/pre>\n<p>\u203b\u306a\u304a\u3001\u8a73\u3057\u3044\u30eb\u30fc\u30c8\u540d\u306e\u4ed8\u3051\u65b9\u306f\u3001\u300c<a href=\"https:\/\/blog.capilano-fw.com\/?p=556\">Laravel\u306eRoute\u3001\u5168\uff16\u30d1\u30bf\u30fc\u30f3\u5b9f\u4f8b<\/a>\u300d\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h1>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306e\u30a2\u30af\u30b7\u30e7\u30f3\uff08\u30e1\u30bd\u30c3\u30c9\u540d\uff09\u3092\u4f7f\u3063\u305f\u30ea\u30c0\u30a4\u30ec\u30af\u30c8<\/h1>\n<p>\u3053\u308c\u3082\u30eb\u30fc\u30c8\u540d\u3092\u4f7f\u3063\u305f\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3068\u4f3c\u3066\u3044\u307e\u3059\u304c\u3001\u6307\u5b9a\u3059\u308b\u306e\u306f\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306e\u30a2\u30af\u30b7\u30e7\u30f3\uff08\u30e1\u30bd\u30c3\u30c9\u540d\uff09\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n\u307e\u305a\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u304c\u3042\u308b\u3068\u3057\u307e\u3059\u3002<\/p>\n<pre>Route::get('home', '<strong>HomeController@home<\/strong>');<\/pre>\n<p>\u305d\u3057\u3066\u3001\u5bfe\u5fdc\u3059\u308b\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306f\u4f8b\u3048\u3070\u3053\u3046\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre>class <strong>HomeController<\/strong> extends Controller\r\n{\r\n    <strong>public function home() {<\/strong>\r\n<strong>        return view('home');<\/strong>\r\n<strong>    }<\/strong><\/pre>\n<p>\u3053\u306e\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306e\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u6307\u5b9a\u3059\u308b\u3068\u81ea\u52d5\u3067URL\u3092\u89e3\u6c7a\u3057\u3066\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3057\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n<pre>return redirect()-&gt;<strong>action('HomeController@home');<\/strong><\/pre>\n<p>\u3082\u3057\u3001\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306b\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u5fc5\u8981\u306a\u5834\u5408\u306f\u7b2c\uff12\u5f15\u6570\u3078\u914d\u5217\u3067\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre>Route::get('user\/<strong>{id}<\/strong>', 'UserController@show');<\/pre>\n<pre>return redirect()-&gt;action('UserController@show', <strong>['id' =&gt; 100]<\/strong>);<\/pre>\n<h1>\u76f4\u524d\u306e\u30da\u30fc\u30b8\u3078\u623b\u308b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8<\/h1>\n<p>\u3044\u3061\u3044\u3061\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3059\u308b\u5834\u6240\u3092\u6307\u5b9a\u3057\u306a\u304f\u3066\u3082\u3001\u4eca\u307e\u3067\u8868\u793a\u3057\u3066\u305f\u30da\u30fc\u30b8\u306b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3092\u3057\u305f\u3044\u5834\u5408\u306f<strong>back()<\/strong>\u3092\u4f7f\u3046\u3068\u3044\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u554f\u3044\u5408\u308f\u305b\u30d5\u30a9\u30fc\u30e0\u304c\u3042\u308b\u3068\u3057\u307e\u3059\u3002\uff08\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30a8\u30f3\u30b8\u30f3\u306eBlade\u3092\u4f7f\u3063\u305f\u4f8b\u3067\u3059\uff09<\/p>\n<pre>&lt;form method=\"POST\" action=\"\/back\"&gt;\r\n    @csrf\r\n    \u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&lt;br&gt;\r\n    &lt;input type=\"text\" name=\"email\"&gt;&lt;br&gt;\r\n    \u554f\u3044\u5408\u308f\u305b\u5185\u5bb9&lt;br&gt;\r\n    &lt;textarea name=\"message\"&gt;&lt;\/textarea&gt;&lt;br&gt;\r\n    &lt;button type=\"submit\"&gt;\u9001\u4fe1&lt;\/button&gt;\r\n&lt;\/form&gt;<\/pre>\n<p>\u898b\u305f\u76ee\u306f\u3053\u3046\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-575\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/06\/l56-test-redirect_form.png\" alt=\"\" width=\"218\" height=\"148\" \/><\/p>\n<p>\u3053\u306e\u3068\u304d\u3001\u9001\u4fe1\u5148\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u30a2\u30af\u30b7\u30e7\u30f3\u304c\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u305f\u5834\u5408\u3001\u81ea\u52d5\u7684\u306b\u5143\u306e\u30da\u30fc\u30b8\u3078\u623b\u3057\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n<pre>public function back() {\r\n\r\n    <strong>return back();<\/strong>\r\n\r\n}<\/pre>\n<p>\u307e\u305f\u3001\u3053\u306e\u3088\u3046\u306a\u5834\u5408\u3067\u9001\u4fe1\u3057\u305f\u30c7\u30fc\u30bf\u3068\u4e00\u7dd2\u306b\u623b\u3057\u305f\u3044\u5834\u5408\u306f<strong>withInput()<\/strong>\u3092\u4f7f\u3048\u3070\u3001\u9001\u4fe1\u3055\u308c\u305f\u30c7\u30fc\u30bf\u304c\u81ea\u52d5\u3067\u30bb\u30c3\u30b7\u30e7\u30f3\u5185\u306b\u683c\u7d0d\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre>public function back() {\r\n\r\n    return back()-&gt;<strong>withInput();<\/strong>\r\n\r\n}<\/pre>\n<p>\u9001\u4fe1\u3055\u308c\u305f\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u305f\u3044\u5834\u5408\u306f\u3001<strong>old()<\/strong>\u3092\u4f7f\u3063\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre>&lt;form method=\"POST\" action=\"back\"&gt;\r\n    @csrf\r\n    \u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9&lt;br&gt;\r\n    &lt;input type=\"text\" name=\"email\" value=\"<strong>{{ old('email') }}<\/strong>\"&gt;&lt;br&gt;\r\n    \u554f\u3044\u5408\u308f\u305b\u5185\u5bb9&lt;br&gt;\r\n    &lt;textarea name=\"message\"&gt;<strong>{{ old('message') }}<\/strong>&lt;\/textarea&gt;&lt;br&gt;\r\n    &lt;button type=\"submit\"&gt;\u9001\u4fe1&lt;\/button&gt;\r\n&lt;\/form&gt;<\/pre>\n<p>\u306a\u304a\u3001\u3082\u3057\u7279\u5b9a\u306e\u9001\u4fe1\u30c7\u30fc\u30bf\u3060\u3051\u3092\u623b\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306bRequest\u3092only()\u306a\u3069\u3067\u6307\u5b9a\u3057\u3066withInput()\u306b\u5f15\u6570\u3068\u3057\u3066\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre>public function back(<strong>Request $request<\/strong>) {\r\n\r\n    return back()-&gt;withInput(<strong>$request-&gt;only(['email'])<\/strong>);\r\n\r\n}<\/pre>\n<h1>\u30bb\u30c3\u30b7\u30e7\u30f3\u30c7\u30fc\u30bf\u3068\u3068\u3082\u306b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8<\/h1>\n<p>\u4f8b\u3048\u3070\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u9001\u4fe1\u304c\u3046\u307e\u304f\u3044\u3063\u305f\u5834\u5408\u300c<strong>\u9001\u4fe1\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f<\/strong>\u300d\u3068\u3044\u3046\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u8868\u793a\u3057\u305f\u3044\u3068\u3057\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u5834\u5408\u306f\u3001<strong>with()<\/strong>\u3092\u4f7f\u3063\u3066\u30bb\u30c3\u30b7\u30e7\u30f3\u30c7\u30fc\u30bf\u3092\u683c\u7d0d\u3057\u3064\u3064\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3059\u308b\u3053\u3068\u3067\u5b9f\u73fe\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre>return redirect('home')-&gt;<strong>with('result', '\u6210\u529f\u3067\u3059\uff01');<\/strong><\/pre>\n<p>\u3053\u3046\u3057\u3066\u304a\u304f\u3068\u3001\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3057\u305f\u5148\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30bb\u30c3\u30b7\u30e7\u30f3\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><strong>{{ session('result') }}<\/strong><\/pre>\n<p>\u3061\u306a\u307f\u306b\u3001with()\u306b\u306f\u914d\u5217\u3082\u4f7f\u3046\u3053\u3068\u304c\u3067\u304d\u3066\u3001\u3053\u306e\u5834\u5408\u4e00\u6c17\u306b\u30c7\u30fc\u30bf\u3092\u683c\u7d0d\u3067\u304d\u3066\u4fbf\u5229\u3067\u3059\u3002<\/p>\n<pre>return redirect('home')-<strong>&gt;with([<\/strong>\r\n<strong>    'result_1' =&gt; '\u6210\u529f\u3067\u3059 - 1',<\/strong>\r\n<strong>    'result_2' =&gt; '\u6210\u529f\u3067\u3059 - 2',<\/strong>\r\n<strong>    'result_3' =&gt; '\u6210\u529f\u3067\u3059 - 3'<\/strong>\r\n<strong>]);<\/strong><\/pre>\n<p>\u306a\u304a\u3001with()\u304c\u4f7f\u3048\u308b\u306e\u306f<strong>redirect()<\/strong>\u3060\u3051\u3067\u306f\u306a\u304f\u3001<strong>back()<\/strong>\u3067\u3082\u5229\u7528\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre>return back()<strong>-&gt;with('message', '\u623b\u308a\u307e\u3057\u305f\uff01');<\/strong><\/pre>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306fLaravel\u306e\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u306b\u3064\u3044\u3066\u307e\u3068\u3081\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u8fd1\u5e74\u3001Ajax\u3078\u306e\u79fb\u884c\u304c\u9032\u3093\u3067\u3044\u308b\u30a6\u30a7\u30d6\u696d\u754c\u3067\u3059\u304c\u3001\u307e\u3060\u307e\u3060\u901a\u5e38\u306e\u30d5\u30a9\u30fc\u30e0\u9001\u4fe1\u3082\u9700\u8981\u304c\u3042\u308b\u3068\u601d\u3046\u306e\u3067\u3001\u5730\u5473\u306a\u6a5f\u80fd\u3067\u3059\u3051\u3069\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3082\u305c\u3072\u6d3b\u7528\u3057\u305f\u3044\u3068\u3053\u308d\u3067\u3059\u306d\u3002<\/p>\n<p>\u304a\u5f79\u306b\u7acb\u3066\u305f\u3089\u5b09\u3057\u3044\u3067\u3059\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-427 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/24.png\" alt=\"\" width=\"182\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/24.png 182w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2018\/04\/24-171x300.png 171w\" sizes=\"auto, (max-width: 182px) 100vw, 182px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001Laravel\u306b\u306f\u69d8\u3005\u306a\u6a5f\u80fd\u304c\u305f\u304f\u3055\u3093\u3042\u308a\u307e\u3059\u304c\u3001\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3082\u305d\u306e\u3046\u3061\u306e\uff11\u3064\u3060\u3068\u601d\u3044\u307e\u3059\u3002 \u666e\u6bb5Laravel\u3092\u4f7f\u3063\u3066\u3044\u308b\u3068\u3001\u3064\u3044\u3064\u3044\u5fd8\u308c\u304c\u3061\u306b\u306a\u3063 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=566\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Laravel\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u5b9f\u4f8b\u30fb\u5168\uff15\u30d1\u30bf\u30fc\u30f3&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":574,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[71],"class_list":["post-566","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel","tag-71"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/566","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=566"}],"version-history":[{"count":5,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/566\/revisions"}],"predecessor-version":[{"id":577,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/566\/revisions\/577"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/574"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=566"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=566"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}