実現したいこと
関数を呼び出したい。
前提
C:\xampp\htdocs\cb-mente\app\model\Logic
にLogicTemplate.phpというかたちで様々な関数が
あります。
C:\xampp\htdocs\cb-mente\app\Console\Commands
に作成したbacklognoticeqa.phpから上記で新規に
作成した関数を呼び出そうとしたところエラーが
おきました。
LogicTemplate.php内にある他の関数は使えます。
発生している問題・エラーメッセージ
Symfony\Component\Debug\Exception\FatalThrowableError : Call to protected method App\model\Logic\LogicTemplate::backlognoticeposttoslack() from context 'App\Console\Commands\backlognoticeqa' at C:\xampp\htdocs\cb-mente\app\Console\Commands\backlognoticeqa.php:49 45| $html = file_get_contents('https://cb-backlog.backlog.com/api/v2/issues?apiKey=8ZWdji9qTGAC2yu4lCtTGzZuPxSxwVNuxbVVDhlkcFWaSgQwJAjLl4l01t6pNa81&projectId[]=158839&createdSince=' . $today); 46| // $html = file_get_contents('https://cb-backlog.backlog.com/api/v2/issues?apiKey=8ZWdji9qTGAC2yu4lCtTGzZuPxSxwVNuxbVVDhlkcFWaSgQwJAjLl4l01t6pNa81&projectId[]=158839&createdSince=2022-10-04'); 47| $htmls = json_decode($html); 48| $logicTemplate = new LogicTemplate; > 49| $logicTemplate->backlognoticeposttoslack($htmls); 50| } 51| } 52| Exception trace: 1 App\Console\Commands\backlognoticeqa::handle() C:\xampp\htdocs\cb-mente\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:36 2 Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() C:\xampp\htdocs\cb-mente\vendor\laravel\framework\src\Illuminate\Container\Util.php:37 Please use the argument -v to see more details.
該当のソースコード
backlognoticeqa.php
<?php namespace App\Console\Commands; use App\backlog; use Illuminate\Console\Command; use Illuminate\Support\Facades\DB; use App\model\Logic\LogicTemplate; class backlognoticeqa extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'command:backlognoticeqa'; /** * The console command description. * * @var string */ protected $description = 'backlogqa通知をslackへ'; /** * Create a new command instance. * * @return void */ public function __construct() { parent::__construct(); } /** * Execute the console command. * * @return mixed */ public function handle() { //調査依頼 $today = date("Y-m-d"); $html = ○○; $htmls = json_decode($html); $logicTemplate = new LogicTemplate; $logicTemplate->backlognoticeposttoslack($htmls); } }
LogicTemplate.php
<?php namespace App\model\Logic; use Illuminate\Support\Facades\Storage; class LogicTemplate { //backlognoticeをslackに送信 protected function backlognoticeposttoslack($htmls) { 内容は省略 }
試したこと
・composer dump-autoloadを行いましたが駄目でした。
・似たような関数名があったので変更してみましたが駄目でした。
補足情報(FW/ツールのバージョンなど)
Laravel Framework 6.20.44
PHP 7.2.34

回答1件
あなたの回答
tips
プレビュー
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。
また依頼した内容が修正された場合は、修正依頼を取り消すようにしましょう。