I have Interface defined in file app/Library/Services/ActionsHistoryServiceInterface.php :
interface ActionsHistoryServiceInterface
{
public static function addLog(Model $model, string $action_type, string $body, callable $func = null, $table = null, $id = null);
...
}
and Service class in app/Library/Services/ActionsHistory.php :
<?php
namespace App\Library\Services;
use App\Library\Services\ActionsHistoryServiceInterface;
...
class ActionsHistory implements ActionsHistoryServiceInterface
{
public static function addLog(
Model $model,
string $action_type,
string $body,
callable $func = null,
$table = null,
$id = null
) {
and I have binding class in app/Providers/ActionsHistoryServiceProvider.php :
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class ActionsHistoryServiceProvider extends ServiceProvider
{
public function register()
{
$this->app->bind('App\Library\Services\ActionsHistoryServiceInterface', 'App\Library\Services\ActionsHistory');
}
public function boot()
{
//
}
}
this way is good as in method register above I can bind another implementaion of ActionsHistory (say different for dev/production mode or Permissions of logged user).
The question is that with PhpStorm 2021 calling in controller on line :
$actionsHistory = \App::make(App\Library\Services\ActionsHistoryServiceInterface::class);
$actionsHistory->addLog(
model: $modelInstance,
action_type: 'action_type'
body:
' User ' . $request->userId . '=>' . $user->name . ' (' . $user->email . ') was subscribed to subscription ' . $subscriptionId . '=>' . $subscription->title
);
PhpStorm opens addLog method of ActionsHistoryServiceInterface, but not implementation in app/Library/Services/ActionsHistory.php class... Can I open implementation class when I click on it controller? Maybe I need other definition of class/Interface in this case ?
Thanks in advance!