-
Description:I created a custom skeleton as I need some classes like I configured it as follows: Inside /**
* Get base path.
*
* @return string
*/
protected function getBasePath()
{
return __DIR__ . '/.skeleton';
} Inside laravel: './tests/.skeleton' The make commands now create everything in my custom skeleton, but the added And so you know, I am not hard depending on the user, I've got a config value for that: <?php
return [
'user' => \App\Models\User::class,
]; And it gets loaded and used through: /** @var \Illuminate\Database\Eloquent\Model|\Brandlead\LaravelNovaPassportLogin\Contracts\PassportUserContract $user */
$user = App::make(PassportUserContract::class);
if (!$user instanceof Model) {
throw new \LogicException(sprintf('%s must be an Eloquent model.', get_class($user)));
}
$user = $user::firstOrCreate(
[
'email' => $socialiteUser->getEmail()
],
[
'name' => $socialiteUser->getName(),
'password' => Str::random(32),
]
); Why do I need the user model? Simply because my package hooks into the login flow for Laravel Nova and needs to be able to create a user. Steps To Reproduce:See above |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The above code just point the base_path() directory, composer still handle all the autoloading parts. |
Beta Was this translation helpful? Give feedback.
-
I solved it by adding the skeletons "autoload-dev": {
"psr-4": {
"[PACKAGE_NAME_SPACE}\\Tests\\": "tests/",
"App\\": "tests/.skeleton/app/"
},
"classmap": [
"database",
"tests/.skeleton/database"
]
}, Even the migrations from the skeleton work now |
Beta Was this translation helpful? Give feedback.
The above code just point the base_path() directory, composer still handle all the autoloading parts.