-
-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #822 from bavix/819-need-this-for-multi-tenancy-teams
[10.x] add getDynamicDefaultSlug
- Loading branch information
Showing
5 changed files
with
158 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Bavix\Wallet\Test\Infra\Factories; | ||
|
||
use Bavix\Wallet\Test\Infra\Models\UserDynamic; | ||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
|
||
/** | ||
* @extends Factory<UserDynamic> | ||
*/ | ||
final class UserDynamicFactory extends Factory | ||
{ | ||
protected $model = UserDynamic::class; | ||
|
||
public function definition(): array | ||
{ | ||
return [ | ||
'name' => fake() | ||
->name, | ||
'email' => fake() | ||
->unique() | ||
->safeEmail, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Bavix\Wallet\Test\Infra\Models; | ||
|
||
use Bavix\Wallet\Interfaces\Wallet; | ||
use Bavix\Wallet\Traits\HasWallet; | ||
use Illuminate\Database\Eloquent\Model; | ||
|
||
/** | ||
* @property string $name | ||
* @property string $email | ||
* | ||
* @method int getKey() | ||
*/ | ||
final class UserDynamic extends Model implements Wallet | ||
{ | ||
use HasWallet; | ||
|
||
/** | ||
* @var string[] | ||
*/ | ||
protected $fillable = ['name', 'email']; | ||
|
||
public function getTable(): string | ||
{ | ||
return 'users'; | ||
} | ||
|
||
public function getDynamicDefaultSlug(): string | ||
{ | ||
return 'default-' . $this->email; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters