1
I’m developing a system that when sending data by form is returning me that error:
Bindingresolutionexception in Container.php line 763: Target [Church Repositories Membrorepository] is not instantiable while building [Church Http Controllers Membrocontroller, Church Services Membroservice].
I have already done a research and the solutions presented to me are related to namespace
, but I’ve looked several times, deleted, created again etc. and the error persists. I’ve been stuck here for two days. Using Laravel 5.3
and prettus repository 2.6
.
Follows other documents:
Model Membro.php
<?php
namespace Igreja\Entities;
use Illuminate\Database\Eloquent\Model;
use Prettus\Repository\Contracts\Transformable;
use Prettus\Repository\Traits\TransformableTrait;
class Membro extends Model implements Transformable {
use TransformableTrait;
protected $table = 'membros';
protected $fillable = [
'desde',
'pretencoes_funcoes_id',
'pretencoes_profissionais_id',
'pretencoes_cursos_id'
];
}
Service MembroService.php
<?php
namespace Igreja\Services;
use Igreja\Repositories\MembroRepository;
use Igreja\Entities\Membro;
class MembroService {
private $repository;
public function __construct(MembroRepository $repository)
{
$this->repository = $repository;
}
}
Folder structure
I already entered this command: php Artisan app:name Church
– felipeldnascimento
Elipe as is your configuration of the
composer.json
, because I am asked: you left the standard and so need to register thenamespaces
– novic
Virgilio, "require": { "php": ">=5.6.4", "Laravel/framework": "5.3.", "prettus/L5-Repository": "2.6", "yajra/Laravel-datatables-oracle": "~6.0", "laravelcollective/html": "~5.0", "lord/laroute" : "2." },
– felipeldnascimento
I put an answer! take a look
– novic