{"id":25370,"date":"2014-06-05T17:24:41","date_gmt":"2014-06-05T08:24:41","guid":{"rendered":"http:\/\/www.ospn.jp\/press\/?p=25370"},"modified":"2014-11-28T16:09:30","modified_gmt":"2014-11-28T07:09:30","slug":"no40-useit-oss","status":"publish","type":"post","link":"https:\/\/www.ospn.jp\/press\/20140605no40-useit-oss.html","title":{"rendered":"\u300c\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u300d\u3092\u4f7f\u3063\u3066\u307f\u3088\u3046 (\u7b2c35\u56de php\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af Laravel\uff09"},"content":{"rendered":"<h1>php\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af Laravel<\/h1>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\nLaravel jp \u30e6\u30fc\u30b6\u30fc\u30b0\u30eb\u30fc\u30d7<br \/>\n\u7af9\u6fa4 \u6709\u8cb4<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n1.<a href=\"#introduction\">\u306f\u3058\u3081\u306b<\/a><br \/>\n2.<a href=\"#setup\">\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7<\/a><br \/>\n3.<a href=\"#configure\">\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306b\u3064\u3044\u3066<\/a><br \/>\n4.<a href=\"#router\">\u30eb\u30fc\u30bf\u30fc\u306b\u3064\u3044\u3066<\/a><br \/>\n5.<a href=\"#controller\">\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306b\u3064\u3044\u3066<\/a><br \/>\n6.<a href=\"#model\">\u30e2\u30c7\u30eb\u306b\u3064\u3044\u3066<\/a><br \/>\n7.<a href=\"#view\">\u30d3\u30e5\u30fc\u306b\u3064\u3044\u3066<\/a><br \/>\n8.<a href=\"#container\">Ioc\u30b3\u30f3\u30c6\u30ca<\/a><br \/>\n9.<a href=\"#other\">\u305d\u306e\u4ed6<\/a><\/p>\n<h2 id=\"introduction\">1.\u306f\u3058\u3081\u306b<\/h2>\n<p>PHP\u306b\u306f\u591a\u304f\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u304c\u3042\u308b\u306e\u3092\u3054\u5b58\u77e5\u3067\u3057\u3087\u3046\u304b\uff1f<br \/>\n\u6628\u4eca\u3001cakePHP\u3001Symfony2\u3001Zend Framework\u3001codeigniter\u3084FuelPHP\u306a\u3069\u3001<br \/>\n\u69d8\u3005\u306a\u7a2e\u985e\u306ePHP\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u304c\u591a\u6570\u5b58\u5728\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u3054\u7d39\u4ecb\u3059\u308b\u300cLaravel\u300d\u306f\u3001\u305d\u306e\u4e2d\u3067\u3082\u6700\u65b0\u92ed\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3042\u308a\u3001<br \/>\n\u3053\u308c\u307e\u3067\u591a\u304f\u306e\u30e6\u30fc\u30b6\u30fc\u304c\u4f7f\u7528\u3057\u3066\u304d\u305f\u30e9\u30a4\u30d6\u30e9\u30ea\u63d0\u4f9b\u30b5\u30fc\u30d3\u30b9\u306e\u300cPEAR\u300d\u3067\u306f\u306a\u304f\u3001<br \/>\n\u300ccomposer\u300d\u3068\u3044\u3046\u30e9\u30a4\u30d6\u30e9\u30ea\u7ba1\u7406\u30c4\u30fc\u30eb\u3092\u5229\u7528\u3057\u305f\u30e2\u30c0\u30f3\u306a\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3059\u3002<br \/>\nFuelPHP\u3084Kohana\u306e\u3088\u3046\u306a\u3001CodeIgniter\u306e\u958b\u767a\u8005\u304c\u30d5\u30a9\u30fc\u30af\u3057\u3066\u7523\u307f\u51fa\u3055\u308c\u305f\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u306f\u306a\u304f\u3001\u30de\u30a4\u30af\u30ed\u30bd\u30d5\u30c8\u306e.NET\u306e\u958b\u767a\u306b\u95a2\u308f\u3063\u3066\u3044\u305fTaylor Otwell\u6c0f\u306b\u3088\u3063\u3066<br \/>\u958b\u767a\u3055\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\nLaravel\u306f\u3001\u6700\u65b0\u306e\u30d0\u30fc\u30b8\u30e7\u30f34\u304b\u3089composer\u306b\u3088\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u7ba1\u7406\u3068Symfony\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u63a1\u7528\u3057\u305f\u3053\u3068\u3067\u3001\u6d77\u5916\u30e6\u30fc\u30b6\u30fc\u306e\u9593\u3067\u975e\u5e38\u306b\u8a71\u984c\u306b\u306a\u308a\u307e\u3057\u305f\u3002<br \/>\n\u307e\u305f\u3001\u3053\u306e\u6642\u671f\u306bcodeigniter\u304c\u30e9\u30a4\u30bb\u30f3\u30b9\u3092\u5909\u66f4\u3057\u305f\u3053\u3068\u306b\u3088\u308a\u3001\u6d77\u5916\u30e6\u30fc\u30b6\u30fc\u306e\u591a\u304f\u304c<br \/>\nLaravel\u3084Phalcon\u3068\u3044\u3063\u305f\u65b0\u3057\u3044\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u4f7f\u3046\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<br \/>\n\u3055\u3089\u306b\u3001\u73fe\u5728GitHub\u3067\u306e\u8a55\u4fa1\u3082Star9880\u4ee5\u4e0a\u3068\u306a\u308a\u3001<br \/>\n\u305d\u308c\u307e\u3067\u30c8\u30c3\u30d7\u3060\u3063\u305fSymfony\u3092\u5f15\u304d\u96e2\u3057\u3001\u3042\u3063\u3068\u3044\u3046\u9593\u306b\u9996\u4f4d\u306b\u7acb\u3061\u307e\u3057\u305f\u3002<br \/>\n\u3053\u306e\u3053\u3068\u304b\u3089\u3082\u591a\u304f\u306ePHP\u30e6\u30fc\u30b6\u30fc\u304b\u3089\u6ce8\u76ee\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u3046\u304b\u304c\u3048\u307e\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<p>\u73fe\u5728\u3067\u306f\u65e5\u672c\u8a9e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306a\u3069\u3082\u591a\u6570\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u4e0a\u3067\u516c\u958b\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u3001<br \/>\n\u6d77\u5916\u3067\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u3066\u3044\u308bLaravel\u95a2\u9023\u306e\u96fb\u5b50\u66f8\u7c4d\u306e\u591a\u304f\u304c\u65e5\u672c\u8a9e\u8a33\u3067\u30ea\u30ea\u30fc\u30b9\u3055\u308c<br \/>\u3066\u3044\u307e\u3059\u3002<br \/>\n\u305d\u306e\u4ed6\u3001\u56fd\u5185\u5916\u554f\u308f\u305a\u591a\u304f\u306e\u30e6\u30fc\u30b6\u30fc\u306b\u3088\u308bLaravel\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u516c\u958b\u30fb\u63d0\u4f9b\u3055\u308c\u3001<br \/>\n\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306e\u30b3\u30df\u30e5\u30cb\u30c6\u30a3\u3068\u3057\u3066\u3082\u304b\u306a\u308a\u5927\u304d\u306a\u898f\u6a21\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n(\u4e3b\u306b\u82f1\u8a9e\u304c\u591a\u3044\u3067\u3059\u304c\u3001\u65e5\u672c\u30e6\u30fc\u30b6\u30fc\u306b\u3088\u308b\u30d5\u30a9\u30fc\u30e9\u30e0\u3082\u958b\u8a2d\u3055\u308c\u3066\u3044\u307e\u3059\u3002)<br \/>\n\u60c5\u5831\u91cf\u3082\u8c4a\u5bcc\u3067\u3059\u306e\u3067\u3001\u3053\u306e\u6a5f\u4f1a\u306b\u305c\u3072\u30c1\u30e3\u30ec\u30f3\u30b8\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<hr \/>\n<p><a href=\"https:\/\/leanpub.com\/laravel4plus\" target=\"_blank\">Laravel 4 \u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\uff0b<\/a><br \/>\n<a href=\"https:\/\/leanpub.com\/codebright-jp\" target=\"_blank\">Laravel: Code Bright (JP)<\/a><br \/>\n<a href=\"https:\/\/leanpub.com\/laravel4cookbook-jp\" target=\"_blank\">Laravel 4 Cookbook \u65e5\u672c\u8a9e\u7248<\/a><br \/>\n<a href=\"https:\/\/leanpub.com\/laravel-jp\" target=\"_blank\">Laravel: From Apprentice To Artisan \u65e5\u672c\u8a9e\u7248<\/a><br \/>\n<a href=\"https:\/\/leanpub.com\/laravel-testing-decoded-japanese\" target=\"_blank\">Laravel Testing Decoded \u65e5\u672c\u8a9e\u7248<\/a><br \/>\n<a href=\"https:\/\/leanpub.com\/implementinglaravel-jpn\" target=\"_blank\">Implementing Laravel \u65e5\u672c\u8a9e\u7248<\/a><br \/>\n<a href=\"https:\/\/leanpub.com\/gsd-laravel-jp\" target=\"_blank\">Laravel4\u3067\u3053\u306a\u3059\u30d7\u30ed\u30b0\u30e9\u30e0\u8853\u3000Getting Stuff Done<\/a><\/p>\n<hr \/>\n<p>\n\u52d5\u4f5c\u306b\u5fc5\u8981\u306a\u74b0\u5883\u306f\u3001<br \/>\nphp 5.4\u4ee5\u4e0a(laravel4.2 \u4ee5\u524d\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306f5.3.7\u4ee5\u4e0a)<br \/>\nmcrypt\u304c\u5fc5\u9808\u3068\u306a\u308a\u307e\u3059\u3002<br \/>\n\u307e\u305f\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u306e\u306b\u5fc5\u8981\u306agit\u30b3\u30de\u30f3\u30c9\u3092<br \/>\n\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h2 id=\"setup\">2.\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7<\/h2>\n<p>\u305d\u308c\u3067\u306f\u65e9\u901f\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n\u524d\u8ff0\u306e\u901a\u308acomposer\u304c\u5fc5\u9808\u3068\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u307e\u305a\u306fcomposer\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<br \/>\n<a href=\"https:\/\/getcomposer.org\/\" target=\"_blank\">composer<\/a><br \/>\n\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30b3\u30de\u30f3\u30c9\u306f\u4e0b\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3059\u3002<\/p>\n<p><code>$ php -r \"readfile('https:\/\/getcomposer.org\/installer');\" | php<\/code><\/p>\n<p>*php\u3078\u30d1\u30b9\u3092\u901a\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u306fphp\u306e\u30d1\u30b9\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\n<a href=\"http:\/\/www.ospn.jp\/press\/20140605no40-useit-oss.html\/composer\" rel=\"attachment wp-att-25380\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.ospn.jp\/press\/wp-content\/uploads\/2014\/05\/composer.png\" alt=\"composer\" width=\"527\" height=\"86\" class=\"alignnone size-full wp-image-25380\" \/><\/a><br \/>\nwindows\u30e6\u30fc\u30b6\u30fc\u306e\u65b9\u306f\u30a4\u30f3\u30b9\u30c8\u30fc\u30e9\u30fc\u3082\u914d\u5e03\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001<br \/>\n\u305d\u3061\u3089\u3092\u5229\u7528\u3057\u3066\u3044\u305f\u3060\u3044\u3066\u3082\u304b\u307e\u3044\u307e\u305b\u3093\u3002<br \/>\ncomposer.phar\u304c\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u4f5c\u6210\u3055\u308c\u307e\u3059\u306e\u3067\u3001<\/p>\n<p><code>$ php composer.phar<\/code><\/p>\n<p>\u3067composer\u306e\u52d5\u4f5c\u78ba\u8a8d\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n<a href=\"http:\/\/www.ospn.jp\/press\/20140605no40-useit-oss.html\/composer_confirm\" rel=\"attachment wp-att-25381\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.ospn.jp\/press\/wp-content\/uploads\/2014\/05\/composer_confirm.png\" alt=\"composer_confirm\" width=\"500\" height=\"396\" class=\"alignnone size-full wp-image-25381\" \/><\/a><br \/>\n*php composer.phar\u3092composer\u3067\u5b9f\u884c\u3067\u304d\u308b\u3088\u3046\u306b\u3001\u30d1\u30b9\u3092\u901a\u3057\u3066\u304a\u304f\u306e\u3092<br \/>\n \u304a\u52e7\u3081\u3057\u307e\u3059\u3002<br \/>\ncomposer\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u305f\u306e\u3092\u78ba\u8a8d\u3057\u305f\u3089\u3001<br \/>\n\u6b21\u306fLaravel\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002<br \/>\n\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u306e\u30b3\u30de\u30f3\u30c9\u306f\u4e0b\u8a18\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><code>$ composer create-project laravel\/laravel \u4f5c\u6210\u3057\u305f\u3044\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u540d --prefer-dist<\/code><\/pre>\n<p>\u3053\u3053\u3067\u306f\u4f8b\u3068\u3057\u3066test.project\u3068\u3057\u3066\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p><code>$ composer create-project laravel\/laravel test.project --prefer-dist<br \/><\/code><\/p>\n<p>\u30e9\u30a4\u30d6\u30e9\u30ea\u3084Laravel\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u7d42\u308f\u308a\u307e\u3057\u305f\u3089\u3001<br \/>\ncache\u7b49\u306b\u4f7f\u7528\u3055\u308c\u308b app\/storage\/ \u30d5\u30a9\u30eb\u30c0\u306e\u6a29\u9650\u3092\u5909\u66f4\u3057\u307e\u3059\u3002<br \/>\n\u4f5c\u6210\u3057\u305f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3067\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<p><code>$ chmod -R 777 app\/storage\/<\/code> <\/p>\n<p>\u6b21\u306bapache\u3084Nginx\u7b49\u3092\u5229\u7528\u305b\u305a\u306b\u3001php5.4\u4ee5\u964d\u3067\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f<br \/>\nphp\u306e\u30d3\u30eb\u30c8\u30a4\u30f3\u30a6\u30a7\u30d6\u30b5\u30fc\u30d0\u30fc\u3067\u52d5\u304b\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n\u540c\u69d8\u306b\u4f5c\u6210\u3057\u305f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3067\u4e0b\u8a18\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<br \/>\n$ php artisan serve<br \/>\n<a href=\"http:\/\/www.ospn.jp\/press\/20140605no40-useit-oss.html\/artisan_serve\" rel=\"attachment wp-att-25378\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.ospn.jp\/press\/wp-content\/uploads\/2014\/05\/artisan_serve.png\" alt=\"artisan_serve\" width=\"691\" height=\"28\" class=\"alignnone size-full wp-image-25378\" \/><\/a><br \/>\n\u30c7\u30d5\u30a9\u30eb\u30c8\u3067http:\/\/localhost:8000\u3067\u8d77\u52d5\u3057\u307e\u3059\u304c\u3001<br \/>\n\u4efb\u610f\u306e\u30dd\u30fc\u30c8\u3067\u8d77\u52d5\u3055\u305b\u305f\u3044\u5834\u5408\u306f<\/p>\n<p><code>$ php artisan serve --port=8888 <\/code><\/p>\n<p>\u3068\u6307\u5b9a\u3057\u307e\u3059\u3002<br \/>\n\u8d77\u52d5\u3057\u305furl\u306b\u65e9\u901f\u30a2\u30af\u30bb\u30b9\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/www.ospn.jp\/press\/20140605no40-useit-oss.html\/laravel_confirm\" rel=\"attachment wp-att-25387\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.ospn.jp\/press\/wp-content\/uploads\/2014\/05\/laravel_confirm.png\" alt=\"laravel_confirm\" width=\"400\" height=\"310\" class=\"alignnone size-full wp-image-25387\" \/><\/a><\/p>\n<p>\u3053\u306e\u69d8\u306a\u753b\u9762\u304c\u8868\u793a\u3055\u308c\u308c\u3070\u5b8c\u4e86\u3067\u3059\u3002<br \/>\n\u3053\u306e\u4ed6\u73fe\u5728\u3067\u306f\u3001Vagrant\u3067box add laravel\/homestead\u3059\u308b\u3053\u3068\u3067<br \/>\n\u3088\u308a\u7c21\u5358\u306b\u74b0\u5883\u69cb\u7bc9\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<br \/>\n\u8a73\u3057\u304f\u306f\u516c\u5f0f\u30b5\u30a4\u30c8\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<br \/>\n<a href=\"http:\/\/laravel.com\/docs\/homestead\" target=\"_blank\">homestead<\/a><\/p>\n<h2 id=\"configure\">3.\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306b\u3064\u3044\u3066<\/h2>\n<p>\u8a2d\u5b9a\u95a2\u9023\u306e\u30d5\u30a1\u30a4\u30eb\u306fapp\/config\u914d\u4e0b\u3067\u3059\u3002<br \/>\napp.php\u306f\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u81ea\u4f53\u306e\u8a2d\u5b9a\u95a2\u9023\u3001<br \/>\ncache.php\u306f\u30ad\u30e3\u30c3\u30b7\u30e5\u95a2\u9023\u3001<br \/>\ndatabase.php\u306f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u95a2\u9023\u7b49\u3001<br \/>\n\u305d\u308c\u305e\u308c\u306e\u6a5f\u80fd\u306b\u3088\u3063\u3066\u5206\u5272\u3055\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\u307e\u305f\u672c\u756a\u74b0\u5883\u3068\u30c6\u30b9\u30c8\u74b0\u5883\u3001\u958b\u767a\u74b0\u5883\u7b49\u305d\u308c\u305e\u308c\u306e\u74b0\u5883\u3067\u8a2d\u5b9a\u3092\u5909\u66f4\u3057\u305f\u3044\u5834\u5408\u306f\u3001<br \/>\nbootstrap\/start.php\u306edetectEnvironment\u5185\u3067\u6307\u5b9a\u3057\u307e\u3059\u3002<br \/>\n\u63a8\u5968\u306e\u5909\u66f4\u65b9\u6cd5\u306f\u3001\u305d\u308c\u305e\u308c\u306e\u74b0\u5883\u306ehostname\u3092\u914d\u5217\u306e\u30ad\u30fc\u3068\u5bfe\u5fdc\u3055\u305b\u3066\u6307\u5b9a\u3057\u3001<br \/>\n\u305d\u308c\u305e\u308c\u306e\u914d\u5217\u30ad\u30fc\u540d\u3092app\/config\u306e\u4e2d\u306b\u4f5c\u6210\u3001<br \/>\n\u5909\u66f4\u3057\u305f\u3044\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb(\u307e\u305f\u306f\u305d\u306e\u5185\u5bb9\u306e\u4e00\u90e8)\u3092\u305d\u306e\u4e2d\u306b\u8a2d\u7f6e\u3059\u308b\u3060\u3051\u3067<br \/>\n\u305d\u308c\u305e\u308c\u306e\u74b0\u5883\u306e\u8a2d\u5b9a\u5185\u5bb9\u3067\u4e0a\u66f8\u304d\u3057\u3066\u304f\u308c\u307e\u3059\u3002<br \/>\n\u6307\u5b9a\u3057\u3066\u3044\u306a\u3044\u74b0\u5883\u306e\u5834\u5408\u306fapp\/config\u914d\u4e0b\u3067\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<br \/>\n\u4e0b\u56f3\u306e\u69d8\u306b\u6307\u5b9a\u3057\u305f\u5834\u5408\u306f\u3001<\/p>\n<p><a href=\"http:\/\/www.ospn.jp\/press\/20140605no40-useit-oss.html\/bootstrap_start\" rel=\"attachment wp-att-25379\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.ospn.jp\/press\/wp-content\/uploads\/2014\/05\/bootstrap_start.png\" alt=\"bootstrap_start\" width=\"500\" height=\"271\" class=\"alignnone size-full wp-image-25379\" \/><\/a><\/p>\n<p>*.local\u74b0\u5883\u306e\u5834\u5408\u306fapp\/config\/local\u914d\u4e0b\u306b\u8a2d\u7f6e\u3057\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u304c\u3042\u308c\u3070\u305d\u308c\u3089\u3067<br \/>\n\u4e0a\u66f8\u304d\u3001staging01\u3001staging02\u306e\u5834\u5408\u306f\u540c\u69d8\u306bapp\/config\/staging\u914d\u4e0b\u306e\u30d5\u30a1\u30a4\u30eb\u3067<br \/>\n\u4e0a\u66f8\u304d\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/www.ospn.jp\/press\/20140605no40-useit-oss.html\/config_env\" rel=\"attachment wp-att-25382\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.ospn.jp\/press\/wp-content\/uploads\/2014\/05\/config_env.png\" alt=\"config_env\" width=\"255\" height=\"311\" class=\"alignnone size-full wp-image-25382\" \/><\/a><\/p>\n<p>\u65e9\u901f\u73fe\u5728\u306ehostname\u3092local\u306b\u8a18\u8ff0\u3057\u3066\u3001<br \/>\n\u3053\u3053\u3067\u306fapp\/config\/local\/app.php\u3092\u4e0b\u56f3\u306e\u3088\u3046\u306b\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><a href=\"http:\/\/www.ospn.jp\/press\/20140605no40-useit-oss.html\/env_app\" rel=\"attachment wp-att-25386\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.ospn.jp\/press\/wp-content\/uploads\/2014\/05\/env_app.png\" alt=\"env_app\" width=\"269\" height=\"93\" class=\"alignnone size-full wp-image-25386\" \/><\/a><\/p>\n<p>\u30a8\u30e9\u30fc\u8868\u793a\u3084\u3001\u6642\u523b\u8a2d\u5b9a\u3092\u4e0a\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\u540c\u69d8\u306b\u74b0\u5883\u306b\u3088\u3063\u3066\u63a5\u7d9a\u3059\u308b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3084\u30ad\u30e3\u30c3\u30b7\u30e5\u7b49\u3082\u5909\u66f4\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<h2 id=\"router\">4.\u30eb\u30fc\u30bf\u30fc\u306b\u3064\u3044\u3066<\/h2>\n<p>\u591a\u304f\u306ePHP\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u304c\u3001<br \/>\n\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30d1\u30b9\u3084\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3068\u30e1\u30bd\u30c3\u30c9\u3067\u30d1\u30b9\u3092\u6c7a\u5b9a\u3057\u307e\u3059\u304c\u3001<br \/>\nLaravel\u3067\u306fruby\u306eSinatra\u30e9\u30a4\u30af\u306b\u30eb\u30fc\u30bf\u30fc\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\u307e\u305f\u30eb\u30fc\u30bf\u30fc\u3068\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306b\u5236\u7d04\u304c\u7121\u3044\u305f\u3081\u3001\u30eb\u30fc\u30bf\u30fc\u3060\u3051\u3067\u51e6\u7406\u3092<br \/>\n\u5b9f\u88c5\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002<br \/>\n\u30eb\u30fc\u30bf\u30fc\u306fapp\/routes.php \u306b\u3042\u308a\u3001\u4e0b\u56f3\u306e\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/www.ospn.jp\/press\/20140605no40-useit-oss.html\/default_router\" rel=\"attachment wp-att-25385\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.ospn.jp\/press\/wp-content\/uploads\/2014\/05\/default_router.png\" alt=\"default_router\" width=\"587\" height=\"291\" class=\"alignnone size-full wp-image-25385\" \/><\/a><\/p>\n<p>\u3053\u3053\u3067\u306f\u3001\/ \u306bGET\u3067\u30a2\u30af\u30bb\u30b9\u3057\u305f\u5834\u5408\u306b\u3001<br \/>\napp\/views\/hello.php\u3092\u51fa\u529b\u3059\u308b\u3001\u3068\u3044\u3046\u69d8\u306b\u8a18\u8ff0\u3055\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n(\u30c7\u30d5\u30a9\u30eb\u30c8\u306eview\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306fapp\/views\u3067\u3059)<br \/>\n\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u4ecb\u3055\u305a\u306b\u51fa\u529b\u3055\u308c\u3066\u304a\u308a\u3001view\u3092\u4ecb\u3055\u305a\u306b\u51fa\u529b\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/www.ospn.jp\/press\/20140605no40-useit-oss.html\/not_view\" rel=\"attachment wp-att-25389\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.ospn.jp\/press\/wp-content\/uploads\/2014\/05\/not_view.png\" alt=\"not_view\" width=\"274\" height=\"219\" class=\"alignnone size-full wp-image-25389\" \/><\/a><\/p>\n<p>GET\u4ee5\u5916\u306b\u3082POST\u3084\u3001PUT\u3001PATCH\u3001DELETE\u306a\u3069\u306b\u3082\u5bfe\u5fdc\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u3053\u306e\u4ed6\u306b\u591a\u304f\u306e\u30eb\u30fc\u30bf\u30fc\u8a18\u8ff0\u65b9\u6cd5\u304c\u3042\u308a\u3001<br \/>\nRESTful\u306aAPI\u8a2d\u8a08\u3084\u3001\u8907\u6570\u30c9\u30e1\u30a4\u30f3\u3092\u7ba1\u7406\u3059\u308b\u69d8\u306a\u30eb\u30fc\u30bf\u30fc\u8a2d\u5b9a\u7b49\u3001<br \/>\n\u30b7\u30f3\u30d7\u30eb\u306a\u3082\u306e\u304b\u3089\u8907\u96d1\u306a\u3082\u306e\u307e\u3067\u5e45\u5e83\u304f\u5bfe\u5fdc\u3067\u304d\u308b\u69d8\u306a\u4ed5\u7d44\u307f\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n<a href=\"http:\/\/laravel.com\/docs\/routing\" target=\"_blank\">\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0<\/a><br \/>\n\u30eb\u30fc\u30bf\u30fc\u3068\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306e\u95a2\u9023\u4ed8\u3051\u306f\u5f8c\u8ff0\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306b\u3064\u3044\u3066\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2 id=\"controller\">5.\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306b\u3064\u3044\u3066<\/h2>\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306fapp\/controllers\u914d\u4e0b\u3068\u306a\u308a\u307e\u3059\u3002<br \/>\nBaseController\u3092\u7d99\u627f\u3057\u3066\u5b9f\u88c5\u3057\u3066\u3044\u304f\u69d8\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\nHomeController\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3063\u3066\u5148\u307b\u3069\u306e\u30eb\u30fc\u30bf\u30fc\u3068\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092<br \/>\n\u95a2\u9023\u4ed8\u3051\u3066\u307f\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/www.ospn.jp\/press\/20140605no40-useit-oss.html\/default_controller\" rel=\"attachment wp-att-25384\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.ospn.jp\/press\/wp-content\/uploads\/2014\/05\/default_controller.png\" alt=\"default_controller\" width=\"372\" height=\"180\" class=\"alignnone size-full wp-image-25384\" \/><\/a><\/p>\n<p>\u3053\u308c\u306f\/ \u306bGET\u3067\u30a2\u30af\u30bb\u30b9\u3057\u305f\u5834\u5408\u306bHomeController\u306eshowWelcome\u3092\u5b9f\u884c\u3059\u308b\u3001<br \/>\n\u3068\u3044\u3046\u6307\u5b9a\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u540c\u69d8\u306b\u30e1\u30bd\u30c3\u30c9\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u3067\u69d8\u3005\u306aURI\u3092\u5b9f\u88c5\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/www.ospn.jp\/press\/20140605no40-useit-oss.html\/add_methods\" rel=\"attachment wp-att-25375\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.ospn.jp\/press\/wp-content\/uploads\/2014\/05\/add_methods.png\" alt=\"add_methods\" width=\"309\" height=\"192\" class=\"alignnone size-full wp-image-25375\" \/><\/a><br \/>\n<a href=\"http:\/\/www.ospn.jp\/press\/20140605no40-useit-oss.html\/add_router\" rel=\"attachment wp-att-25376\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.ospn.jp\/press\/wp-content\/uploads\/2014\/05\/add_router.png\" alt=\"add_router\" width=\"396\" height=\"59\" class=\"alignnone size-full wp-image-25376\" \/><\/a><\/p>\n<p>\u66f4\u306bfunction\u540d\u3092getXXX, postXXX\u7b49\u3068\u3057\u3001<br \/>\n\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3068\u30eb\u30fc\u30bf\u30fc\u306b\u4e0b\u56f3\u306e\u3088\u3046\u306b\u6307\u5b9a\u3059\u308b\u3068\u3001<br \/>\nURI\u3068HTTP\u30e1\u30bd\u30c3\u30c9\u3092\u7d50\u3073\u3064\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/www.ospn.jp\/press\/20140605no40-useit-oss.html\/prefix_methods\" rel=\"attachment wp-att-25390\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.ospn.jp\/press\/wp-content\/uploads\/2014\/05\/prefix_methods.png\" alt=\"prefix_methods\" width=\"339\" height=\"454\" class=\"alignnone size-full wp-image-25390\" \/><\/a><br \/>\n<a href=\"http:\/\/www.ospn.jp\/press\/20140605no40-useit-oss.html\/controller_router\" rel=\"attachment wp-att-25383\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.ospn.jp\/press\/wp-content\/uploads\/2014\/05\/controller_router.png\" alt=\"controller_router\" width=\"336\" height=\"93\" class=\"alignnone size-full wp-image-25383\" \/><\/a><\/p>\n<p>\u4f5c\u6210\u3057\u305f\u30eb\u30fc\u30bf\u30fc\u3092\u4e0b\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u3067\u4e00\u89a7\u8868\u793a\u3057\u3066\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><code>$ php artisan routes<\/code><\/p>\n<p><a href=\"http:\/\/www.ospn.jp\/press\/20140605no40-useit-oss.html\/artisan_routes\" rel=\"attachment wp-att-25377\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.ospn.jp\/press\/wp-content\/uploads\/2014\/05\/artisan_routes.png\" alt=\"artisan_routes\" width=\"843\" height=\"150\" class=\"alignnone size-full wp-image-25377\" \/><\/a><\/p>\n<p>{one?}\/{two?}\/{three?}\u306a\u3069\u306f\u305d\u306e\u307e\u307e\u30d1\u30b9\u306b\u542b\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u3001<br \/>\n\u5bfe\u5fdc\u306e\u30e1\u30bd\u30c3\u30c9\u306e\u5f15\u6570\u3067\u6307\u5b9a\u3057\u3001\u5024\u3092\u53d7\u3051\u53d6\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/www.ospn.jp\/press\/20140605no40-useit-oss.html\/method_args\" rel=\"attachment wp-att-25388\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.ospn.jp\/press\/wp-content\/uploads\/2014\/05\/method_args.png\" alt=\"method_args\" width=\"326\" height=\"134\" class=\"alignnone size-full wp-image-25388\" \/><\/a><\/p>\n<p>\u7279\u306b\u5fc5\u8981\u304c\u306a\u3044\u5834\u5408\u306f\u30e1\u30bd\u30c3\u30c9\u306b\u6307\u5b9a\u3057\u306a\u304f\u3066\u69cb\u3044\u307e\u305b\u3093\u3002<\/p>\n<p>\u4ed6\u306bartisan \u30b3\u30de\u30f3\u30c9\u3067\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<br \/>\n<a href=\"http:\/\/laravel.com\/docs\/controllers#resource-controllers\" target=\"_blank\">controller:make<\/a><\/p>\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u304b\u3089view\u3078\u5024\u3092\u6e21\u3059\u5834\u5408\u306f\u3001<\/p>\n<p><code>View::make('template_name')->with('data', $params);<\/code><\/p>\n<p>\u307e\u305f\u306f\u3001<\/p>\n<p><code>$array = ['data' => $params];<br \/>\nView::make('template_name', $array);<\/code><\/p>\n<p>\u3068\u306a\u308a\u307e\u3059\u304c\u3001\u3053\u306e\u4ed6\u306b\u3082session\u306b\u542b\u307e\u305b\u308b\u65b9\u6cd5\u3084\u3001<br \/>\n\u4e00\u5ea6\u3060\u3051\u8868\u793a\u3055\u305b\u308b\u69d8\u306a\u6e21\u3057\u65b9(\u30a8\u30e9\u30fc\u8868\u793a\u7b49)\u306a\u3069\u4fbf\u5229\u306a\u30e1\u30bd\u30c3\u30c9\u304c<br \/>\n\u591a\u6570\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2 id=\"model\">6.\u30e2\u30c7\u30eb\u306b\u3064\u3044\u3066<\/h2>\n<p>\u30e2\u30c7\u30eb\u306b\u306f\u30a8\u30ed\u30af\u30a2\u30f3\u30c8(Eloquent)\u3001\u30af\u30a8\u30ea\u30fc\u30d3\u30eb\u30c0\u30fc\u3068\u30d9\u30fc\u30b7\u30c3\u30af\u306a\u30af\u30a8\u30ea\u30fc\u306e<br \/>\n3\u7a2e\u985e\u304c\u7528\u610f\u3055\u308c\u3066\u304a\u308a\u3001\u3053\u308c\u3089\u306f\u72ec\u7acb\u3057\u305f\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u306e\u3067\u3001<br \/>\nLaravel\u4ee5\u5916\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3082\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<br \/>\n\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u63a5\u7d9a\u3059\u308b\u306b\u306fdatabase.php\u3067\u63a5\u7d9a\u5148\u306e\u6307\u5b9a\u3092\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\nLaravel\u3067\u306f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u95a2\u9023\u3067\u306fMySQL, PostgreSQL, SQLite, and SQL Server\u304c<br \/>\n\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u304a\u4f7f\u3044\u306e\u74b0\u5883\u306b\u5408\u308f\u305b\u3066\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\n\u30d1\u30c3\u30b1\u30fc\u30b8\u3067\u306fMongoDB\u3001Oracle\u7b49\u306b\u5bfe\u5fdc\u3057\u305f\u3082\u306e\u304c\u516c\u958b\u3055\u308c\u3066\u3044\u307e\u3059\u306e\u3067\u3001<br \/>\n\u4e00\u822c\u7684\u306a\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u304a\u4f7f\u3044\u306e\u5834\u5408\u306f\u63a5\u7d9a\u5148\u304c\u4f55\u3067\u3042\u3063\u3066\u3082\u7279\u306b\u6c17\u306b\u3059\u308b<br \/>\n\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u30d9\u30fc\u30b7\u30c3\u30af\u306a\u30af\u30a8\u30ea\u30fc\u306f\u4e0b\u8a18\u306e\u69d8\u306a\u767a\u884c\u65b9\u6cd5\u3067\u3059\u3002<\/p>\n<p>\u25a0SELECT<br \/>\n<code>DB::select('select * from users where id = ?', array(1));<\/code><\/p>\n<p>\u25a0INSERT<br \/>\n<code>DB::insert('insert into users (id, name) values (?, ?)', array(1, 'Dayle'));<\/code><\/p>\n<p>\u25a0UPDATE<br \/>\n<code>DB::update('update users set votes = 100 where name = ?', array('John'));<\/code><\/p>\n<p>\u25a0DELETE<br \/>\n<code>DB::delete('delete from users');<\/code><\/p>\n<p>\u3044\u305a\u308c\u3082\u30d7\u30ea\u30da\u30a2\u30c9\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3092\u4f7f\u7528\u3057\u3066<br \/>\n\u5404\u30af\u30a8\u30ea\u30fc\u3092\u767a\u884c\u3059\u308b\u5f62\u5f0f\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u30af\u30a8\u30ea\u30fc\u30d3\u30eb\u30c0\u30fc\u3067\u306f\u4ee5\u4e0b\u306e\u69d8\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u25a0SELECT<br \/>\n<code>DB::table('users')->where('id', 1)->first();<\/code><\/p>\n<p>\u25a0INSERT<br \/>\n<code>DB::table('users')->insertGetId(['id' => 1, 'name' => 'Dayle']);<br \/>\n<\/code><\/p>\n<p>\u25a0UPDATE<br \/>\n<code>DB::table('users')->where('name' => 'John')->update(['votes' => 100]);<\/code><\/p>\n<p>\u25a0DELETE<br \/>\n<code>DB::table('users')->where('name' => 'John')->delete();<\/code><\/p>\n<p>\u8907\u6570\u306e\u691c\u7d22\u6761\u4ef6\u304c\u5fc5\u8981\u306a\u5834\u5408\u306fwhere\u3092\u8907\u6570\u8a18\u8ff0\u3059\u308b\u3053\u3068\u3067\u3001<br \/>\n\u5185\u90e8\u3067AND\u3078\u3068\u5909\u63db\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u30a8\u30ed\u30af\u30a2\u30f3\u30c8\u306f\u3001\u3088\u308a\u6d17\u7df4\u3055\u308c\u305fORM\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002<\/p>\n<p>\u00a0\u25a0SELECT<br \/>\n<code>User::all();<br \/>\nUser::find(1);<\/code><\/p>\n<p>\u00a0\u25a0INSERT<br \/>\n<code>$user = User::create(array('name' => 'John'));<\/code><\/p>\n<p>\u00a0\u25a0UPDATE<br \/>\n<code>$user = User::find(1);<br \/>\n$user->email = 'john@foo.com';<br \/>\n$user->save();<\/code><\/p>\n<p>\u25a0DELETE<br \/>\n<code>$user = User::find(1);<br \/>\n$user->delete();<\/code><\/p>\n<p>\u30a8\u30ed\u30af\u30a2\u30f3\u30c8\u306e\u5834\u5408\u306f\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f<br \/>\n\u30af\u30e9\u30b9\u540d\u3092\u5c0f\u6587\u5b57\u306e\u8907\u6570\u5f62\u306b\u3057\u305f\u3082\u306e\u304c\u3001\u30c6\u30fc\u30d6\u30eb\u540d\u3068\u3057\u3066\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002<br \/>\n\u521d\u671f\u72b6\u614b\u306e\u5834\u5408\u306fapp\/models\u306bUser\u30af\u30e9\u30b9\u304c\u8a2d\u7f6e\u3055\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\u8907\u6570\u5f62\u3067\u306f\u306a\u3044\u5225\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u4f7f\u7528\u3059\u308b\u5834\u5408\u306f\u3001<\/p>\n<p><code>protected $table = 'table_name';<\/code><\/p>\n<p>\u3068\u5b9a\u7fa9\u3057<br \/>\n\u540c\u69d8\u306bfind\u3067\u4f7f\u308f\u308c\u308b\u3082\u306e\u306fprimaryKey\u3068\u306a\u308a\u307e\u3059\u306e\u3067\u3001<\/p>\n<p><code>protected $primaryKey = \"table_id\";<\/code><\/p>\n<p>\u3068\u5b9a\u7fa9\u3057\u307e\u3059\u3002<br \/>\n\u691c\u7d22\u6761\u4ef6\u306e\u8ffd\u52a0\u7b49\u306f\u30af\u30a8\u30ea\u30fc\u30d3\u30eb\u30c0\u30fc\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u5b9f\u88c5\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u30a8\u30ed\u30af\u30a2\u30f3\u30c8\u3001\u30af\u30a8\u30ea\u30fc\u30d3\u30eb\u30c0\u30fc\u3001\u30d9\u30fc\u30b7\u30c3\u30af\u306e3\u7a2e\u3068\u3082\u3001<br \/>\n\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30de\u30b9\u30bf\u30fc\u3001\u30b9\u30ec\u30fc\u30d6\u3001\u8907\u6570\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f7f\u7528\u3059\u308b\u5834\u5408\u7b49\u306f\u3001<\/p>\n<p><code>\/\/ \u30d9\u30fc\u30b7\u30c3\u30af<br \/>\nDB::connection('master')->select($sql, $params);<\/p>\n<p>\/\/ \u30af\u30a8\u30ea\u30fc\u30d3\u30eb\u30c0\u30fc<br \/>\nDB::connection('master')->table('table')->get();<\/p>\n<p>\/\/ \u30a8\u30ed\u30af\u30a2\u30f3\u30c8<br \/>\nUser::on('slave)->find(1);<br \/>\n<\/code><\/p>\n<p>\u7b49\u306e\u69d8\u306b\u63a5\u7d9a\u5148\u3092\u5909\u66f4\u3057\u307e\u3059\u3002<br \/>\n\u3053\u308c\u3089\u306e\u63a5\u7d9a\u5148\u306f\u3001app\/config\/database.php\u5185\u306econnections\u914d\u5217\u306e\u30ad\u30fc\u3092<br \/>\n\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u5909\u66f4\u53ef\u80fd\u3067\u3059\u3002<br \/>\n\u30c7\u30d5\u30a9\u30eb\u30c8\u306fsqlite, mysql, pgsql(PostgreSQL), sqlsrv(SQL Server)\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u306e\u3067\u3001<br \/>\nmaster\u3084slave\u306a\u3069\u3078\u5909\u66f4\u3057\u3066\u3001\u63a5\u7d9a\u5148\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u3053\u306e\u4ed6\u306b\u3001\u30a8\u30ed\u30af\u30a2\u30f3\u30c8\u3068\u30af\u30a8\u30ea\u30fc\u30d3\u30eb\u30c0\u30fc\u306f\u30af\u30a8\u30ea\u30fc\u306e\u7d50\u679c\u3092<br \/>\n\u30ad\u30e3\u30c3\u30b7\u30e5\u3057\u305f\u308a\u3001\u30da\u30fc\u30b8\u30e3\u30fc\u3092\u7c21\u5358\u306b\u5b9f\u88c5\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n<a href=\"http:\/\/laravel.com\/docs\/database\" target=\"_blank\">\u30d9\u30fc\u30b7\u30c3\u30af<\/a><br \/>\n<a href=\"http:\/\/laravel.com\/docs\/queries\" target=\"_blank\">\u30af\u30a8\u30ea\u30fc\u30d3\u30eb\u30c0\u30fc<\/a><br \/>\n<a href=\"http:\/\/laravel.com\/docs\/eloquent\" target=\"_blank\">\u30a8\u30ed\u30af\u30a2\u30f3\u30c8<\/a><\/p>\n<h2 id=\"view\">7.\u30d3\u30e5\u30fc\u306b\u3064\u3044\u3066<\/h2>\n<p>blade\u3068\u3044\u3046\u30b7\u30f3\u30d7\u30eb\u306a\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\nTwig\u3084Smarty\u306a\u3069\u3068\u540c\u69d8\u306b\u30ec\u30a4\u30a2\u30a6\u30c8\u5bfe\u5fdc\u3082\u53ef\u80fd\u3067\u3059\u3002<br \/>\n<a href=\"http:\/\/laravel.com\/docs\/templates\" target=\"_blank\">blade<\/a><br \/>\nblade\u306e\u4ed6\u306b\u3001Twig\u3084Smarty\u306a\u3069\u3082\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u516c\u958b\u3055\u308c\u3066\u3044\u307e\u3059\u306e\u3067\u3001<br \/>\n\u597d\u307f\u306b\u5fdc\u3058\u3066\u4ed6\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2 id=\"container\">8.Ioc\u30b3\u30f3\u30c6\u30ca<\/h2>\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306e\u9006\u8ee2\uff08Inversion of control)\u3068\u3044\u3046\u3001<br \/>\n\u4f9d\u5b58\u3092\u53d6\u308a\u9664\u304f\u5f37\u529b\u306a\u30b3\u30f3\u30c6\u30ca\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9\u306f<br \/>\n<code><br \/>\n\/\/\u6700\u3082\u30b7\u30f3\u30d7\u30eb\u306a\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u751f\u6210<br \/>\n$instance = App::make('Acme\\ClassName');<\/p>\n<p>\/\/\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u3068\u7d50\u3073\u3064\u3051\u308b<br \/>\nApp::bind('Acme\\ClassNameInterface', 'Acme\\ClassName');<\/p>\n<p>\/\/\u30b7\u30f3\u30b0\u30eb\u30c8\u30f3<br \/>\nApp::singleton('Acme\\ClassName', function()<br \/>\n{<br \/>\n    return new ClassName;<br \/>\n});<br \/>\n<\/code><\/p>\n<p>\u306a\u3069\u304c\u3042\u308a\u3001<br \/>\n\u30bf\u30a4\u30d7\u30d2\u30f3\u30c8\u3067\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u30fb\u30a4\u30f3\u30b8\u30a7\u30af\u30b7\u30e7\u30f3\u306a\u3069\u3067\u5229\u7528\u3055\u308c\u307e\u3059\u3002<br \/>\n\u3053\u308c\u306b\u3088\u308a\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306a\u3069\u304c\u5bb9\u6613\u306b\u306a\u308a\u3001<br \/>\n\u30b7\u30b9\u30c6\u30e0\u8a2d\u8a08\u3084\u5b9f\u88c5\u306b\u3088\u308a\u96c6\u4e2d\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u5b9f\u88c5\u3057\u305f\u30e2\u30c7\u30eb\u3092\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3067\u4f7f\u7528\u3059\u308b\u5834\u5408\u3084\u3001<br \/>\n\u72ec\u81ea\u306b\u5b9f\u88c5\u3057\u305f\u30af\u30e9\u30b9\u3092\u5229\u7528\u3059\u308b\u5834\u5408\u306b\u4f7f\u3044\u307e\u3059\u3002<br \/>\n\u3053\u306e\u4ed6\u306b\u3082\u30b3\u30f3\u30c6\u30ca\u306b\u30a4\u30d9\u30f3\u30c8\u3092\u8a2d\u5b9a\u3057\u305f\u308a\u3001\u3088\u308a\u5f37\u56fa\u306a\u5b9f\u88c5\u3092\u884c\u3048\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2 id=\"other\">9.\u305d\u306e\u4ed6<\/h2>\n<p>\u4e0a\u8a18\u306e\u4ed6\u306b\u3082Laravel\u306b\u306f\u3001<br \/>\n\u30ad\u30e5\u30fc\u30b5\u30fc\u30d0\u3092\u5229\u7528\u3057\u305f\u30e1\u30fc\u30eb\u9001\u4fe1\u3084\u3001<br \/>\nSSH\u3092\u5229\u7528\u3057\u305f\u5b9f\u88c5\u3001\u4ed6\u8a00\u8a9e\u5bfe\u5fdc\u3001<br \/>\n\u5927\u898f\u6a21\u306a\u30c8\u30e9\u30d5\u30a3\u30c3\u30af\u3092\u3055\u3070\u304f\u305f\u3081\u306eNoSQL\u5bfe\u5fdc\u306a\u3069<br \/>\n(\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306fRedis\u304c\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3001\u30d1\u30c3\u30b1\u30fc\u30b8\u3067\u306fRiak\u7b49\u304c\u3042\u308a\u307e\u3059)<br \/>\n\u591a\u304f\u306e\u6a5f\u80fd\u304c\u63d0\u4f9b\u3055\u308c\u3066\u304a\u308a\u3001<br \/>\n\u30d1\u30c3\u30b1\u30fc\u30b8\u3067\u306f\u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\u30fc\u306e<a href=\"https:\/\/github.com\/JeffreyWay\/Laravel-4-Generators\" target=\"_blank\">Laravel-4-Generators<\/a>\u3084\u3001<br \/>\n\u9ad8\u6a5f\u80fd\u8a8d\u8a3c\u30d1\u30c3\u30b1\u30fc\u30b8\u306e<a href=\"https:\/\/github.com\/cartalyst\/sentry\" target=\"_blank\">sentry<\/a>\u306a\u3069\u9ad8\u54c1\u8cea\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001Facebook\u793e\u304c\u958b\u767a\u3057\u305fPHP\u30b3\u30f3\u30d1\u30a4\u30e9HHVM\u3067\u3082\u52d5\u4f5c\u3057\u307e\u3059\u306e\u3067\u3001<br \/>\n\u3088\u308a\u9ad8\u901f\u306a\u52d5\u4f5c\u74b0\u5883\u7b49\u3092\u69cb\u7bc9\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u300cLaravel\u300d\u306e\u4e3b\u306a\u6a5f\u80fd\u306b\u3064\u3044\u3066\u3054\u7d39\u4ecb\u3044\u305f\u3057\u307e\u3057\u305f\u3002<br \/>\n\u3054\u4e0d\u660e\u306a\u70b9\u7b49\u304c\u3042\u308a\u307e\u3057\u305f\u3089\u3001<a href=\"http:\/\/io.laravel.jp\/forum\" target=\"_blank\">\u65e5\u672c\u30e6\u30fc\u30b6\u30fc\u30d5\u30a9\u30fc\u30e9\u30e0<\/a>\u3001<br \/>\n\u307e\u305f\u306f<a href=\"https:\/\/www.facebook.com\/groups\/laravel.jp\" target=\"_blank\">\u65e5\u672c\u30e6\u30fc\u30b6\u30fc\u30b0\u30eb\u30fc\u30d7(facebook)<\/a>\u306b\u3066\u304a\u6c17\u8efd\u306b\u3054\u8cea\u554f\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><\/body><br \/>\n<\/html><\/p>\n","protected":false},"excerpt":{"rendered":"<p>php\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af Laravel &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-25370","post","type-post","status-publish","format-standard","hentry","category-use-it-oss"],"_links":{"self":[{"href":"https:\/\/www.ospn.jp\/press\/wp-json\/wp\/v2\/posts\/25370","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ospn.jp\/press\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ospn.jp\/press\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ospn.jp\/press\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ospn.jp\/press\/wp-json\/wp\/v2\/comments?post=25370"}],"version-history":[{"count":74,"href":"https:\/\/www.ospn.jp\/press\/wp-json\/wp\/v2\/posts\/25370\/revisions"}],"predecessor-version":[{"id":27504,"href":"https:\/\/www.ospn.jp\/press\/wp-json\/wp\/v2\/posts\/25370\/revisions\/27504"}],"wp:attachment":[{"href":"https:\/\/www.ospn.jp\/press\/wp-json\/wp\/v2\/media?parent=25370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ospn.jp\/press\/wp-json\/wp\/v2\/categories?post=25370"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ospn.jp\/press\/wp-json\/wp\/v2\/tags?post=25370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}