gpt4 book ai didi

laravel - 将 Laravel 的 barryvdh/laravel-ide-helper 添加到 PhpStorm

转载 作者:行者123 更新时间:2023-12-03 14:57:31 24 4
gpt4 key购买 nike

我添加了 barryvdh/laravel-ide-helper适用于 Laravel 5.6 的 PhpStorm 2017.3.4 插件。似乎它不能正常工作。

路线/api.php

Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});

Method 'middleware' not found in Route



路线/web.php
Route::get('/', function () {
return view('welcome');
});

This one is ok



路线/ channel .php
Broadcast::channel('App.User.{id}', function ($user, $id) {
return (int) $user->id === (int) $id;
});

Method 'channel' not found in Broadcast



App\Http\Controllers\Auth\RegisterController.php
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6|confirmed',
]);
}

Multiple definitions exist for class Validator



config/app.php
'aliases' => [

'App' => Illuminate\Support\Facades\App::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'Notification' => Illuminate\Support\Facades\Notification::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'Debugbar' => Barryvdh\Debugbar\Facade::class,

],

Multiple definitions exist for class App.Multiple definitions exist for class Artisan. All lines show these info.



我该怎么办?我刚刚开始学习使用 Laravel。

最佳答案

您需要运行以下工匠命令:

  • php artisan ide-helper:generate
  • php artisan ide-helper:models
  • php artisan ide-helper:meta

  • 事实上,我建议将它包含在 post-update-cmd 中。您的 composer.json 文件的一部分,因此每次您执行此操作时它都会自动运行这些命令 composer update
        "post-update-cmd": [
    "Illuminate\\Foundation\\ComposerScripts::postUpdate",
    "@php artisan ide-helper:generate --tenant=tda",
    "@php artisan ide-helper:meta --tenant=tda",
    "@php artisan horizon:publish --ansi --tenant=tda",
    ]

    关于laravel - 将 Laravel 的 barryvdh/laravel-ide-helper 添加到 PhpStorm,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48574115/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com