jeudi 14 mai 2020

Laravel: How to create accessors and mutators if table column's name is in dot notation form?

I have table which consists on dot notation columns, I want create accessors and mutators?

I have tried it using camel case, small case, snake case with no luck.

here is the table structure:

CREATE TABLE `orders` (
  `id` int(11) NOT NULL,
  `customer_id` int(11) DEFAULT NULL,
  `store_id` int(11) DEFAULT NULL,
  `payment_method` varchar(255) DEFAULT NULL,
  `payment_method_title` varchar(255) DEFAULT NULL,
  `date_created` datetime DEFAULT NULL,
  `date_updated` datetime DEFAULT NULL,
  `status` varchar(255) DEFAULT NULL,
  `currency` varchar(255) DEFAULT NULL,
  `customer_note` text DEFAULT NULL,
  `transaction_id` varchar(255) DEFAULT NULL,
  `billing.first_name` varchar(255) DEFAULT NULL,
  `billing.last_name` varchar(255) DEFAULT NULL,
  `billing.company` varchar(255) DEFAULT NULL,
  `billing.address_1` text DEFAULT NULL,
  `billing.address_2` text DEFAULT NULL,
  `billing.city` varchar(255) DEFAULT NULL,
  `billing.state` varchar(255) DEFAULT NULL,
  `billing.postcode` varchar(255) DEFAULT NULL,
  `billing.country` varchar(255) DEFAULT NULL,
  `billing.email` varchar(255) DEFAULT NULL,
  `billing.phone` varchar(255) DEFAULT NULL,
  `shipping.first_name` varchar(255) DEFAULT NULL,
  `shipping.last_name` varchar(255) DEFAULT NULL,
  `shipping.company` varchar(255) DEFAULT NULL,
  `shipping.address_1` text DEFAULT NULL,
  `shipping.address_2` text DEFAULT NULL,
  `shipping.city` varchar(255) DEFAULT NULL,
  `shipping.state` varchar(255) DEFAULT NULL,
  `shipping.postcode` varchar(255) DEFAULT NULL,
  `shipping.country` varchar(255) DEFAULT NULL,
  `shipping_lines.method_title` varchar(255) DEFAULT NULL,
  `shipping_lines.method_id` varchar(255) DEFAULT NULL,
  `shipping_lines.total` varchar(255) DEFAULT NULL,
  `shipping_lines.total_tax` varchar(255) DEFAULT NULL,
  `coupon_lines.code` varchar(255) DEFAULT NULL,
  `taxvat` varchar(255) DEFAULT NULL,
  `customer_email` varchar(255) DEFAULT NULL,
  `increment_id` varchar(255) DEFAULT NULL,
  `imported` tinyint(1) DEFAULT 0,
  `wp_id` int(11) DEFAULT NULL,
  `wp_store_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire