Skip to content

Commit

Permalink
refact: caddi
Browse files Browse the repository at this point in the history
  • Loading branch information
kaioken committed May 29, 2024
1 parent 872cb1c commit 04a3c93
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Domains/Guild/Customers/Repositories/PeoplesRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@
use Baka\Contracts\CompanyInterface;
use Baka\Traits\SearchableTrait;
use Baka\Users\Contracts\UserInterface;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Kanvas\Apps\Models\Apps;
use Kanvas\Exceptions\ModelNotFoundException as ExceptionsModelNotFoundException;
use Kanvas\Guild\Customers\Enums\ContactTypeEnum;
use Kanvas\Guild\Customers\Models\Contact;
use Kanvas\Guild\Customers\Models\People;
use Kanvas\Guild\Customers\Models\PeopleRelationship;
use Kanvas\Apps\Models\Apps;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Facades\DB;

class PeoplesRepository
{
Expand Down Expand Up @@ -56,9 +55,9 @@ public static function getByEmail(string $email, CompanyInterface $company): ?Pe

public static function getByDaysCreated(int $days, Apps $app): Collection
{
return People::where(DB::raw('DATEDIFF(NOW(), created_at)'), '=', $days)
->where('apps_id', $app->getId())
->get();
return People::whereRaw('DATEDIFF(NOW(), created_at) = ?', [$days])
->where('apps_id', $app->getId())
->get();
}

public static function findByEmailOrCreate(string $email, UserInterface $user, CompanyInterface $company, ?string $name): People
Expand Down

0 comments on commit 04a3c93

Please sign in to comment.