This file contains hidden or 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\Support\Repositories; | |
| use Illuminate\Database\Eloquent\Builder as EloquentQueryBuilder; | |
| use Illuminate\Database\Eloquent\Collection as EloquentCollection; | |
| use Illuminate\Database\Query\Builder as QueryBuilder; | |
| use Illuminate\Pagination\AbstractPaginator as Paginator; | |
| abstract class BaseRepository |
This file contains hidden or 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 | |
| // https://github.com/laravel/framework/blob/5.1/src/Illuminate/Foundation/helpers.php#L56 | |
| // https://github.com/laravel/framework/blob/5.1/src/Illuminate/Container/Container.php#L1128 | |
| // https://github.com/laravel/framework/blob/5.1/src/Illuminate/Container/Container.php#L614 | |
| $query = app(User::class)->newQuery(); | |
| $query = app()->make(User::class)->newQuery(); | |
| $query = app()->make('\App\Domains\Users\User')->newQuery(); | |
| $modelClass = User::class; | |
| $query = app($modelClass)->newQuery(); |
This file contains hidden or 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 | |
| // chain | |
| // https://github.com/laravel/framework/blob/5.1/src/Illuminate/Database/Eloquent/Model.php#L3447 | |
| // https://github.com/laravel/framework/blob/5.1/src/Illuminate/Database/Eloquent/Model.php#L3429 | |
| $user = User::where('email', '[email protected]')->where('is_dead', false)->first(); | |
| $bastards = User::where('country', 'westeros')->whereNull('father')->get(); | |
| // https://github.com/laravel/framework/blob/5.1/src/Illuminate/Database/Eloquent/Model.php#L574 | |
| $query = User::query(); | |
| $query->where('email', '[email protected]'); |
This file contains hidden or 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 UsersRepository | |
| { | |
| public function getList($limit = 15, $offset = 0) | |
| { | |
| return mysql_query("SELECT * FROM `users` LIMIT {$offset} , {$limit}"); | |
| } | |
| } |
This file contains hidden or 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\Support\Queries; | |
| use Illuminate\Database\Query\Builder as QueryBuilder; | |
| use Illuminate\Database\Eloquent\Builder as EloquentQueryBuilder; | |
| use Carbon\Carbon; | |
| abstract class BaseQueryBuilder | |
| { |
This file contains hidden or 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
| protected function compileVar($expression) | |
| { | |
| return preg_replace('/\(\'(.*?)\'\,\s*(.*)\)/', '<?php $$1 = $2; ?>', $expression); | |
| } |
This file contains hidden or 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\Support\Validators\Rules; | |
| use App\Support\Helpers\Dates as DateHelper; | |
| class DateField | |
| { | |
| /** | |
| * @param string $attribute |
This file contains hidden or 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\Support\Validators; | |
| use Illuminate\Support\ServiceProvider; | |
| use Illuminate\Validation\Factory as ValidatorFactory; | |
| class CustomValidatorsServiceProvider extends ServiceProvider | |
| { | |
| public function boot() |
This file contains hidden or 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
| -- |
This file contains hidden or 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
| Vue.filter('implode', function (value, piece, key) { | |
| piece = piece ? piece : ', '; | |
| if(_.isUndefined(key)) { | |
| return value.join(piece); | |
| } | |
| return _.pluck(value, key).join(piece); | |
| }); |