Я пытался интегрировать «Корзину покупок» Кринсейна, но я не знаю, с чем я не прав.
структура папок введите описание изображения здесь или это
"vendor \ hardevine \ shoppingcart \ src \ Facades \ Cart.php"
Это мой cartcontrooler.php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Product;
use Gloudemans\Shoppingcart\Facades\Cart;
class CartController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$needproduct = Product::needProduct()->get(); //AFISARE 4 PRODUSE INTR-O OARECARE ORDINE
return view('pages.cart')->with('needproduct', $needproduct);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
Cart::add($request->id, $request->name, 1, $request->price)
->associate('App\Product');
return redirect()->route('cart.index')->with('success_message','Produsul a fost adaugat in cos');
}
А это корзина из проекта hardevine
<?php
namespace Gloudemans\Shoppingcart\Facades;
use Illuminate\Support\Facades\Facade;
class Cart extends Facade {
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'cart';
}
}
?>
это ошибка «Пожалуйста, укажите действительный идентификатор». ** если я обновлюсь 2 раза, моя страница покажет мне **