This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Middleware; | |
use Illuminate\Http\Request; | |
class UFValidatorMiddleware | |
{ | |
/** | |
* @const array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
abstract class BadAbstractRepository | |
{ | |
protected $model; | |
/** | |
* Recupera todas as entidades de forma genérica. | |
*/ | |
public function getAll() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class DoctorsController extends Controller | |
{ | |
public function index(DoctorRepositoryInterface $doctorRepository) | |
{ | |
$doctors = $doctorRepository->getAll('id', 'desc'); | |
$total = $doctors->total(); | |
// ... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ... | |
class DoctorsController extends Controller | |
{ | |
public function store(Request $request) | |
{ | |
try { | |
$command = new CreateNewDoctorCommand($request->all()); | |
$command->handle(); | |
} catch (CommandException $commandException) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class User | |
{ | |
public function __construct($name, $email, $password) | |
{ | |
$this->name = $name; | |
$this->email = $email; | |
$this->password = bcrypt($password); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class UserRepository implements UserRepositoryInterface | |
{ | |
private $userEloquentModel; | |
public function __construct(UserModel $userModel) | |
{ | |
$this->userEloquentModel = $userModel; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
interface UserRepositoryInterface | |
{ | |
public function __construct(UserModel $userModel); | |
public function createNewUser(User $user); | |
public function UpdateUserById(User $user, $id); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class UserModel extends Illuminate\Database\Eloquent\Model | |
{ | |
protected $table = 'users'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$anuncios = Anuncio::select([ | |
'anuncios.id', | |
'anuncios.titulo', | |
'anuncios.descricao', | |
DB::raw('(select if(count(anuncios_favoritados.id) > 0, 'favorito', 'nao_favorito') from anuncios_favoritados where user_id = "' . Auth::user()->id . '") as favoritado ') | |
])->get() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ... | |
class DbCouponRepository implements CouponRepositoryInterface | |
{ | |
/** | |
* @const int | |
*/ | |
const PAGE_SIZE = 25; |