summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichiel Schuurmans <michielschuurmans@gmail.com>2020-10-08 18:46:01 +0200
committerMichiel Schuurmans <michielschuurmans@gmail.com>2020-10-08 18:46:01 +0200
commit3640cf9ecf0712dc3829f74725370caacaa489ac (patch)
tree085441aba9604408d5c98cfd684362e8cd1a8dbd
parentadaa761b061bdb1dcfcdfcafa996c770149eb9ff (diff)
Products: Add brand relation and users
Signed-off-by: Michiel Schuurmans <michielschuurmans@gmail.com>
-rw-r--r--src/products/app/Console/Kernel.php1
-rw-r--r--src/products/app/Http/Controllers/BrandsController.php9
-rw-r--r--src/products/app/Http/Controllers/ExampleController.php18
-rw-r--r--src/products/app/Http/Controllers/JobsController.php19
-rw-r--r--src/products/app/Http/Controllers/ProductsController.php2
-rw-r--r--src/products/app/Http/Controllers/UsersController.php39
-rw-r--r--src/products/app/Jobs/ExampleJob.php26
-rw-r--r--src/products/app/Models/Brand.php (renamed from src/products/app/Brand.php)7
-rw-r--r--src/products/app/Models/Product.php (renamed from src/products/app/Product.php)7
-rw-r--r--src/products/app/Models/User.php2
-rw-r--r--src/products/composer.lock306
-rw-r--r--src/products/database/migrations/2020_10_01_181541_brands_create_table.php (renamed from src/products/database/migrations/2020_10_01_194541_brands_create_table.php)0
-rw-r--r--src/products/database/migrations/2020_10_01_182914_products_table_create.php3
-rw-r--r--src/products/database/migrations/2020_10_01_195720_product_brand_id.php32
-rw-r--r--src/products/database/migrations/2020_10_08_160814_users_create_table.php35
-rw-r--r--src/products/routes/web.php6
16 files changed, 277 insertions, 235 deletions
diff --git a/src/products/app/Console/Kernel.php b/src/products/app/Console/Kernel.php
index ad6e311..0cfd9a6 100644
--- a/src/products/app/Console/Kernel.php
+++ b/src/products/app/Console/Kernel.php
@@ -13,7 +13,6 @@ class Kernel extends ConsoleKernel
* @var array
*/
protected $commands = [
- //
];
/**
diff --git a/src/products/app/Http/Controllers/BrandsController.php b/src/products/app/Http/Controllers/BrandsController.php
index 62b2f5b..1bdc47c 100644
--- a/src/products/app/Http/Controllers/BrandsController.php
+++ b/src/products/app/Http/Controllers/BrandsController.php
@@ -2,7 +2,7 @@
namespace App\Http\Controllers;
-use App\Brand;
+use App\Models\Brand;
use Illuminate\Http\Request;
class BrandsController extends Controller
@@ -34,4 +34,11 @@ class BrandsController extends Controller
return response('Deleted successfully', 200);
}
+
+ public function get_products($id)
+ {
+ $brand = Brand::find($id);
+
+ return response()->json($brand->products());
+ }
}
diff --git a/src/products/app/Http/Controllers/ExampleController.php b/src/products/app/Http/Controllers/ExampleController.php
deleted file mode 100644
index aab066e..0000000
--- a/src/products/app/Http/Controllers/ExampleController.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-namespace App\Http\Controllers;
-
-class ExampleController extends Controller
-{
- /**
- * Create a new controller instance.
- *
- * @return void
- */
- public function __construct()
- {
- //
- }
-
- //
-}
diff --git a/src/products/app/Http/Controllers/JobsController.php b/src/products/app/Http/Controllers/JobsController.php
new file mode 100644
index 0000000..8ac00b6
--- /dev/null
+++ b/src/products/app/Http/Controllers/JobsController.php
@@ -0,0 +1,19 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Product;
+use Illuminate\Http\Request;
+use App\Jobs\TestJob;
+use Log;
+
+class JobsController extends Controller
+{
+ public function create()
+ {
+ Log::info("Hi");
+
+ return "Hi";
+ }
+}
+
diff --git a/src/products/app/Http/Controllers/ProductsController.php b/src/products/app/Http/Controllers/ProductsController.php
index 30816d6..8a2f381 100644
--- a/src/products/app/Http/Controllers/ProductsController.php
+++ b/src/products/app/Http/Controllers/ProductsController.php
@@ -2,7 +2,7 @@
namespace App\Http\Controllers;
-use App\Product;
+use App\Models\Product;
use Illuminate\Http\Request;
class ProductsController extends Controller
diff --git a/src/products/app/Http/Controllers/UsersController.php b/src/products/app/Http/Controllers/UsersController.php
new file mode 100644
index 0000000..f7b6b0c
--- /dev/null
+++ b/src/products/app/Http/Controllers/UsersController.php
@@ -0,0 +1,39 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Models\User;
+use Illuminate\Http\Request;
+
+class UsersController extends Controller
+{
+ public function get_all()
+ {
+ return response()->json(User::all());
+ }
+
+ public function create(Request $request)
+ {
+ $this->validate($request, [
+ 'email' => 'required|email|unique:users',
+ 'firstname' => 'required',
+ 'lastname' => 'required',
+ ]);
+
+ $user = User::create($request->all());
+
+ return response()->json($user, 201);
+ }
+
+ public function get_one($id)
+ {
+ return response()->json(User::find($id));
+ }
+
+ public function delete($id)
+ {
+ User::FindOrFail($id)->delete();
+
+ return response('Deleted successfully', 200);
+ }
+}
diff --git a/src/products/app/Jobs/ExampleJob.php b/src/products/app/Jobs/ExampleJob.php
deleted file mode 100644
index 7b65bb4..0000000
--- a/src/products/app/Jobs/ExampleJob.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-namespace App\Jobs;
-
-class ExampleJob extends Job
-{
- /**
- * Create a new job instance.
- *
- * @return void
- */
- public function __construct()
- {
- //
- }
-
- /**
- * Execute the job.
- *
- * @return void
- */
- public function handle()
- {
- //
- }
-}
diff --git a/src/products/app/Brand.php b/src/products/app/Models/Brand.php
index 01f1151..4461a49 100644
--- a/src/products/app/Brand.php
+++ b/src/products/app/Models/Brand.php
@@ -1,6 +1,6 @@
<?php
-namespace App;
+namespace App\Models;
use Illuminate\Database\Eloquent\Model;
@@ -11,4 +11,9 @@ class Brand extends Model
];
protected $hidden = [];
+
+ public function products()
+ {
+ return $this->hasMany('\App\Models\Product', 'brand_id', 'id')->get();
+ }
}
diff --git a/src/products/app/Product.php b/src/products/app/Models/Product.php
index e66378b..3f197b9 100644
--- a/src/products/app/Product.php
+++ b/src/products/app/Models/Product.php
@@ -1,6 +1,6 @@
<?php
-namespace App;
+namespace App\Models;
use Illuminate\Database\Eloquent\Model;
@@ -12,4 +12,9 @@ class Product extends Model
];
protected $hidden = [];
+
+ public function brand()
+ {
+ return $this->belongsTo('\App\Models\Brand')->get();
+ }
}
diff --git a/src/products/app/Models/User.php b/src/products/app/Models/User.php
index e8c48fc..6d48cdd 100644
--- a/src/products/app/Models/User.php
+++ b/src/products/app/Models/User.php
@@ -19,7 +19,7 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
* @var array
*/
protected $fillable = [
- 'name', 'email',
+ 'email', 'firstname', 'lastname'
];
/**
diff --git a/src/products/composer.lock b/src/products/composer.lock
index b26fc8f..1023c51 100644
--- a/src/products/composer.lock
+++ b/src/products/composer.lock
@@ -8,16 +8,16 @@
"packages": [
{
"name": "auth0/auth0-php",
- "version": "7.3.0",
+ "version": "7.4.0",
"source": {
"type": "git",
"url": "https://github.com/auth0/auth0-PHP.git",
- "reference": "1ca80b31aa13464e53dc09a0aed834d89cd1b398"
+ "reference": "ccead4f3eab36703b905eee49e9e61a282cb7694"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/auth0/auth0-PHP/zipball/1ca80b31aa13464e53dc09a0aed834d89cd1b398",
- "reference": "1ca80b31aa13464e53dc09a0aed834d89cd1b398",
+ "url": "https://api.github.com/repos/auth0/auth0-PHP/zipball/ccead4f3eab36703b905eee49e9e61a282cb7694",
+ "reference": "ccead4f3eab36703b905eee49e9e61a282cb7694",
"shasum": ""
},
"require": {
@@ -54,7 +54,7 @@
],
"description": "Auth0 PHP SDK.",
"homepage": "https://github.com/auth0/auth0-PHP",
- "time": "2020-08-27T18:35:58+00:00"
+ "time": "2020-09-28T14:41:29+00:00"
},
{
"name": "brick/math",
@@ -671,16 +671,16 @@
},
{
"name": "illuminate/auth",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/auth.git",
- "reference": "fe68cc4860313fbfc1aa7e140cbecd6bf35ba14f"
+ "reference": "f4c2f22bc9a04de025cfea4f0679349a2cbc661e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/auth/zipball/fe68cc4860313fbfc1aa7e140cbecd6bf35ba14f",
- "reference": "fe68cc4860313fbfc1aa7e140cbecd6bf35ba14f",
+ "url": "https://api.github.com/repos/illuminate/auth/zipball/f4c2f22bc9a04de025cfea4f0679349a2cbc661e",
+ "reference": "f4c2f22bc9a04de025cfea4f0679349a2cbc661e",
"shasum": ""
},
"require": {
@@ -720,11 +720,11 @@
],
"description": "The Illuminate Auth package.",
"homepage": "https://laravel.com",
- "time": "2020-08-24T13:16:11+00:00"
+ "time": "2020-09-30T13:49:57+00:00"
},
{
"name": "illuminate/broadcasting",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/broadcasting.git",
@@ -776,16 +776,16 @@
},
{
"name": "illuminate/bus",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/bus.git",
- "reference": "e5a60b2f3b730dd0fbde1259f659ac8a43cb47c7"
+ "reference": "f46a733107cd4ac8d59bf097d8de372d62cced32"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/bus/zipball/e5a60b2f3b730dd0fbde1259f659ac8a43cb47c7",
- "reference": "e5a60b2f3b730dd0fbde1259f659ac8a43cb47c7",
+ "url": "https://api.github.com/repos/illuminate/bus/zipball/f46a733107cd4ac8d59bf097d8de372d62cced32",
+ "reference": "f46a733107cd4ac8d59bf097d8de372d62cced32",
"shasum": ""
},
"require": {
@@ -821,11 +821,11 @@
],
"description": "The Illuminate Bus package.",
"homepage": "https://laravel.com",
- "time": "2020-09-15T12:46:23+00:00"
+ "time": "2020-09-30T13:16:14+00:00"
},
{
"name": "illuminate/cache",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/cache.git",
@@ -878,16 +878,16 @@
},
{
"name": "illuminate/collections",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/collections.git",
- "reference": "a4afcfaabcac3dd14178b541917b5534684a17eb"
+ "reference": "406686622f946b905d34825e40e5f855f7899009"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/collections/zipball/a4afcfaabcac3dd14178b541917b5534684a17eb",
- "reference": "a4afcfaabcac3dd14178b541917b5534684a17eb",
+ "url": "https://api.github.com/repos/illuminate/collections/zipball/406686622f946b905d34825e40e5f855f7899009",
+ "reference": "406686622f946b905d34825e40e5f855f7899009",
"shasum": ""
},
"require": {
@@ -924,11 +924,11 @@
],
"description": "The Illuminate Collections package.",
"homepage": "https://laravel.com",
- "time": "2020-09-22T12:52:21+00:00"
+ "time": "2020-09-30T13:09:00+00:00"
},
{
"name": "illuminate/config",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/config.git",
@@ -972,16 +972,16 @@
},
{
"name": "illuminate/console",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/console.git",
- "reference": "cb87f26f9dc61022e40b0b1f79a4be4cf75b90da"
+ "reference": "ebf1c59fb4b1adc5976e824cb849bc5cab8602c5"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/console/zipball/cb87f26f9dc61022e40b0b1f79a4be4cf75b90da",
- "reference": "cb87f26f9dc61022e40b0b1f79a4be4cf75b90da",
+ "url": "https://api.github.com/repos/illuminate/console/zipball/ebf1c59fb4b1adc5976e824cb849bc5cab8602c5",
+ "reference": "ebf1c59fb4b1adc5976e824cb849bc5cab8602c5",
"shasum": ""
},
"require": {
@@ -1024,11 +1024,11 @@
],
"description": "The Illuminate Console package.",
"homepage": "https://laravel.com",
- "time": "2020-09-20T16:32:43+00:00"
+ "time": "2020-10-01T13:01:20+00:00"
},
{
"name": "illuminate/container",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/container.git",
@@ -1075,16 +1075,16 @@
},
{
"name": "illuminate/contracts",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/contracts.git",
- "reference": "37ec3d86c2761628957b6d762ecd3bd27da754bd"
+ "reference": "82e67fb6a44ac648b7b3bae53ee51bbdd4d2eab0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/contracts/zipball/37ec3d86c2761628957b6d762ecd3bd27da754bd",
- "reference": "37ec3d86c2761628957b6d762ecd3bd27da754bd",
+ "url": "https://api.github.com/repos/illuminate/contracts/zipball/82e67fb6a44ac648b7b3bae53ee51bbdd4d2eab0",
+ "reference": "82e67fb6a44ac648b7b3bae53ee51bbdd4d2eab0",
"shasum": ""
},
"require": {
@@ -1115,20 +1115,20 @@
],
"description": "The Illuminate Contracts package.",
"homepage": "https://laravel.com",
- "time": "2020-09-16T13:57:35+00:00"
+ "time": "2020-10-06T11:28:03+00:00"
},
{
"name": "illuminate/database",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/database.git",
- "reference": "e963eabd33558e4a8eba38a114895d81d993531e"
+ "reference": "119f85ee2e19ed56f8782de0e2ed4086bf7f2636"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/database/zipball/e963eabd33558e4a8eba38a114895d81d993531e",
- "reference": "e963eabd33558e4a8eba38a114895d81d993531e",
+ "url": "https://api.github.com/repos/illuminate/database/zipball/119f85ee2e19ed56f8782de0e2ed4086bf7f2636",
+ "reference": "119f85ee2e19ed56f8782de0e2ed4086bf7f2636",
"shasum": ""
},
"require": {
@@ -1179,11 +1179,11 @@
"orm",
"sql"
],
- "time": "2020-09-29T15:38:58+00:00"
+ "time": "2020-10-06T14:04:52+00:00"
},
{
"name": "illuminate/encryption",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/encryption.git",
@@ -1230,7 +1230,7 @@
},
{
"name": "illuminate/events",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/events.git",
@@ -1281,16 +1281,16 @@
},
{
"name": "illuminate/filesystem",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/filesystem.git",
- "reference": "7d3ae538f7d247c83f25d39742867d1dce4baf81"
+ "reference": "c109c15c48bdde85e7412a94bb5c245e5de8a969"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/filesystem/zipball/7d3ae538f7d247c83f25d39742867d1dce4baf81",
- "reference": "7d3ae538f7d247c83f25d39742867d1dce4baf81",
+ "url": "https://api.github.com/repos/illuminate/filesystem/zipball/c109c15c48bdde85e7412a94bb5c245e5de8a969",
+ "reference": "c109c15c48bdde85e7412a94bb5c245e5de8a969",
"shasum": ""
},
"require": {
@@ -1335,11 +1335,11 @@
],
"description": "The Illuminate Filesystem package.",
"homepage": "https://laravel.com",
- "time": "2020-09-08T12:44:09+00:00"
+ "time": "2020-10-06T14:18:33+00:00"
},
{
"name": "illuminate/hashing",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/hashing.git",
@@ -1383,16 +1383,16 @@
},
{
"name": "illuminate/http",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/http.git",
- "reference": "39b3202c5a6281eba8e886ef334ccddad5e8b37c"
+ "reference": "49d90e6d3f0d9225e09de26c770fabae02fe564d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/http/zipball/39b3202c5a6281eba8e886ef334ccddad5e8b37c",
- "reference": "39b3202c5a6281eba8e886ef334ccddad5e8b37c",
+ "url": "https://api.github.com/repos/illuminate/http/zipball/49d90e6d3f0d9225e09de26c770fabae02fe564d",
+ "reference": "49d90e6d3f0d9225e09de26c770fabae02fe564d",
"shasum": ""
},
"require": {
@@ -1433,20 +1433,20 @@
],
"description": "The Illuminate Http package.",
"homepage": "https://laravel.com",
- "time": "2020-09-28T17:35:40+00:00"
+ "time": "2020-10-06T14:18:33+00:00"
},
{
"name": "illuminate/log",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/log.git",
- "reference": "67adf88709287566838db5f25391987b34c5f34a"
+ "reference": "15d4c06838ebe4b8a0df4d0201c7cf67b969f717"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/log/zipball/67adf88709287566838db5f25391987b34c5f34a",
- "reference": "67adf88709287566838db5f25391987b34c5f34a",
+ "url": "https://api.github.com/repos/illuminate/log/zipball/15d4c06838ebe4b8a0df4d0201c7cf67b969f717",
+ "reference": "15d4c06838ebe4b8a0df4d0201c7cf67b969f717",
"shasum": ""
},
"require": {
@@ -1478,11 +1478,11 @@
],
"description": "The Illuminate Log package.",
"homepage": "https://laravel.com",
- "time": "2020-09-23T08:09:27+00:00"
+ "time": "2020-08-24T13:16:11+00:00"
},
{
"name": "illuminate/macroable",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/macroable.git",
@@ -1524,16 +1524,16 @@
},
{
"name": "illuminate/pagination",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/pagination.git",
- "reference": "0ba3d9b8464025f86e59f8bcbbc02baf2c8e514e"
+ "reference": "c50f59380f8523a3e575b11977c3c8fcacd386bc"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/pagination/zipball/0ba3d9b8464025f86e59f8bcbbc02baf2c8e514e",
- "reference": "0ba3d9b8464025f86e59f8bcbbc02baf2c8e514e",
+ "url": "https://api.github.com/repos/illuminate/pagination/zipball/c50f59380f8523a3e575b11977c3c8fcacd386bc",
+ "reference": "c50f59380f8523a3e575b11977c3c8fcacd386bc",
"shasum": ""
},
"require": {
@@ -1566,11 +1566,11 @@
],
"description": "The Illuminate Pagination package.",
"homepage": "https://laravel.com",
- "time": "2020-09-28T13:22:16+00:00"
+ "time": "2020-10-05T13:13:29+00:00"
},
{
"name": "illuminate/pipeline",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/pipeline.git",
@@ -1614,16 +1614,16 @@
},
{
"name": "illuminate/queue",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/queue.git",
- "reference": "453a2c841f4dd215366a5df1b77422038bb2ec92"
+ "reference": "45d21166414d5aa0f800b383af1ffef0fbe0bcc7"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/queue/zipball/453a2c841f4dd215366a5df1b77422038bb2ec92",
- "reference": "453a2c841f4dd215366a5df1b77422038bb2ec92",
+ "url": "https://api.github.com/repos/illuminate/queue/zipball/45d21166414d5aa0f800b383af1ffef0fbe0bcc7",
+ "reference": "45d21166414d5aa0f800b383af1ffef0fbe0bcc7",
"shasum": ""
},
"require": {
@@ -1671,11 +1671,11 @@
],
"description": "The Illuminate Queue package.",
"homepage": "https://laravel.com",
- "time": "2020-09-16T21:29:00+00:00"
+ "time": "2020-10-06T12:50:20+00:00"
},
{
"name": "illuminate/session",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/session.git",
@@ -1727,16 +1727,16 @@
},
{
"name": "illuminate/support",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/support.git",
- "reference": "f7a139ff6adf8fb6afffe895195a9de04c12a128"
+ "reference": "8baf701232dfc328ec6ffec68afc32a80dacae2f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/support/zipball/f7a139ff6adf8fb6afffe895195a9de04c12a128",
- "reference": "f7a139ff6adf8fb6afffe895195a9de04c12a128",
+ "url": "https://api.github.com/repos/illuminate/support/zipball/8baf701232dfc328ec6ffec68afc32a80dacae2f",
+ "reference": "8baf701232dfc328ec6ffec68afc32a80dacae2f",
"shasum": ""
},
"require": {
@@ -1786,20 +1786,20 @@
],
"description": "The Illuminate Support package.",
"homepage": "https://laravel.com",
- "time": "2020-09-17T18:04:00+00:00"
+ "time": "2020-10-06T14:18:33+00:00"
},
{
"name": "illuminate/testing",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/testing.git",
- "reference": "7ff9a2d167ab141b19bd7dd9c048af9b1472db61"
+ "reference": "c2743c29fc0b75d256e3b4f88d434d3b2499a227"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/testing/zipball/7ff9a2d167ab141b19bd7dd9c048af9b1472db61",
- "reference": "7ff9a2d167ab141b19bd7dd9c048af9b1472db61",
+ "url": "https://api.github.com/repos/illuminate/testing/zipball/c2743c29fc0b75d256e3b4f88d434d3b2499a227",
+ "reference": "c2743c29fc0b75d256e3b4f88d434d3b2499a227",
"shasum": ""
},
"require": {
@@ -1839,20 +1839,20 @@
],
"description": "The Illuminate Testing package.",
"homepage": "https://laravel.com",
- "time": "2020-09-28T20:45:31+00:00"
+ "time": "2020-10-05T07:54:47+00:00"
},
{
"name": "illuminate/translation",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/translation.git",
- "reference": "483128dd620103a11f7d30a5b5b5c873c41793d0"
+ "reference": "757bacf371f5c058e576788ed1dade7b32cb144f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/translation/zipball/483128dd620103a11f7d30a5b5b5c873c41793d0",
- "reference": "483128dd620103a11f7d30a5b5b5c873c41793d0",
+ "url": "https://api.github.com/repos/illuminate/translation/zipball/757bacf371f5c058e576788ed1dade7b32cb144f",
+ "reference": "757bacf371f5c058e576788ed1dade7b32cb144f",
"shasum": ""
},
"require": {
@@ -1887,11 +1887,11 @@
],
"description": "The Illuminate Translation package.",
"homepage": "https://laravel.com",
- "time": "2020-09-24T19:02:07+00:00"
+ "time": "2020-10-06T14:18:33+00:00"
},
{
"name": "illuminate/validation",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/validation.git",
@@ -1946,16 +1946,16 @@
},
{
"name": "illuminate/view",
- "version": "v8.7.1",
+ "version": "v8.9.0",
"source": {
"type": "git",
"url": "https://github.com/illuminate/view.git",
- "reference": "e30f3a381e2e1d36b5a3025b5a0f78e4d6c0da7d"
+ "reference": "6a5aefdbca5c08db8a8fe44c97978d3da46798d8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/illuminate/view/zipball/e30f3a381e2e1d36b5a3025b5a0f78e4d6c0da7d",
- "reference": "e30f3a381e2e1d36b5a3025b5a0f78e4d6c0da7d",
+ "url": "https://api.github.com/repos/illuminate/view/zipball/6a5aefdbca5c08db8a8fe44c97978d3da46798d8",
+ "reference": "6a5aefdbca5c08db8a8fe44c97978d3da46798d8",
"shasum": ""
},
"require": {
@@ -1992,7 +1992,7 @@
],
"description": "The Illuminate View package.",
"homepage": "https://laravel.com",
- "time": "2020-09-23T16:40:53+00:00"
+ "time": "2020-10-05T13:44:15+00:00"
},
{
"name": "laravel/lumen-framework",
@@ -2245,16 +2245,16 @@
},
{
"name": "nesbot/carbon",
- "version": "2.40.1",
+ "version": "2.41.0",
"source": {
"type": "git",
"url": "https://github.com/briannesbitt/Carbon.git",
- "reference": "d9a76d8b7eb0f97cf3a82529393245212f40ba3b"
+ "reference": "8690b13ad4da6d54d692afea15aab30b36fee52e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/d9a76d8b7eb0f97cf3a82529393245212f40ba3b",
- "reference": "d9a76d8b7eb0f97cf3a82529393245212f40ba3b",
+ "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/8690b13ad4da6d54d692afea15aab30b36fee52e",
+ "reference": "8690b13ad4da6d54d692afea15aab30b36fee52e",
"shasum": ""
},
"require": {
@@ -2330,7 +2330,7 @@
"type": "tidelift"
}
],
- "time": "2020-09-23T08:17:37+00:00"
+ "time": "2020-10-04T09:11:05+00:00"
},
{
"name": "nikic/fast-route",
@@ -3036,16 +3036,16 @@
},
{
"name": "symfony/console",
- "version": "v5.1.6",
+ "version": "v5.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
- "reference": "04c3a31fe8ea94b42c9e2d1acc93d19782133b00"
+ "reference": "ae789a8a2ad189ce7e8216942cdb9b77319f5eb8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/console/zipball/04c3a31fe8ea94b42c9e2d1acc93d19782133b00",
- "reference": "04c3a31fe8ea94b42c9e2d1acc93d19782133b00",
+ "url": "https://api.github.com/repos/symfony/console/zipball/ae789a8a2ad189ce7e8216942cdb9b77319f5eb8",
+ "reference": "ae789a8a2ad189ce7e8216942cdb9b77319f5eb8",
"shasum": ""
},
"require": {
@@ -3125,7 +3125,7 @@
"type": "tidelift"
}
],
- "time": "2020-09-18T14:27:32+00:00"
+ "time": "2020-10-07T15:23:00+00:00"
},
{
"name": "symfony/deprecation-contracts",
@@ -3193,16 +3193,16 @@
},
{
"name": "symfony/error-handler",
- "version": "v5.1.6",
+ "version": "v5.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/error-handler.git",
- "reference": "d2f1d4996d5499f1261164d10080e4120001f041"
+ "reference": "5e4d8ef8d71822922d1eebd130219ae3491a5ca9"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/error-handler/zipball/d2f1d4996d5499f1261164d10080e4120001f041",
- "reference": "d2f1d4996d5499f1261164d10080e4120001f041",
+ "url": "https://api.github.com/repos/symfony/error-handler/zipball/5e4d8ef8d71822922d1eebd130219ae3491a5ca9",
+ "reference": "5e4d8ef8d71822922d1eebd130219ae3491a5ca9",
"shasum": ""
},
"require": {
@@ -3260,11 +3260,11 @@
"type": "tidelift"
}
],
- "time": "2020-09-27T03:44:28+00:00"
+ "time": "2020-10-02T08:49:02+00:00"
},
{
"name": "symfony/event-dispatcher",
- "version": "v5.1.6",
+ "version": "v5.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
@@ -3427,7 +3427,7 @@
},
{
"name": "symfony/finder",
- "version": "v5.1.6",
+ "version": "v5.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
@@ -3565,16 +3565,16 @@
},
{
"name": "symfony/http-foundation",
- "version": "v5.1.6",
+ "version": "v5.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
- "reference": "6cca6b2e4b69fc5bace160d14cf1ee5f71483db4"
+ "reference": "353b42e7b4fd1c898aab09a059466c9cea74039b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/http-foundation/zipball/6cca6b2e4b69fc5bace160d14cf1ee5f71483db4",
- "reference": "6cca6b2e4b69fc5bace160d14cf1ee5f71483db4",
+ "url": "https://api.github.com/repos/symfony/http-foundation/zipball/353b42e7b4fd1c898aab09a059466c9cea74039b",
+ "reference": "353b42e7b4fd1c898aab09a059466c9cea74039b",
"shasum": ""
},
"require": {
@@ -3636,20 +3636,20 @@
"type": "tidelift"
}
],
- "time": "2020-09-13T05:01:27+00:00"
+ "time": "2020-09-27T14:14:57+00:00"
},
{
"name": "symfony/http-kernel",
- "version": "v5.1.6",
+ "version": "v5.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-kernel.git",
- "reference": "17227644c3c66dcf32bdfeceff4364d090cd6756"
+ "reference": "1764b87d2f10d5c9ce6e4850fe27934116d89708"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/http-kernel/zipball/17227644c3c66dcf32bdfeceff4364d090cd6756",
- "reference": "17227644c3c66dcf32bdfeceff4364d090cd6756",
+ "url": "https://api.github.com/repos/symfony/http-kernel/zipball/1764b87d2f10d5c9ce6e4850fe27934116d89708",
+ "reference": "1764b87d2f10d5c9ce6e4850fe27934116d89708",
"shasum": ""
},
"require": {
@@ -3750,11 +3750,11 @@
"type": "tidelift"
}
],
- "time": "2020-09-27T04:33:19+00:00"
+ "time": "2020-10-04T07:57:28+00:00"
},
{
"name": "symfony/mime",
- "version": "v5.1.6",
+ "version": "v5.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/mime.git",
@@ -4534,7 +4534,7 @@
},
{
"name": "symfony/process",
- "version": "v5.1.6",
+ "version": "v5.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
@@ -4674,7 +4674,7 @@
},
{
"name": "symfony/string",
- "version": "v5.1.6",
+ "version": "v5.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/string.git",
@@ -4759,7 +4759,7 @@
},
{
"name": "symfony/translation",
- "version": "v5.1.6",
+ "version": "v5.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
@@ -4851,16 +4851,16 @@
},
{
"name": "symfony/translation-contracts",
- "version": "v2.2.0",
+ "version": "v2.3.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation-contracts.git",
- "reference": "77ce1c3627c9f39643acd9af086631f842c50c4d"
+ "reference": "e2eaa60b558f26a4b0354e1bbb25636efaaad105"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/77ce1c3627c9f39643acd9af086631f842c50c4d",
- "reference": "77ce1c3627c9f39643acd9af086631f842c50c4d",
+ "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/e2eaa60b558f26a4b0354e1bbb25636efaaad105",
+ "reference": "e2eaa60b558f26a4b0354e1bbb25636efaaad105",
"shasum": ""
},
"require": {
@@ -4872,7 +4872,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.2-dev"
+ "dev-master": "2.3-dev"
},
"thanks": {
"name": "symfony/contracts",
@@ -4922,11 +4922,11 @@
"type": "tidelift"
}
],
- "time": "2020-09-07T11:33:47+00:00"
+ "time": "2020-09-28T13:05:58+00:00"
},
{
"name": "symfony/var-dumper",
- "version": "v5.1.6",
+ "version": "v5.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
@@ -5817,16 +5817,16 @@
},
{
"name": "phpunit/php-code-coverage",
- "version": "9.1.11",
+ "version": "9.2.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
- "reference": "c9394cb9d07ecfa9351b96f2e296bad473195f4d"
+ "reference": "53a4b737e83be724efd2bc4e7b929b9a30c48972"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c9394cb9d07ecfa9351b96f2e296bad473195f4d",
- "reference": "c9394cb9d07ecfa9351b96f2e296bad473195f4d",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/53a4b737e83be724efd2bc4e7b929b9a30c48972",
+ "reference": "53a4b737e83be724efd2bc4e7b929b9a30c48972",
"shasum": ""
},
"require": {
@@ -5854,7 +5854,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "9.1-dev"
+ "dev-master": "9.2-dev"
}
},
"autoload": {
@@ -5886,7 +5886,7 @@
"type": "github"
}
],
- "time": "2020-09-19T05:29:17+00:00"
+ "time": "2020-10-02T03:37:32+00:00"
},
{
"name": "phpunit/php-file-iterator",
@@ -6115,16 +6115,16 @@
},
{
"name": "phpunit/phpunit",
- "version": "9.3.11",
+ "version": "9.4.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
- "reference": "f7316ea106df7c9507f4fdaa88c47bc10a3b27a1"
+ "reference": "ef533467a7974c4b6c354f3eff42a115910bd4e5"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f7316ea106df7c9507f4fdaa88c47bc10a3b27a1",
- "reference": "f7316ea106df7c9507f4fdaa88c47bc10a3b27a1",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ef533467a7974c4b6c354f3eff42a115910bd4e5",
+ "reference": "ef533467a7974c4b6c354f3eff42a115910bd4e5",
"shasum": ""
},
"require": {
@@ -6140,7 +6140,7 @@
"phar-io/version": "^3.0.2",
"php": ">=7.3",
"phpspec/prophecy": "^1.11.1",
- "phpunit/php-code-coverage": "^9.1.11",
+ "phpunit/php-code-coverage": "^9.2",
"phpunit/php-file-iterator": "^3.0.4",
"phpunit/php-invoker": "^3.1",
"phpunit/php-text-template": "^2.0.2",
@@ -6171,7 +6171,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "9.3-dev"
+ "dev-master": "9.4-dev"
}
},
"autoload": {
@@ -6210,7 +6210,7 @@
"type": "github"
}
],
- "time": "2020-09-24T08:08:49+00:00"
+ "time": "2020-10-02T03:54:37+00:00"
},
{
"name": "sebastian/cli-parser",
@@ -6266,16 +6266,16 @@
},
{
"name": "sebastian/code-unit",
- "version": "1.0.6",
+ "version": "1.0.7",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/code-unit.git",
- "reference": "d3a241b6028ff9d8e97d2b6ebd4090d01f92fad8"
+ "reference": "59236be62b1bb9919e6d7f60b0b832dc05cef9ab"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/d3a241b6028ff9d8e97d2b6ebd4090d01f92fad8",
- "reference": "d3a241b6028ff9d8e97d2b6ebd4090d01f92fad8",
+ "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/59236be62b1bb9919e6d7f60b0b832dc05cef9ab",
+ "reference": "59236be62b1bb9919e6d7f60b0b832dc05cef9ab",
"shasum": ""
},
"require": {
@@ -6314,7 +6314,7 @@
"type": "github"
}
],
- "time": "2020-09-28T05:28:46+00:00"
+ "time": "2020-10-02T14:47:54+00:00"
},
{
"name": "sebastian/code-unit-reverse-lookup",
@@ -7013,16 +7013,16 @@
},
{
"name": "sebastian/type",
- "version": "2.2.2",
+ "version": "2.3.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/type.git",
- "reference": "e494dcaeb89d1458c9ccd8c819745245a1669aea"
+ "reference": "fa592377f3923946cb90bf1f6a71ba2e5f229909"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/e494dcaeb89d1458c9ccd8c819745245a1669aea",
- "reference": "e494dcaeb89d1458c9ccd8c819745245a1669aea",
+ "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fa592377f3923946cb90bf1f6a71ba2e5f229909",
+ "reference": "fa592377f3923946cb90bf1f6a71ba2e5f229909",
"shasum": ""
},
"require": {
@@ -7034,7 +7034,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.2-dev"
+ "dev-master": "2.3-dev"
}
},
"autoload": {
@@ -7061,7 +7061,7 @@
"type": "github"
}
],
- "time": "2020-09-28T06:01:38+00:00"
+ "time": "2020-10-06T08:41:03+00:00"
},
{
"name": "sebastian/version",
diff --git a/src/products/database/migrations/2020_10_01_194541_brands_create_table.php b/src/products/database/migrations/2020_10_01_181541_brands_create_table.php
index b55f151..b55f151 100644
--- a/src/products/database/migrations/2020_10_01_194541_brands_create_table.php
+++ b/src/products/database/migrations/2020_10_01_181541_brands_create_table.php
diff --git a/src/products/database/migrations/2020_10_01_182914_products_table_create.php b/src/products/database/migrations/2020_10_01_182914_products_table_create.php
index d747693..631b898 100644
--- a/src/products/database/migrations/2020_10_01_182914_products_table_create.php
+++ b/src/products/database/migrations/2020_10_01_182914_products_table_create.php
@@ -16,7 +16,10 @@ class ProductsTableCreate extends Migration
Schema::create('products', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
+ $table->bigInteger('brand_id')->unsigned();
$table->timestamps();
+
+ $table->foreign('brand_id')->references('id')->on('brands')->onDelete('cascade');
});
}
diff --git a/src/products/database/migrations/2020_10_01_195720_product_brand_id.php b/src/products/database/migrations/2020_10_01_195720_product_brand_id.php
deleted file mode 100644
index 106bfc1..0000000
--- a/src/products/database/migrations/2020_10_01_195720_product_brand_id.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\Schema;
-
-class ProductBrandId extends Migration
-{
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::table('products', function (Blueprint $table) {
- $table->foreignId('brand_id')->constrained('brands')->onDelete('cascade');
- });
- }
-
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::table('products', function (Blueprint $table) {
- $table->dropColumn('brand_id');
- });
- }
-}
diff --git a/src/products/database/migrations/2020_10_08_160814_users_create_table.php b/src/products/database/migrations/2020_10_08_160814_users_create_table.php
new file mode 100644
index 0000000..16fa8fb
--- /dev/null
+++ b/src/products/database/migrations/2020_10_08_160814_users_create_table.php
@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class UsersCreateTable extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::create('users', function (Blueprint $table) {
+ $table->increments('id');
+ $table->string('firstname');
+ $table->string('lastname');
+ $table->string('email');
+ $table->boolean('receive_email')->default(0);
+ $table->timestamps();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::dropIfExists('users');
+ }
+}
diff --git a/src/products/routes/web.php b/src/products/routes/web.php
index 9cd6f1f..80505c2 100644
--- a/src/products/routes/web.php
+++ b/src/products/routes/web.php
@@ -25,6 +25,12 @@ $router->group(['prefix' => 'api/v1', 'middleware' => 'auth'], function () use (
$router->get('brands', ['middleware' => 'auth:brands:read', 'uses' => 'BrandsController@get_all']);
$router->get('brands/{id}', ['middleware' => 'auth:brands:read', 'uses' => 'BrandsController@get_one']);
+ $router->get('brands/{id}/products', ['middleware' => 'auth:products:read', 'uses' => 'BrandsController@get_products']);
$router->post('brands', ['middleware' => 'auth:brands:create', 'uses' => 'BrandsController@create']);
$router->delete('brands/{id}', ['middleware' => 'auth:brands:delete', 'uses' => 'BrandsController@delete']);
+
+ $router->get('users', ['middleware' => 'auth:users:read', 'uses' => 'UsersController@get_all']);
+ $router->get('users/{id}', ['middleware' => 'auth:users:read', 'uses' => 'UsersController@get_one']);
+ $router->post('users', ['middleware' => 'auth:users:create', 'uses' => 'UsersController@create']);
+ $router->delete('users/{id}', ['middleware' => 'auth:users:delete', 'uses' => 'UsersController@delete']);
});