Closed liuminggrowing closed 6 years ago
Case About Products Cant Use, But Attribute is Ok
Can you post the Product Model.
I think the problem is with the attributes added
Have you updated the backend_type
, frontend_type
refer this https://github.com/sunel/eav#add-attribute
i am trying to improve the doc, eav is a bit difficult concept so writing down the whole thing is little bit difficult.
Yes ! I Just Found Why, It Just Like You said, backend_type
is empty when use migrate to initialized. I change it to varchar , and the case is ok ! 3Q for your answer, may be my mysql need to be updated ^_^
I have added the note in the read me, thanks for pointing that out.
When I Running Example : `<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Products;
class test extends Controller { // public function createProductes() { Products::create([ 'name' => 'Flamethrower', 'sku' => '1HJK92', 'upc' => 'SHNDUU451888', 'description' => 'Not a Flamethrower', 'search' => 1, ]); echo "done"; } }`
Get This Error:
Illuminate \ Database \ QueryException (42S22) SQLSTATE[42S22]: Column not found: 1054 Unknown column 'name' in 'field list' (SQL: insert into
products(
name,
sku,
description,
search,
attribute_set_id,
entity_id,
updated_at,
created_at) values (Flamethrower, 1HJK92, Not a Flamethrower, 1, 1, 1, 2018-05-17 03:03:28, 2018-05-17 03:03:28))
And The products table: `
CREATE TABLE
products
(id
int(10) unsigned NOT NULL AUTO_INCREMENT,entity_id
int(10) unsigned NOT NULL,attribute_set_id
int(10) unsigned NOT NULL,created_at
timestamp NULL DEFAULT NULL,updated_at
timestamp NULL DEFAULT NULL, PRIMARY KEY (id
)) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci`
I just Following the ReadMe , Maybe I just got something wrong , help T T