Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgergo committed May 24, 2024
1 parent 3a3c84a commit b7f4531
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
29 changes: 29 additions & 0 deletions database/factories/AuthCodeFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

Check warning on line 1 in database/factories/AuthCodeFactory.php

View workflow job for this annotation

GitHub Actions / 4️⃣ Coding Standards

Found violation(s) of type: no_unused_imports

namespace Cone\Root\Database\Factories;

use Cone\Root\Models\AuthCode;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Date;
use Illuminate\Support\Str;

class AuthCodeFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var class-string<\Cone\Root\Models\AuthCode>
*/
protected $model = AuthCode::class;

/**
* Define the model's default state.
*/
public function definition(): array
{
return [
'code' => mt_rand(100000, 999999),
'expires_at' => Date::now()->addMinutes(5),
];
}
}
10 changes: 10 additions & 0 deletions src/Models/AuthCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

namespace Cone\Root\Models;

use Cone\Root\Database\Factories\AuthCodeFactory;
use Cone\Root\Interfaces\Models\AuthCode as Contract;
use Cone\Root\Traits\InteractsWithProxy;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
Expand Down Expand Up @@ -47,6 +49,14 @@ public static function getProxiedInterface(): string
return Contract::class;
}

/**
* Create a new factory instance for the model.
*/
protected static function newFactory(): Factory
{
return AuthCodeFactory::new();
}

/**
* Get the user for the model.
*/
Expand Down

0 comments on commit b7f4531

Please sign in to comment.