From 880de3faf2f2c9951cc180b3e5f4a58113869b28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Sun, 14 Jun 2020 17:53:17 +0200 Subject: [PATCH] note on WHERE with data col --- source/docs/v3/tenants.blade.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/docs/v3/tenants.blade.md b/source/docs/v3/tenants.blade.md index ebc431c..376007f 100644 --- a/source/docs/v3/tenants.blade.md +++ b/source/docs/v3/tenants.blade.md @@ -86,6 +86,15 @@ public static function getDataColumn(): string } ``` +Note that querying data inside the `data` column with `where()` will require that you do for example: +```php +where('data.foo', 'bar') +``` + +The data column is encoded/decoded only on model retrieval and saving. + +Also a good rule of thumb is that when you need to query the data with `WHERE` clauses, it should have a dedicated column. This will improve performance and you won't have to think about the `data.` prefixing. + ## Running commands in the tenant context You may run commands in a tenant's context and then return to the previous context (be it central, or another tenant's) by passing a callable to the `run()` method on the tenant object. For example: