2018-11-01ãã1ã¶æéã®è¨äºä¸è¦§
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9ä»åã¯ã¢ãã«ã®é çªã®ä¸¦ã³æ¿ãã§ãï¼ ResourceControllerã®indexã¡ã½ããããã¼ã¹ã«ãã¾ãï¼
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9ä»åã¯Laravelã®Validationã«ã¤ãã¦ã§ãï¼Validationã¨ã¯ãæ¤è¨¼ãã¨ããæå³ã§ã ä¾ãã°å ¥åå¿ é ã®é ç®ã空æ¬ã ã¨ã ã¡ã¼ã«ã¢ãã¬ã¹ãæ£ããå ¥åããã¦ããªãã¨ãã ãããã£ãä¸åãæ¤è¨¼ããæ©è½ã§ãï¼ Laraâ¦
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9ååã¯ã°ãã¼ãã«ã¹ã³ã¼ãã«ã¤ãã¦ã§ããï¼ ã°ãã¼ãã«ã¹ã³ã¼ãã¯æ±ç¨çãªå¦çãå¤ãããã ã¢ãã«ããåãé¢ãScopeã¯ã©ã¹ã¨ã㦠ç¬ç«ãããã¨ä¾¿å©ã§ãï¼
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9ååã¯ãã¼ã«ã«ã¹ã³ã¼ãæ¤ç´¢ã«ã¤ãã¦ã§ããï¼ ä»åã¯ããã²ã¨ã¤ã®ã¹ã³ã¼ãã ã°ãã¼ãã«ã¹ã³ã¼ãã«ã¤ãã¦ã§ãï¼ ãã®ã¢ãã«ã使ãéã«å¿ ãé©ç¨ãããã¹ã³ã¼ãã§ãï¼
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9Laravelã®Eloquentã«ã¯ã¹ã³ã¼ãã¨ããæ©è½ãããã¾ãï¼ ã¹ã³ã¼ãã使ãã°ãDBã®ã¬ã³ã¼ãããç¹å®ã®æ¡ä»¶ã§æ¤ç´¢ãããããã¨ãã§ãã¾ãï¼ ã¾ãã¹ã³ã¼ãããã§ã¼ã³ãã¦ãããã¨ã§æ¤ç´¢æ¡ä»¶ãã¹ãããªã¨è¨è¿°ãããâ¦
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9ååã¾ã§ã§ãEloquentã®whereã¡ã½ããã使ã£ã ã¢ãã«ã®æ¤ç´¢ãå®è£ ãã¾ããï¼ ï¼ãã¼ã¹ã«ResourceControllerã使ã£ã¦ãã¾ãï¼ï¼ä»åã¯whereã¡ã½ããã®æ§ã ãªæ¤ç´¢æ¹æ³ãæ¸ãã¦ããã¾ãï¼
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9ä»åã¯Laravelã®Eloquentãwhereæ¤ç´¢ã«ã¤ãã¦ã§ãï¼ ä»¥åä½æããResourceControllerã«è¿½å ãã形㧠å®è£ ãã¦ããã¾ãï¼
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9ä»åã¯ResourceControllerã§ä½¿ç¨ããã¢ã¯ã·ã§ã³ãéå®ãã¾ãï¼ResourceControllerã¯ããã©ã«ã㧠index, create, store, show, edit, update, destroy ã¨7ã¤ã®ã¡ã½ãããå®è£ ãã¾ãï¼ããä¾ãã°DBãæ´æ°ãã â¦
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9ååã¾ã§ã§Laravelã®ResourceControllerã ã¢ãã«ãæå®ãã¦å®è£ ããã¨ããã¾ã§é²ã¿ã¾ããï¼ä»åã¯å®éã«ResourceControllerã§ã²ã¨ã¤ãµã¼ãã¹ãä½ã£ã¦ã¿ããã¨æãã¾ãï¼ CRUDãå®ç¾ãã¾ãï¼
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9ååã®ç¶ãã§ãï¼ ä»åã¯ResourceControllerä½ææã«ã¢ãã«ãæå®ãã¾ãï¼ ä»¥åä½æãããapp>Models>Articleã¢ãã«ã使ç¨ãã¾ãï¼
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9Laravelã«ã¯ResourceControllerã¨ãã便å©æ©è½ãããã ä¸ç¬ã§RESTfulãªAPIéä¿¡ç°å¢ãæ§ç¯ãããã¨ãã§ãã¾ãï¼
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9ä»åã¯Laravelã®Eloquentãªã¬ã¼ã·ã§ã³ã å¤å¯¾å¤ã«ã¤ãã¦ã§ãï¼ belongsToManyã¨ããã¡ã½ããã使ãã¾ãï¼
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9ä»åã¯Laravelã®Controllerã§ã ã¡ã½ããä½æãã²ã¨ã¤ã®ã¿ã®å ´åã®æ¸ãæ¹ã«ã¤ãã¦ã§ãï¼ invokeã¨ããã¡ã½ããã使ãã¾ãï¼
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9Eloquentã®ãªã¬ã¼ã·ã§ã³ãç¶ãã¦ã¯1対ä»ã表ç¾ããhasManyçµåã§ãï¼ Author(èè )ã¨Article(è¨äº)ã®é¢ä¿ã¨ããã°ã èè ãããã¤ãã®è¨äºãä½æãã¦ããã®ãæ®éã§ãããï¼ éã«è¨äºã¯ï¼å ±åä½æãªã©ä¾å¤ãâ¦
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9Eloquentã®ãªã¬ã¼ã·ã§ã³ãç¶ãã¦ã¯belongsToçµåã«ã¤ãã¦ã§ãï¼ hasOneã¯ä¸»ãã¼ãã«ããå¾ãã¼ãã«ãèªã¿è¾¼ãã¡ã½ããã§ãããã belongsToã¯éã«å¾ãã¼ãã«ãã主ãã¼ãã«ãèªã¿è¾¼ã¿ã¾ãï¼
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9ååã¾ã§ã§Laravelã®Eloquentã使ã£ããã¼ã¿ã®ç»é²ã»æ´æ°ã»åé¤ãç´¹ä»ãã¾ããï¼ ä»åããã¯Eloquentã®ãªã¬ã¼ã·ã§ã³ã«ã¤ãã¦ã§ãï¼ãã¼ã¿ãã¼ã¹ã¯ãã¼ãã«å士ãé¢é£ãåããã¨ã§ è¤éãªãã¼ã¿æ§é ãå®ç¾ãã¦â¦
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9ååã¯Laravelã®Eloquentã使ã£ããã¼ã¿ã®è¿½å ãè¡ãã¾ããï¼ ä»åã¯ãã¼ã¿ã®æ´æ°ã»åé¤ãè¡ã£ã¦ããã¾ãï¼
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9ååã¾ã§ã§ã Eloquentã使ããã¼ã¿ãã¼ã¹ãããã¼ã¿ãåãåºã Viewã«è¡¨ç¤ºããã¨ããã¾ã§é²ã¿ã¾ããï¼ä»åã¯ãã¼ã¿ã®è¿½å ãè¡ã£ã¦ããã¾ãï¼
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9ååã¾ã§ã§ModelãViewãController㨠MVCå ¨ã¦ã使ãã¨ããã¾ã§ãã¾ããï¼ä»åã¯Modelã§ä½¿ç¨ããEloquentã«ã¤ãã¦ã§ãï¼
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9ä»åã¯MVCã®ã¢ãã«ã«ã¤ãã¦ã§ãï¼ MVCã®Cã§ããControllerã®è¨äºã¯ãã¡ã MVCã®Vã§ããViewã®è¨äºã¯ãã¡ãååã¾ã§ã§DBã®ãã¼ãã«ä½æï¼Migrationï¼ã¨ãã¼ã¿ç»é²ï¼Seedingï¼ãè¡ãã¾ããï¼ ã¾ãArticleã®Contâ¦
ãLaravelãã·ã¼ãã£ã³ã°(Seeding)æ©è½ã§ãã¼ã¿ãã¼ã¹ã«ãã¼ã¿ãç»é²ãããï¼
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9ãã¼ã¿ãã¼ã¹ã®ãã¼ã¿ãæåããç¨æãç»é²ãã¦ãããã¨ã ã·ã¼ãã£ã³ã°ï¼Seedingï¼ã¨è¨ãã¾ãï¼ï¼æ¥æ¬èªè¨³ã種ã¾ããï¼ Laravelã«ãSeedingã¯ç¨æããã¦ãã¾ãï¼
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9Migrationã§ãã¼ã¿ãã¼ã¹ã«ã©ã ãæ´æ°ãããå ´åã¯ã composerã§å¤é¨ããã±ã¼ã¸ãå°å ¥ãã¦ãããªããã°ãªãã¾ãã
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9ååã®ç¶ãã§ãï¼ Migrationãã¡ã¤ã«ã¯ãä½æããã ãã§ã¯å®è¡ããã¾ããï¼ ä»åã¯Migrationã®å®è¡(migrate)ãè¡ãã å®éã«ãã¼ã¿ãã¼ã¹ã«ãã¼ãã«ã¨ã«ã©ã ãåºæ¥ã¦ããã®ãã確èªãããã¨æãã¾ãï¼
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9æ¬æ¥ã¯Migration(ãã¤ã°ã¬ã¼ã·ã§ã³)ã«ã¤ãã¦ã§ãï¼ migrationèªä½ã®æå³ã¯ã移è¡ããã移転ããªã©ã§ããã Laravelçã«ã¯ãã¼ã¿ãã¼ã¹ã®æ§ç¯ããã¼ã¸ã§ã³ç®¡çãè¡ãæ©è½ã§ãï¼ã³ã³ã½ã¼ã«ããç´æ¥MySQLã«å ¥ãâ¦
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9ä»åã¯Laravelã®ãã¼ã¿ãã¼ã¹è¨å®ãã¡ã¤ã«ã«ã¤ãã¦ã§ãï¼ ãã¼ã¿ãã¼ã¹ã¯MySQLã使ãã¾ãï¼ ãã¡ããåèã«ãã¼ã«ã«ç°å¢ï¼Macï¼ã«ã¤ã³ã¹ãã¼ã«ãã¾ããï¼ Mac 㸠MySQL ã Homebrew ã§ã¤ã³ã¹ãã¼ã«ããæé -â¦
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9ååã¾ã§ã§ ç¹å®ã®ã¢ãã¬ã¹ã«ã¢ã¯ã»ã¹ârouteãåç §âControllerã§å¦çãå®è¡ ã¨ããã¨ããã¾ã§ã§ãã¾ããï¼ä»åã¯MVCã®View(ãã¥ã¼)ã使ãã ãã©ã¦ã¶ã«Webãã¼ã¸ã表示ãã¾ãï¼ ï¼Unityãªã©ã²ã¼ã éçºã§ã¯ã»â¦
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9ä»åã¯Laravelã®Controller(ã³ã³ããã¼ã©ã¼)ã¨ããæ©è½ã使ã£ã¦æååã表示ãã¾ãï¼ ï¼ååã®routeã«é¢ããè¨äºã¯ãã¡ããããï¼ Controlleræ©è½ã使ãåã«ãMVCãã¿ã¼ã³ã«ã¤ãã¦ç°¡åã«è§¦ãã¦ããã¾ãããï¼
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9 æ¬æ¥ã¯PHPãã¬ã¼ã ã¯ã¼ã¯Laravelã®2è¨äºç®ã§ãï¼ ååè¨äºã¯ãã¡ããä»åã¯ãã©ã¦ã¶ã«ããã¹ãã表示ããã¨ãããã¡ããã¡ãç°¡åãªå 容ã§ãï¼ ããã§ã¯åãã¾ãããï¼
PHPãã¼ã¸ã§ã³ï¼7.1.14 Laravelãã¼ã¸ã§ã³ï¼5.7.9Unityã®éçºããã¦ããã¨ãã¼ã¿ä¿åãªã©ã§ãµã¼ãã¼ã使ããããªãã¾ãï¼ ã¨ããããã§ãPHPãã¬ã¼ã ã¯ã¼ã¯Laravelã使ã£ã¦ã æå¾ã«Unityã¨é£æºãã¦ããã¾ãï¼ç°å¢æ§ç¯ã¯ãã¡ãã®ã ãã¼ãã£ã«ç°å¢(VirtualBoâ¦