# |
Apr 20th 2017, 05:40 |
hiromi2424 |
@voycey function ($q) use ($id) { |
# |
Apr 20th 2017, 05:33 |
voycey |
so yes I do apparantly |
# |
Apr 20th 2017, 05:31 |
slackebot5 |
$q->where(['Locations.retailer_id' = $id]);``` im getting $id not found here |
# |
Apr 20th 2017, 05:31 |
voycey |
```$totalGeofenceImpressions = $this->GeofenceImpressions ->find() ->contain(['Geofences.Locations' => function($q) { return $q->where(['Locations.retailer_id' => $id]); }]) ->where([ 'GeofenceImpressions.timestamp >=' => ($periodStart), 'GeofenceImpressions.timestamp =' => ($periodEnd) ]) ->count();``` For example - ```retu |
# |
Apr 20th 2017, 05:29 |
voycey |
as an anonymous function |
# |
Apr 20th 2017, 05:29 |
voycey |
if I want to use a variable in a contain function do I need to 'use' it? |
# |
Apr 20th 2017, 05:20 |
rrueco |
I see. Thanks. I will read the docs sir |
# |
Apr 20th 2017, 05:20 |
hiromi2424 |
less than or equal. see: https://book.cakephp.org/3.0/en/chronos.html#comparison-methods |
# |
Apr 20th 2017, 05:19 |
rrueco |
@hiromi2424 what's lte? |
# |
Apr 20th 2017, 05:17 |
hiromi2424 |
@rrueco ok? |
# |
Apr 20th 2017, 05:17 |
hiromi2424 |
convert to Date object If string date expression come and then compare it with lte( <= ) |
# |
Apr 20th 2017, 05:16 |
hiromi2424 |
and Date class is preferred class to handle date field/value. |
# |
Apr 20th 2017, 05:16 |
hiromi2424 |
creating custom validation via lambda |
# |
Apr 20th 2017, 05:13 |
hiromi2424 |
see https://book.cakephp.org/3.0/en/core-libraries/validation.html#custom-validation-rules |
# |
Apr 20th 2017, 05:10 |
rrueco |
Thank youi |
# |
Apr 20th 2017, 05:08 |
hiromi2424 |
good luck! |
# |
Apr 20th 2017, 05:08 |
rrueco |
ok sir, I'll try it |
# |
Apr 20th 2017, 05:08 |
hiromi2424 |
+ use Cake\I18n\Date; |
# |
Apr 20th 2017, 05:07 |
hiromi2424 |
@rrueco ``` $validator->add(‘date’, ‘min’, [ ‘rule’ => function ($date) { $date = $date instanceof Date ? $date : new Date($date); return (new Date)->lte($date); }, ‘message’ => ‘min’, ]); |
# |
Apr 20th 2017, 05:06 |
rrueco |
@hiromi2424 yes |
# |
Apr 20th 2017, 04:51 |
hiromi2424 |
@rrueco what’s do you mean of minimum? validation? |
# |
Apr 20th 2017, 03:49 |
rrueco |
Hi. Is it possible to set the minimum of date field (in model)? set it to the current date |
# |
Apr 20th 2017, 03:49 |
kani |
I got error when i use setData in controller. |
# |
Apr 20th 2017, 03:47 |
kani |
Method setData does not exist |
# |
Apr 20th 2017, 00:31 |
pedroseco |
@temp1029 I think this could be usefull for you https://github.com/dereuromark/cakephp-tinyauth |
# |
Apr 20th 2017, 00:30 |
pedroseco |
Hi guys. What do I need to do in order to use eval(\Psy\sh()); on the console? |
# |
Apr 19th 2017, 23:32 |
temp1029 |
anyone have any suggestions on implementing two auth systems in one app? One is for admins and the other if for users, not sure how to handle permissions and whatnot... |
# |
Apr 19th 2017, 21:46 |
joop |
so anyone can tell me how can i working with query datas in the controller? |
# |
Apr 19th 2017, 21:39 |
joop |
yes AdminController.php must be exist |
# |
Apr 19th 2017, 21:39 |
Erik180487 |
Should be Admin |
# |
Apr 19th 2017, 21:39 |
Erik180487 |
AdmiMcontroller |
# |
Apr 19th 2017, 21:37 |
joop |
how do you mean? |
# |
Apr 19th 2017, 21:37 |
Erik180487 |
lol, that should be it I guess |
# |
Apr 19th 2017, 21:37 |
Erik180487 |
I see there's Admim |
# |
Apr 19th 2017, 21:36 |
Erik180487 |
No I don't, but I made a route |
# |
Apr 19th 2017, 21:36 |
Erik180487 |
I followed these steps http://stackoverflow.com/questions/28773205/administration-with-cake-3-prefix |
# |
Apr 19th 2017, 21:36 |
joop |
do you have such a file? |
# |
Apr 19th 2017, 21:35 |
Erik180487 |
anyone know why I get this message: Error: AdmimController could not be found. |
# |
Apr 19th 2017, 21:20 |
joop |
if($roles->Roles->name=='admin'){echo 'Hello Admin';} //this does not work in the controller |
# |
Apr 19th 2017, 21:19 |
joop |
thats my result how can i make an if statement with roles->name ? |
# |
Apr 19th 2017, 21:18 |
joop |
https://pastebin.com/t670wcPT |