Ad
Laravel 5.7 Exists/unique Validation With JSON Field Type
I have a "countries" table with the following fields:
id: integer
name: json
Field "name" stores value as:
{ "en": "Germany", "de": "Deutschland" }
I wrote the following rule:
'country' => 'nullable|string|max:255|exists:countries,name->en'
but it doesn't work like that. How do I make it work?
MariaDB 10.1.36 / Laravel 5.7
Ad
Answer
Laravel 5.7 doesn't support JSON queries on MariaDB. This will be fixed in Laravel 5.8.
In the meantime, you can use this package: https://github.com/ybr-nx/laravel-mariadb
Ad
source: stackoverflow.com
Related Questions
- → I can't convert Json to string [OctoberCms]
- → Uncaught TypeError Illegal invocation when send FormData to ajax
- → Laravel Send URL with JSON
- → how to write react component to construct HTML DOM
- → AJAX folder path issue
- → Chaining "Count of Columns" of a Method to Single Query Builder
- → Laravel - bindings file for repositories
- → Good solution to work with rest-api like SPA with redux?
- → getting the correct record in Angular with a json feed and passed data
- → Transformer usage on laravel/dingo API
- → Google options Page not saving - Javascript
- → Ember.js JSON API confusion
- → How can I query Firebase for an equalTo boolean parameter?
Ad