Skip to content

Commit e467443

Browse files
authored
Merge pull request #1171 from Orrison/clientFactory
[8.x] Add a Passport Client factory to Passport publishing
2 parents 140a693 + 72e4f0f commit e467443

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
/** @var \Illuminate\Database\Eloquent\Factory $factory */
4+
5+
use Faker\Generator as Faker;
6+
use Illuminate\Support\Str;
7+
use Laravel\Passport\Client;
8+
9+
$factory->define(Client::class, function (Faker $faker) {
10+
return [
11+
'user_id' => null,
12+
'name' => $faker->company,
13+
'secret' => Str::random(40),
14+
'redirect' => $faker->url,
15+
'personal_access_client' => 0,
16+
'password_client' => 0,
17+
'revoked' => 0,
18+
];
19+
});

src/PassportServiceProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ public function boot()
5151
__DIR__.'/../resources/js/components' => base_path('resources/js/components/passport'),
5252
], 'passport-components');
5353

54+
$this->publishes([
55+
__DIR__.'/../database/factories' => database_path('factories'),
56+
], 'passport-factories');
57+
5458
$this->commands([
5559
Console\InstallCommand::class,
5660
Console\ClientCommand::class,

0 commit comments

Comments
 (0)