Skip to content

Commit 7a2ce6c

Browse files
authored
[10.x] Use newFactory to properly reference factory (#1349)
* Use newFactory to properly reference factory * Update composer.json
1 parent 71d1a70 commit 7a2ce6c

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

composer.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717
"php": "^7.3",
1818
"ext-json": "*",
1919
"firebase/php-jwt": "^5.0",
20-
"illuminate/auth": "^8.0",
21-
"illuminate/console": "^8.0",
22-
"illuminate/container": "^8.0",
23-
"illuminate/contracts": "^8.0",
24-
"illuminate/cookie": "^8.0",
25-
"illuminate/database": "^8.0",
26-
"illuminate/encryption": "^8.0",
27-
"illuminate/http": "^8.0",
28-
"illuminate/support": "^8.0",
20+
"illuminate/auth": "^8.2",
21+
"illuminate/console": "^8.2",
22+
"illuminate/container": "^8.2",
23+
"illuminate/contracts": "^8.2",
24+
"illuminate/cookie": "^8.2",
25+
"illuminate/database": "^8.2",
26+
"illuminate/encryption": "^8.2",
27+
"illuminate/http": "^8.2",
28+
"illuminate/support": "^8.2",
2929
"league/oauth2-server": "^8.1",
3030
"nyholm/psr7": "^1.3",
3131
"phpseclib/phpseclib": "^2.0",

src/Client.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22

33
namespace Laravel\Passport;
44

5+
use Illuminate\Database\Eloquent\Factories\HasFactory;
56
use Illuminate\Database\Eloquent\Model;
67
use Illuminate\Support\Str;
8+
use Laravel\Passport\Database\Factories\ClientFactory;
79

810
class Client extends Model
911
{
12+
use HasFactory;
13+
1014
/**
1115
* The database table used by the model.
1216
*
@@ -189,4 +193,14 @@ public function getConnectionName()
189193
{
190194
return config('passport.storage.database.connection') ?? $this->connection;
191195
}
196+
197+
/**
198+
* Create a new factory instance for the model.
199+
*
200+
* @return \Illuminate\Database\Eloquent\Factories\Factory
201+
*/
202+
public static function newFactory()
203+
{
204+
return ClientFactory::new();
205+
}
192206
}

src/PassportServiceProvider.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ 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-
5854
$this->publishes([
5955
__DIR__.'/../config/passport.php' => config_path('passport.php'),
6056
], 'passport-config');

0 commit comments

Comments
 (0)