у меня возникла проблема при попытке установить dusterio / lumen-паспорт. Я пробовал, основываясь на шаге за шагом, который они дают в github и packagist.org.
проблема в том, что каждый раз, когда я делаю
php artisan migrate
команда, она всегда говорит что-то вроде:
In PassportServiceProvider.php line 299:
Call to undefined function Laravel\Passport\config_path()
и вот мой bootrap / app.php
<?php
require_once __DIR__.'/../vendor/autoload.php';
try {
(new Dotenv\Dotenv(__DIR__.'/../'))->load();
} catch (Dotenv\Exception\InvalidPathException $e) {
//
}
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| Here we will load the environment and create the application instance
| that serves as the central piece of this framework. We'll use this
| application as an "IoC" container and router for this framework.
|
*/
$app = new Laravel\Lumen\Application(
realpath(__DIR__.'/../')
);
$app->withFacades();
$app->withEloquent();
/*
|--------------------------------------------------------------------------
| Register Container Bindings
|--------------------------------------------------------------------------
|
| Now we will register a few bindings in the service container. We will
| register the exception handler and the console kernel. You may add
| your own bindings here if you like or you can make another file.
|
*/
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);
/*
|--------------------------------------------------------------------------
| Register Middleware
|--------------------------------------------------------------------------
|
| Next, we will register the middleware with the application. These can
| be global middleware that run before and after each request into a
| route or middleware that'll be assigned to some specific routes.
|
*/
// $app->middleware([
// App\Http\Middleware\ExampleMiddleware::class
// ]);
$app->routeMiddleware([
'auth' => App\Http\Middleware\Authenticate::class,
]);
/*
|--------------------------------------------------------------------------
| Register Service Providers
|--------------------------------------------------------------------------
|
| Here we will register all of the application's service providers which
| are used to bind services into the container. Service providers are
| totally optional, so you are not required to uncomment this line.
|
*/
$app->register(App\Providers\AppServiceProvider::class);
$app->register(App\Providers\AuthServiceProvider::class);
$app->register(App\Providers\EventServiceProvider::class);
$app->register(Laravel\Passport\PassportServiceProvider::class);
$app->register(Dusterio\LumenPassport\PassportServiceProvider::class);
/*
|--------------------------------------------------------------------------
| Load The Application Routes
|--------------------------------------------------------------------------
|
| Next we will include the routes file so that they can all be added to
| the application. This will provide all of the URLs the application
| can respond to, as well as the controllers that may handle them.
|
*/
$app->router->group([
'namespace' => 'App\Http\Controllers',
], function ($router) {
require __DIR__.'/../routes/web.php';
});
return $app;
я что-то сделал не так? Я пытался поискать в Google, но пока ничего не нашел :(






Это потому, что в Lumen нет некоторых вспомогательных функций laravel. В данном случае это функция config_path ().
Вот решение
composer require irazasyed/larasupportДобавьте класс ниже к своему поставщику услуг (app.php)
$app->register(Irazasyed\Larasupport\Providers\ArtisanServiceProvider::class);
Обновите композитор с помощью composer update
Сделайте миграцию сейчас (миграция php artisan)
Это должно решить вашу проблему.
Вы можете добавить папку помощников в папку приложения и добавить файл helpers.php app/helpers/helpers.php
внутри helpers.php добавить
<?php
if ( ! function_exists('config_path'))
{
/**
* Get the configuration path.
*
* @param string $path
* @return string
*/
function config_path($path = '')
{
return app()->basePath() . '/config' . ($path ? '/' . $path : $path);
}
}
затем добавьте это в composer.json
"autoload": {
"psr-4": {
"App\\": "app/"
},
"files": [
"app/helpers/helpers.php"
]
},
затем беги,
composer dump-autoload
после многочасовых попыток найти проблему, я обнаружил, что паспорт laravel был обновлен до версии 6.0 на packagist.org/packages/laravel/passport вчера (9 апреля 2018 г.). и когда я понижаю версию laravel / паспорта до v5.0.3 (добавляя «laravel / паспорт»: «5.0.3» на требуемый композитор json), он работает! но я до сих пор не знаю, как использовать laravel / паспорт v6. кто-нибудь мог бы мне помочь?