You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* Setter's */
public function setNomeAttribute($value)
{
$this->attributes['nome'] = trim(ucwords($value));
}
public function setSobrenomeAttribute($value)
{
$this->attributes['sobrenome'] = trim(ucwords($value));
}
public function setRgAttribute($value)
{
$this->attributes['rg'] = trim($value);
}
public function setEmissorAttribute($value)
{
$this->attributes['emissor'] = trim(strtoupper($value));
}
public function setSkypeAttribute($value)
{
$this->attributes['skype'] = trim(strtolower($value));
}
public function setLogradouroAttribute($value)
{
$this->attributes['logradouro'] = trim(ucwords($value));
}
public function setNumeroAttribute($value)
{
$this->attributes['numero'] = trim($value);
}
public function setBairroAttribute($value)
{
$this->attributes['bairro'] = trim(ucwords($value));
}
public function setCidadeAttribute($value)
{
$this->attributes['cidade'] = trim(ucwords($value));
}
public function setUfAttribute($value)
{
$this->attributes['uf'] = trim(strtoupper($value));
}
public function setEmailAttribute($value)
{
$this->attributes['email'] = trim(strtolower($value));
}
public function setPasswordAttribute($value)
{
if(!empty($value)){
$this->attributes['password'] = \Hash::make($value);
}
}
use Illuminate\Support\ServiceProvider;
use Torann\LaravelRepository\RepositoryFactory;
class RepositoriesServiceProvider extends ServiceProvider
{
public function boot() {}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
$this->app->bind(
'App\Repositories\Usuarios\UsuariosInterface', function ($app) {
return RepositoryFactory::create('Usuarios');
});
}
}`
use App\Repositories\Usuarios\UsuariosInterface;
use App\Repositories\Usuarios\UsuariosRepository;
use Illuminate\Http\Request;
use App\Http\Requests;
class UsuariosController extends Controller
{
protected $repository;
public function __construct(UsuariosInterface $repository)
{
$this->repository = $repository;
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return $this->repository->all();
}
}`
The text was updated successfully, but these errors were encountered:
BindingResolutionException in Container.php line 748:
Target [App\Repositories\Usuarios\UsuariosInterface] is not instantiable while building [App\Http\Controllers\UsuariosController].
I'm getting this error message even after following your tutorial. I'm using Laravel 5.2. See my setup:
App\Entities\Usuario.php
`<?php
namespace App\Entities;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Database\Eloquent\SoftDeletes;
class Usuario extends Authenticatable
{
use SoftDeletes;
protected $table = 'usuarios';
protected $dates = ['deleted_at'];
protected $fillable = [
'regra', 'nome', 'sobrenome', 'rg', 'emissor', 'cpf', 'nascimento', 'telefone', 'celular',
'skype', 'cep', 'logradouro', 'numero', 'bairro', 'cidade', 'uf', 'email', 'password'
];
protected $hidden = ['password', 'remember_token'];
}`
App\Repositories\Usuarios\UsuariosInterface.php
`<?php
namespace App\Repositories\Usuarios;
use Torann\LaravelRepository\Repositories\RepositoryInterface;
interface UsuariosInterface extends RepositoryInterface
{
//
}`
App\Repositories\Usuarios\UsuariosRepository.php
`<?php
namespace App\Repositories\Usuarios;
use Torann\LaravelRepository\Repositories\AbstractRepository;
class UsuariosRepository extends AbstractRepository implements UsuariosInterface
{
/**
* Specify Model class name
*
* @return string
*/
protected $model = \App\Entities\Usuario::class;
}`
App\Providers\RepositoriesServiceProvider.php
`<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Torann\LaravelRepository\RepositoryFactory;
class RepositoriesServiceProvider extends ServiceProvider
{
public function boot() {}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
$this->app->bind(
'App\Repositories\Usuarios\UsuariosInterface', function ($app) {
return RepositoryFactory::create('Usuarios');
});
}
}`
App\Http\Controllers\UsuariosController.php
`<?php
namespace App\Http\Controllers;
use App\Repositories\Usuarios\UsuariosInterface;
use App\Repositories\Usuarios\UsuariosRepository;
use Illuminate\Http\Request;
use App\Http\Requests;
class UsuariosController extends Controller
{
protected $repository;
}`
The text was updated successfully, but these errors were encountered: