laravelでコントローラーがないとでる& バージョン確認してもなぜかコントローラーがないというエラーになる

前提

phpのLaravelでGoogleChat通知処理を作っています。
コマンドスクリプトでGoogleChat通知処理を動かそうと思っていてそのように作成しています。

laravelで以前使っていたコントローラーがないと表示されてしまいます。全く使っておらず、
Routeもコマンドのほうにルーティングしているのでコントローラーに行くはずがないのですが。。。

ちなみに、Laravelのバージョンを確認しようとしても同じことになります。

普通にLaravelのバージョンを確認しようとしてるだけなのに、なぜ違う現象になるのかわからず
困惑しています。下記はLaravelをインストールしているフォルダに移動して行っています。

エラー文(コマンドスクリプト)

php artisan laravel -V Illuminate\Contracts\Container\BindingResolutionException Target class [BbsEntryController] does not exist.

【コントローラー】※ただし使ってません。以下は念のためです。

<?php // Googleアラート通知 namespace App\Http\Controllers; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Routing\Controller as BaseController; use NotificationChannels\GoogleChat\GoogleChatMessage; use App\Notifications\toGoogleChat; class GoogleChatCntroller { public $message; /** * GoogleChatへの送信 * * @param $notifiable * @param \App\Notifications\Reserved $notification * @return void */ //テストでアラート作成 public function keepMesseage() { //変数にメッセージを入れる $message = "Hello,Webhook!"; } public function send() { $notification = new toGoogleChat($this->message); $result = $notification->SendSimple($this->message); dump($result); } }

【ルート】

<?php namespace App; use Illuminate\Support\Facades\Route; use App\Console\Commands\MakeCommandSendGoogleChat; use App\Http\Controllers\NoticeGoogleChatController; /* |-------------------------------------------------------------------------- | Web Routes |-------------------------------------------------------------------------- | | Here is where you can register web routes for your application. These | routes are loaded by the RouteServiceProvider within a group which | contains the "web" middleware group. Now create something great! | */ // Route::get('/mail', 'MailController@send'); Route::get('/sendtoGoogleCommand',[MakeCommandSendGoogleChat::class, 'handle']);

【コマンド】

<?php namespace App\Console\Commands; use Illuminate\Console\Command; use App\Models\User; use App\Notifications; use NotificationChannels\GoogleChat\GoogleChatMessage; class MakeCommandSendGoogleChat extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'command:toGoogleChat'; /** * The console command description. * * @var string */ protected $description = 'グーグルチャット通知てすと'; /** * Execute the console command. * * @return int */ public function handle() { dump('グーグルチャット通知コマンド実行'); return GoogleChatMessage::create('Hello world!'); } }

試したこと

Illuminate\Contracts\Container\BindingResolutionExceptionで検索して

https://teratail.com/questions/292482
や、
https://prograshi.com/framework/laravel/target-class-not-exist/
は試しましたが
同じでした。

ルーティングが古いわけなので、キャッシュかな?と思って
php artisan route:clear.
でやってみても、なぜかphp artisan laravel -Vで調べた結果と同じエラーが出ます。。。
ここ2日間試してずっとここで詰まっております。。。

エラーを見る限りルーティングが間違っているのはわかりますが、
ここからどうやって直せばいいのかがわからないので、どなたかご教授お願いします。。。

補足情報(FW/ツールのバージョンなど)

Laravelのバージョンを調べられずですが、入れたのは10月あたりなので最新版のはずです。
php 8.1.10

コメントを投稿

0 コメント