Laravel使用MariaDB

时间:2019-03-25 14:04:12

标签: php json laravel mariadb

PHP 7.2

MariaDB 10.3.11

Laravel 5.5.45

https://github.com/beyondcode/laravel-vouchers/issues/10

我正在使用此包装。 vouchers表内有一个字段data 这是存储数组/ json数据。

vouchers字段类型内的data表是TEXT

https://github.com/beyondcode/laravel-vouchers/blob/master/database/migrations/create_vouchers_table.php.stub

例如

{"customer_id":1,"customer_name":"Shiro","message":"Birthday Voucher"}

优惠券表:-

+-----+-----------+-----------------+----------+--------------------------------------------------------------------------+---------------------+---------------------+---------------------+
| id  | code      | model_type      | model_id | data                                                                     | expires_at          | created_at          | updated_at          |
+-----+-----------+-----------------+----------+--------------------------------------------------------------------------+---------------------+---------------------+---------------------+
| 170 | 1111-1112 | App\VoucherType |        2 | {"customer_id":"1","customer_name":"Shiro","message":"Birthday Voucher"} | 2019-04-30 23:59:59 | 2019-03-20 04:58:12 | 2019-03-20 04:58:12 |
+-----+-----------+-----------------+----------+--------------------------------------------------------------------------+---------------------+---------------------+---------------------+

客户表

+------+----------------------------------------------+----------------------+
| id   | user_name                                    | email                |
+------+----------------------------------------------+----------------------+
| 1    | AMAZON BEAUTY SUPPLY - BEAUTIFUL LADYGAGA HA | beautifyfu@gmail.com |
+------+----------------------------------------------+----------------------+

我想加入我的customers表。

我尝试了https://github.com/ybr-nx/laravel-mariadb,但仍然无法直接加入该表。

有什么想法如何使用json字段连接两个表和一个表?

0 个答案:

没有答案