|
@@ -1,10 +1,10 @@
|
|
<?php
|
|
<?php
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
namespace App\Http\Controllers;
|
|
-
|
|
|
|
|
|
+use App\Product;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
-class Product extends Controller
|
|
|
|
|
|
+class ProductCntrl extends Controller
|
|
{
|
|
{
|
|
/**
|
|
/**
|
|
* Display a listing of the resource.
|
|
* Display a listing of the resource.
|
|
@@ -13,7 +13,14 @@ class Product extends Controller
|
|
*/
|
|
*/
|
|
public function index()
|
|
public function index()
|
|
{
|
|
{
|
|
- //
|
|
|
|
|
|
+ $products =new Product;
|
|
|
|
+ $category = new Category;
|
|
|
|
+ $category->id = 1;
|
|
|
|
+
|
|
|
|
+ $products->id = 1;
|
|
|
|
+ $products->categories()->attach([$category->id,$products->id]);
|
|
|
|
+ $prd = Product::with('categories')->get();
|
|
|
|
+ return view('welcome',['products'=>$prd]);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|