Browse Source

Add manager_id attribute to a couple record and update laravel 5.5.18

pull/3/head
Nafies Luthfi 8 years ago
parent
commit
389757002e
  1. 5
      app/Couple.php
  2. 220
      composer.lock
  3. 3
      database/factories/ModelFactory.php
  4. 2
      database/migrations/2014_10_12_000000_create_users_table.php
  5. 1
      database/migrations/2017_06_27_151536_create_couples_table.php
  6. 7
      tests/Unit/CoupleTest.php
  7. 7
      tests/Unit/UserTest.php

5
app/Couple.php

@ -28,4 +28,9 @@ class Couple extends Model
$user->mother_id = $this->wife_id;
$user->save();
}
public function manager()
{
return $this->belongsTo(User::class);
}
}

220
composer.lock

@ -78,12 +78,12 @@
"source": {
"type": "git",
"url": "https://github.com/backup-manager/laravel.git",
"reference": "b7feabc809dbd27c8bff73b9a73aea9d267e9d38"
"reference": "091374d1da68af269b19c302553e9cea560b5645"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/backup-manager/laravel/zipball/b7feabc809dbd27c8bff73b9a73aea9d267e9d38",
"reference": "b7feabc809dbd27c8bff73b9a73aea9d267e9d38",
"url": "https://api.github.com/repos/backup-manager/laravel/zipball/091374d1da68af269b19c302553e9cea560b5645",
"reference": "091374d1da68af269b19c302553e9cea560b5645",
"shasum": ""
},
"require": {
@ -131,7 +131,7 @@
}
],
"description": "Database backup manager seamlessly integrated with Laravel 4 or 5 with user-definable procedures and support for S3, Dropbox, FTP, SFTP, and more.",
"time": "2017-09-27T05:15:29+00:00"
"time": "2017-09-28T05:28:29+00:00"
},
{
"name": "dnoegel/php-xdg-base-dir",
@ -475,16 +475,16 @@
},
{
"name": "laravel/framework",
"version": "v5.5.13",
"version": "v5.5.18",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "bfbe20d32ee9f98c89df852847827407a5127be4"
"reference": "1cc21baac11551377734b8c17ead17db4c34fe21"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/bfbe20d32ee9f98c89df852847827407a5127be4",
"reference": "bfbe20d32ee9f98c89df852847827407a5127be4",
"url": "https://api.github.com/repos/laravel/framework/zipball/1cc21baac11551377734b8c17ead17db4c34fe21",
"reference": "1cc21baac11551377734b8c17ead17db4c34fe21",
"shasum": ""
},
"require": {
@ -525,7 +525,6 @@
"illuminate/database": "self.version",
"illuminate/encryption": "self.version",
"illuminate/events": "self.version",
"illuminate/exception": "self.version",
"illuminate/filesystem": "self.version",
"illuminate/hashing": "self.version",
"illuminate/http": "self.version",
@ -603,7 +602,7 @@
"framework",
"laravel"
],
"time": "2017-09-24T19:09:38+00:00"
"time": "2017-10-19T12:50:26+00:00"
},
{
"name": "laravel/tinker",
@ -818,20 +817,20 @@
},
{
"name": "luthfi/formfield",
"version": "0.2.0",
"version": "0.2.1",
"source": {
"type": "git",
"url": "https://github.com/nafiesl/FormField.git",
"reference": "ef00f4446acc3c6d454aef2563510cb1b3439e5f"
"reference": "26a491ef89f187024d26913872c66b42a310b9b0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nafiesl/FormField/zipball/ef00f4446acc3c6d454aef2563510cb1b3439e5f",
"reference": "ef00f4446acc3c6d454aef2563510cb1b3439e5f",
"url": "https://api.github.com/repos/nafiesl/FormField/zipball/26a491ef89f187024d26913872c66b42a310b9b0",
"reference": "26a491ef89f187024d26913872c66b42a310b9b0",
"shasum": ""
},
"require": {
"laravelcollective/html": "5.5.*",
"laravelcollective/html": "5.3.* || 5.4.* || 5.5.*",
"php": ">=7.0"
},
"require-dev": {
@ -866,7 +865,7 @@
}
],
"description": "Laravel Form Field the extension of Laravelcollective Form for Laravel 5.3, 5.4 and 5.5 with Twitter Bootstrap 3",
"time": "2017-09-04T23:41:01+00:00"
"time": "2017-10-09T01:45:40+00:00"
},
{
"name": "monolog/monolog",
@ -1288,16 +1287,16 @@
},
{
"name": "psy/psysh",
"version": "v0.8.11",
"version": "v0.8.13",
"source": {
"type": "git",
"url": "https://github.com/bobthecow/psysh.git",
"reference": "b193cd020e8c6b66cea6457826ae005e94e6d2c0"
"reference": "cdb5593c3684bab74e10fcfffe4a0c8d1c39695d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/bobthecow/psysh/zipball/b193cd020e8c6b66cea6457826ae005e94e6d2c0",
"reference": "b193cd020e8c6b66cea6457826ae005e94e6d2c0",
"url": "https://api.github.com/repos/bobthecow/psysh/zipball/cdb5593c3684bab74e10fcfffe4a0c8d1c39695d",
"reference": "cdb5593c3684bab74e10fcfffe4a0c8d1c39695d",
"shasum": ""
},
"require": {
@ -1357,7 +1356,7 @@
"interactive",
"shell"
],
"time": "2017-07-29T19:30:02+00:00"
"time": "2017-10-19T06:13:20+00:00"
},
{
"name": "ramsey/uuid",
@ -1443,16 +1442,16 @@
},
{
"name": "swiftmailer/swiftmailer",
"version": "v6.0.1",
"version": "v6.0.2",
"source": {
"type": "git",
"url": "https://github.com/swiftmailer/swiftmailer.git",
"reference": "008f088d535ed3333af5ad804dd4c0eaf97c2805"
"reference": "412333372fb6c8ffb65496a2bbd7321af75733fc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/008f088d535ed3333af5ad804dd4c0eaf97c2805",
"reference": "008f088d535ed3333af5ad804dd4c0eaf97c2805",
"url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/412333372fb6c8ffb65496a2bbd7321af75733fc",
"reference": "412333372fb6c8ffb65496a2bbd7321af75733fc",
"shasum": ""
},
"require": {
@ -1488,26 +1487,26 @@
}
],
"description": "Swiftmailer, free feature-rich PHP mailer",
"homepage": "http://swiftmailer.org",
"homepage": "http://swiftmailer.symfony.com",
"keywords": [
"email",
"mail",
"mailer"
],
"time": "2017-05-20T06:20:27+00:00"
"time": "2017-09-30T22:39:41+00:00"
},
{
"name": "symfony/console",
"version": "v3.3.9",
"version": "v3.3.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "a1e1b01293a090cb9ae2ddd221a3251a4a7e4abf"
"reference": "116bc56e45a8e5572e51eb43ab58c769a352366c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/a1e1b01293a090cb9ae2ddd221a3251a4a7e4abf",
"reference": "a1e1b01293a090cb9ae2ddd221a3251a4a7e4abf",
"url": "https://api.github.com/repos/symfony/console/zipball/116bc56e45a8e5572e51eb43ab58c769a352366c",
"reference": "116bc56e45a8e5572e51eb43ab58c769a352366c",
"shasum": ""
},
"require": {
@ -1562,20 +1561,20 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2017-09-06T16:40:18+00:00"
"time": "2017-10-02T06:42:24+00:00"
},
{
"name": "symfony/css-selector",
"version": "v3.3.9",
"version": "v3.3.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
"reference": "c5f5263ed231f164c58368efbce959137c7d9488"
"reference": "07447650225ca9223bd5c97180fe7c8267f7d332"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/c5f5263ed231f164c58368efbce959137c7d9488",
"reference": "c5f5263ed231f164c58368efbce959137c7d9488",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/07447650225ca9223bd5c97180fe7c8267f7d332",
"reference": "07447650225ca9223bd5c97180fe7c8267f7d332",
"shasum": ""
},
"require": {
@ -1615,20 +1614,20 @@
],
"description": "Symfony CssSelector Component",
"homepage": "https://symfony.com",
"time": "2017-07-29T21:54:42+00:00"
"time": "2017-10-02T06:42:24+00:00"
},
{
"name": "symfony/debug",
"version": "v3.3.9",
"version": "v3.3.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
"reference": "8beb24eec70b345c313640962df933499373a944"
"reference": "eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/8beb24eec70b345c313640962df933499373a944",
"reference": "8beb24eec70b345c313640962df933499373a944",
"url": "https://api.github.com/repos/symfony/debug/zipball/eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd",
"reference": "eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd",
"shasum": ""
},
"require": {
@ -1671,20 +1670,20 @@
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
"time": "2017-09-01T13:23:39+00:00"
"time": "2017-10-02T06:42:24+00:00"
},
{
"name": "symfony/event-dispatcher",
"version": "v3.3.9",
"version": "v3.3.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
"reference": "54ca9520a00386f83bca145819ad3b619aaa2485"
"reference": "d7ba037e4b8221956ab1e221c73c9e27e05dd423"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/54ca9520a00386f83bca145819ad3b619aaa2485",
"reference": "54ca9520a00386f83bca145819ad3b619aaa2485",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d7ba037e4b8221956ab1e221c73c9e27e05dd423",
"reference": "d7ba037e4b8221956ab1e221c73c9e27e05dd423",
"shasum": ""
},
"require": {
@ -1734,20 +1733,20 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
"time": "2017-07-29T21:54:42+00:00"
"time": "2017-10-02T06:42:24+00:00"
},
{
"name": "symfony/finder",
"version": "v3.3.9",
"version": "v3.3.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "b2260dbc80f3c4198f903215f91a1ac7fe9fe09e"
"reference": "773e19a491d97926f236942484cb541560ce862d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/b2260dbc80f3c4198f903215f91a1ac7fe9fe09e",
"reference": "b2260dbc80f3c4198f903215f91a1ac7fe9fe09e",
"url": "https://api.github.com/repos/symfony/finder/zipball/773e19a491d97926f236942484cb541560ce862d",
"reference": "773e19a491d97926f236942484cb541560ce862d",
"shasum": ""
},
"require": {
@ -1783,20 +1782,20 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"time": "2017-07-29T21:54:42+00:00"
"time": "2017-10-02T06:42:24+00:00"
},
{
"name": "symfony/http-foundation",
"version": "v3.3.9",
"version": "v3.3.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
"reference": "2cdc7de1921d1a1c805a13dc05e44a2cd58f5ad3"
"reference": "22cf9c2b1d9f67cc8e75ae7f4eaa60e4c1eff1f8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/2cdc7de1921d1a1c805a13dc05e44a2cd58f5ad3",
"reference": "2cdc7de1921d1a1c805a13dc05e44a2cd58f5ad3",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/22cf9c2b1d9f67cc8e75ae7f4eaa60e4c1eff1f8",
"reference": "22cf9c2b1d9f67cc8e75ae7f4eaa60e4c1eff1f8",
"shasum": ""
},
"require": {
@ -1836,20 +1835,20 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com",
"time": "2017-09-06T17:07:39+00:00"
"time": "2017-10-05T23:10:23+00:00"
},
{
"name": "symfony/http-kernel",
"version": "v3.3.9",
"version": "v3.3.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-kernel.git",
"reference": "70f5bb3cdd737624249953b61023411e26be5db7"
"reference": "654f047a78756964bf91b619554f956517394018"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/70f5bb3cdd737624249953b61023411e26be5db7",
"reference": "70f5bb3cdd737624249953b61023411e26be5db7",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/654f047a78756964bf91b619554f956517394018",
"reference": "654f047a78756964bf91b619554f956517394018",
"shasum": ""
},
"require": {
@ -1922,20 +1921,20 @@
],
"description": "Symfony HttpKernel Component",
"homepage": "https://symfony.com",
"time": "2017-09-11T16:13:23+00:00"
"time": "2017-10-05T23:40:19+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.5.0",
"version": "v1.6.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803"
"reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7c8fae0ac1d216eb54349e6a8baa57d515fe8803",
"reference": "7c8fae0ac1d216eb54349e6a8baa57d515fe8803",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296",
"reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296",
"shasum": ""
},
"require": {
@ -1947,7 +1946,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.5-dev"
"dev-master": "1.6-dev"
}
},
"autoload": {
@ -1981,20 +1980,20 @@
"portable",
"shim"
],
"time": "2017-06-14T15:44:48+00:00"
"time": "2017-10-11T12:05:26+00:00"
},
{
"name": "symfony/process",
"version": "v3.3.9",
"version": "v3.3.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0"
"reference": "fdf89e57a723a29baf536e288d6e232c059697b1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0",
"reference": "b7666e9b438027a1ea0e1ee813ec5042d5d7f6f0",
"url": "https://api.github.com/repos/symfony/process/zipball/fdf89e57a723a29baf536e288d6e232c059697b1",
"reference": "fdf89e57a723a29baf536e288d6e232c059697b1",
"shasum": ""
},
"require": {
@ -2030,20 +2029,20 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
"time": "2017-07-29T21:54:42+00:00"
"time": "2017-10-02T06:42:24+00:00"
},
{
"name": "symfony/routing",
"version": "v3.3.9",
"version": "v3.3.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/routing.git",
"reference": "970326dcd04522e1cd1fe128abaee54c225e27f9"
"reference": "2e26fa63da029dab49bf9377b3b4f60a8fecb009"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/routing/zipball/970326dcd04522e1cd1fe128abaee54c225e27f9",
"reference": "970326dcd04522e1cd1fe128abaee54c225e27f9",
"url": "https://api.github.com/repos/symfony/routing/zipball/2e26fa63da029dab49bf9377b3b4f60a8fecb009",
"reference": "2e26fa63da029dab49bf9377b3b4f60a8fecb009",
"shasum": ""
},
"require": {
@ -2108,20 +2107,20 @@
"uri",
"url"
],
"time": "2017-07-29T21:54:42+00:00"
"time": "2017-10-02T07:25:00+00:00"
},
{
"name": "symfony/translation",
"version": "v3.3.9",
"version": "v3.3.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
"reference": "add53753d978f635492dfe8cd6953f6a7361ef90"
"reference": "409bf229cd552bf7e3faa8ab7e3980b07672073f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/add53753d978f635492dfe8cd6953f6a7361ef90",
"reference": "add53753d978f635492dfe8cd6953f6a7361ef90",
"url": "https://api.github.com/repos/symfony/translation/zipball/409bf229cd552bf7e3faa8ab7e3980b07672073f",
"reference": "409bf229cd552bf7e3faa8ab7e3980b07672073f",
"shasum": ""
},
"require": {
@ -2173,20 +2172,20 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
"time": "2017-07-29T21:54:42+00:00"
"time": "2017-10-02T06:42:24+00:00"
},
{
"name": "symfony/var-dumper",
"version": "v3.3.9",
"version": "v3.3.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "89fcb5a73e0ede2be2512234c4e40457bb22b35f"
"reference": "03e3693a36701f1c581dd24a6d6eea2eba2113f6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/89fcb5a73e0ede2be2512234c4e40457bb22b35f",
"reference": "89fcb5a73e0ede2be2512234c4e40457bb22b35f",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/03e3693a36701f1c581dd24a6d6eea2eba2113f6",
"reference": "03e3693a36701f1c581dd24a6d6eea2eba2113f6",
"shasum": ""
},
"require": {
@ -2241,7 +2240,7 @@
"debug",
"dump"
],
"time": "2017-08-27T14:52:21+00:00"
"time": "2017-10-02T06:42:24+00:00"
},
{
"name": "tijsverkoyen/css-to-inline-styles",
@ -2716,37 +2715,40 @@
},
{
"name": "myclabs/deep-copy",
"version": "1.6.1",
"version": "1.7.0",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
"reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102"
"reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8e6e04167378abf1ddb4d3522d8755c5fd90d102",
"reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e",
"reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
"php": "^5.6 || ^7.0"
},
"require-dev": {
"doctrine/collections": "1.*",
"phpunit/phpunit": "~4.1"
"doctrine/collections": "^1.0",
"doctrine/common": "^2.6",
"phpunit/phpunit": "^4.1"
},
"type": "library",
"autoload": {
"psr-4": {
"DeepCopy\\": "src/DeepCopy/"
}
},
"files": [
"src/DeepCopy/deep_copy.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Create deep copies (clones) of your objects",
"homepage": "https://github.com/myclabs/DeepCopy",
"keywords": [
"clone",
"copy",
@ -2754,7 +2756,7 @@
"object",
"object graph"
],
"time": "2017-04-12T18:52:22+00:00"
"time": "2017-10-19T19:58:43+00:00"
},
{
"name": "phar-io/manifest",
@ -3319,16 +3321,16 @@
},
{
"name": "phpunit/phpunit",
"version": "6.3.1",
"version": "6.4.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "c0ff817b36a827e64bf5f57bc72278150cf30a77"
"reference": "06b28548fd2b4a20c3cd6e247dc86331a7d4db13"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c0ff817b36a827e64bf5f57bc72278150cf30a77",
"reference": "c0ff817b36a827e64bf5f57bc72278150cf30a77",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/06b28548fd2b4a20c3cd6e247dc86331a7d4db13",
"reference": "06b28548fd2b4a20c3cd6e247dc86331a7d4db13",
"shasum": ""
},
"require": {
@ -3373,7 +3375,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "6.3.x-dev"
"dev-master": "6.4.x-dev"
}
},
"autoload": {
@ -3399,7 +3401,7 @@
"testing",
"xunit"
],
"time": "2017-09-24T07:25:54+00:00"
"time": "2017-10-16T13:18:59+00:00"
},
{
"name": "phpunit/phpunit-mock-objects",
@ -4021,16 +4023,16 @@
},
{
"name": "symfony/dom-crawler",
"version": "v3.3.9",
"version": "v3.3.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/dom-crawler.git",
"reference": "6b511d7329b203a620f09a2288818d27dcc915ae"
"reference": "40dafd42d5dad7fe5ad4e958413d92a207522ac1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/6b511d7329b203a620f09a2288818d27dcc915ae",
"reference": "6b511d7329b203a620f09a2288818d27dcc915ae",
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/40dafd42d5dad7fe5ad4e958413d92a207522ac1",
"reference": "40dafd42d5dad7fe5ad4e958413d92a207522ac1",
"shasum": ""
},
"require": {
@ -4073,7 +4075,7 @@
],
"description": "Symfony DomCrawler Component",
"homepage": "https://symfony.com",
"time": "2017-09-11T15:55:22+00:00"
"time": "2017-10-02T06:42:24+00:00"
},
{
"name": "theseer/tokenizer",

3
database/factories/ModelFactory.php

@ -42,5 +42,8 @@ $factory->define(Couple::class, function (Faker\Generator $faker) {
'wife_id' => function () {
return factory(User::class)->states('female')->create()->id;
},
'manager_id' => function () {
return factory(User::class)->create()->id;
},
];
});

2
database/migrations/2014_10_12_000000_create_users_table.php

@ -29,7 +29,7 @@ class CreateUsersTable extends Migration
$table->string('address')->nullable();
$table->string('city')->nullable();
$table->string('phone')->nullable();
$table->unsignedInteger('manager_id')->nullable();
$table->unsignedInteger('manager_id');
$table->rememberToken();
$table->timestamps();
});

1
database/migrations/2017_06_27_151536_create_couples_table.php

@ -19,6 +19,7 @@ class CreateCouplesTable extends Migration
$table->unsignedInteger('wife_id');
$table->date('marriage_date')->nullable();
$table->date('divorce_date')->nullable();
$table->unsignedInteger('manager_id')->nullable();
$table->timestamps();
$table->unique(['husband_id', 'wife_id']);

7
tests/Unit/CoupleTest.php

@ -34,4 +34,11 @@ class CoupleTest extends TestCase
$this->assertEquals($child->father_id, $couple->husband_id);
$this->assertEquals($child->mother_id, $couple->wife_id);
}
/** @test */
public function a_couple_have_a_manager()
{
$couple = factory(Couple::class)->create();
$this->assertTrue($couple->manager instanceof User);
}
}

7
tests/Unit/UserTest.php

@ -72,4 +72,11 @@ class UserTest extends TestCase
$this->assertEquals($mother->profileLink(), $user->motherLink());
}
/** @test */
public function a_user_have_a_manager()
{
$user = factory(User::class)->create();
$this->assertTrue($user->manager instanceof User);
}
}
Loading…
Cancel
Save