Skip to content

Commit

Permalink
Merge pull request #1171 from Orrison/clientFactory
Browse files Browse the repository at this point in the history
[8.x] Add a Passport Client factory to Passport publishing
  • Loading branch information
taylorotwell authored Jan 27, 2020
2 parents 140a693 + 72e4f0f commit e467443
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
19 changes: 19 additions & 0 deletions database/factories/PassportClientFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

/** @var \Illuminate\Database\Eloquent\Factory $factory */

use Faker\Generator as Faker;
use Illuminate\Support\Str;
use Laravel\Passport\Client;

$factory->define(Client::class, function (Faker $faker) {
return [
'user_id' => null,
'name' => $faker->company,
'secret' => Str::random(40),
'redirect' => $faker->url,
'personal_access_client' => 0,
'password_client' => 0,
'revoked' => 0,
];
});
4 changes: 4 additions & 0 deletions src/PassportServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ public function boot()
__DIR__.'/../resources/js/components' => base_path('resources/js/components/passport'),
], 'passport-components');

$this->publishes([
__DIR__.'/../database/factories' => database_path('factories'),
], 'passport-factories');

$this->commands([
Console\InstallCommand::class,
Console\ClientCommand::class,
Expand Down

0 comments on commit e467443

Please sign in to comment.