diff --git a/app/Http/Controllers/ProductController.php b/app/Http/Controllers/ProductController.php index 0aa0fc3..c0f0328 100644 --- a/app/Http/Controllers/ProductController.php +++ b/app/Http/Controllers/ProductController.php @@ -35,7 +35,7 @@ class ProductController extends Controller { //TODO: Delete all items with all users for the product $request->validate(['product' => 'required']); - $item = User::find(\Auth::id()) + $item = User::findOrFail(\Auth::id()) ->items()->with('users')->find(request('item')); $product = $item->product_id; @@ -51,11 +51,12 @@ class ProductController extends Controller public function patch(Request $request) { - $request->validate(['item' => 'required', 'name' => 'required']); - $item = User::find(\Auth::id())->items()->find(request('item')); - $item->name = request('name'); - $item->save(); - return redirect('item/'.request('item')); + $request->validate(['product' => 'required', 'name' => 'required']); + $product = User::find(\Auth::id())->products()->find(request('product')); + $product->name = request('name'); + $product->url = request('url'); + $product->save(); + return redirect('product/'.request('product')); } /** diff --git a/resources/views/product/addItemForm.blade.php b/resources/views/product/addItemForm.blade.php new file mode 100644 index 0000000..5038106 --- /dev/null +++ b/resources/views/product/addItemForm.blade.php @@ -0,0 +1,14 @@ +
\ No newline at end of file diff --git a/resources/views/product/addProductForm.blade.php b/resources/views/product/addProductForm.blade.php new file mode 100644 index 0000000..5b870bb --- /dev/null +++ b/resources/views/product/addProductForm.blade.php @@ -0,0 +1,19 @@ + \ No newline at end of file diff --git a/resources/views/product/buttons.blade.php b/resources/views/product/buttons.blade.php deleted file mode 100644 index 1d32f34..0000000 --- a/resources/views/product/buttons.blade.php +++ /dev/null @@ -1,46 +0,0 @@ - -