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
abstract class Document { | |
final protected static $table; | |
public function getTable() | |
{ | |
return self::$table; | |
} | |
} |
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 Repository Class **/ | |
abstract class PostRepository { | |
public function create(array $input) | |
{ | |
$post = $this->_create($input); | |
if ($post) { |
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 ProgrammingAreHard\Data\Validators; | |
use Illuminate\Validation\Validator; | |
class ValidationService implements ValidatorInterface { | |
protected $validator; | |
protected $errors = []; |
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 ProgrammingAreHard\Data\Validators; | |
interface HasModelRules { | |
/** | |
* Get the validation rules for the model when creating | |
* | |
* @return array | |
*/ | |
public function getRulesForCreate(); |
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 ProgrammingAreHard\Data\Validators; | |
class UserValidation implements HasModelRules { | |
/** | |
* Laravel validation ruleset for model creation | |
* | |
* @var array | |
*/ | |
private static $rulesForCreate = [ |
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 MyApp\Validators; | |
use ProgrammingAreHard\Data\Validators\UserValidation; | |
use ProgrammingAreHard\Data\Validators\ValidationService; | |
use ProgrammingAreHard\Data\Validators\ValidatorInterface; | |
class RegistrationValidator implements ValidatorInterface { | |
/** | |
* @var \ProgrammingAreHard\Data\Validators\ValidationService |
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 | |
//more code | |
if (false) { | |
$multiQuery = ""; | |
foreach($queryDeleteArray as $inx => $singleQuery) { | |
$multiQuery .= $singleQuery . $this->getSql()->getMultiStatementDelimiter(); | |
} | |
$this->getSql()->doExec($multiQuery); |
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 | |
//change this | |
Route::get('/blog', function() | |
{ | |
Route::get( 'blog', 'BlogController@index' ); | |
}); | |
//to this | |
Route::get( 'blog', 'BlogController@index' ); |
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
<html> | |
<body> | |
<div class="container"> | |
@yield('content') | |
</div> | |
</body> | |
</html> |
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 DoctrineProductRepository implements ProductRepository { | |
//entity manager | |
protected $em; | |
public function addCategory(ProductInterface $product, CategoryInterface $category) | |
{ | |
$product->setCategory($category); |