Permalink
Browse files

Namespaces no PHP

  • Loading branch information...
oscardias committed Sep 8, 2015
1 parent ee438f8 commit ac55d37f91b1516f4eb754404d71ab0824045c57
@@ -1,5 +1,12 @@
<?php
namespace App\Http\Controllers;
use App\Models\Artigo;
use Input;
use Redirect;
use View;
class ArtigosController extends Controller {
public function getIndex()
@@ -1,5 +1,7 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
@@ -1,5 +1,13 @@
<?php
namespace App\Http\Controllers;
use App\Models\Artigo;
use Auth;
use Input;
use Redirect;
use View;
class HomeController extends Controller {
public function getIndex()
@@ -1,5 +1,12 @@
<?php
namespace App\Http\Controllers;
use App\Models\Usuario;
use Input;
use Redirect;
use View;
class UsuariosController extends Controller
{
public function getIndex()
@@ -1,10 +1,14 @@
<?php
class Artigo extends Eloquent
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Artigo extends Model
{
// Relacionamento com usuários
public function usuario()
{
return $this->belongsTo('Usuario');
return $this->belongsTo('App\Models\Usuario');
}
}
@@ -1,11 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
class Usuario extends Eloquent implements AuthenticatableContract, CanResetPasswordContract {
class Usuario extends Model implements AuthenticatableContract, CanResetPasswordContract {
use Authenticatable, CanResetPassword;
@@ -43,6 +46,6 @@ public function getAuthPassword()
// Relacionamento com artigos
public function artigos()
{
return $this->hasMany('Artigo');
return $this->hasMany('App\Models\Artigo');
}
}
@@ -14,7 +14,7 @@ class RouteServiceProvider extends ServiceProvider
*
* @var string
*/
protected $namespace = null;
protected $namespace = 'App\Http\Controllers';
/**
* Define your route model bindings, pattern filters, etc.
@@ -17,9 +17,7 @@
},
"autoload": {
"classmap": [
"database",
"app/Http/Controllers",
"app/Http/Models"
"database"
],
"psr-4": {
"App\\": "app/"
Oops, something went wrong.

0 comments on commit ac55d37

Please sign in to comment.