select
sum(created_at <= `2019-07-12`), sum(type = 'user' and created_at <= `2019-07-12`), sum(type = 'customer' and created_at <= `2019-07-12`) ,
sum(created_at <= `2019-07-11`), sum(type = 'user' and created_at <= `2019-07-11`), sum(type = 'customer' and created_at <= `2019-07-11`)
from `users`
/**
* Configure the validator instance.
*
* @param \Illuminate\Validation\Validator $validator
* @return void
*/
public function withValidator($validator)
{
$validator->after(function ($validator) {
if ($this->somethingElseIsInvalid()) {
$validator->errors()->add('field', 'Something is wrong with this field!');
}
});
}
public function toArray($request)
{
return [
'email' => $this->when(auth()->user()->id == $this->resource->id, $this->resource->email),
];
}
коэффициенты учитвают и число указанных версий, и число угаданных из них.