<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
paulhenri-l / eloquent-builder-decorator example snippets
class QueryWithActive extends PaulhenriL\EloquentBuilderDecorator\AbstractBuilderDecorator
{
public function whereActive()
{
return static::decorate(
$this->queryToDecorate->where('active', true)
);
}
}
$usersQuery = User::query();
$usersQuery = new QueryWithActive($query);
// We can now call whereActive() on the query.
$activeUsersCount = $usersQuery->whereActive()->count();
$podcastsQuery = \DB::table('podcasts');
$podcastsQuery = new QueryWithDates($podcastsQuery);
$podcastsQuery = new QueryWithRegion($podcastsQuery);
$podcasts = $podcastsQuery->where('host', 'someone')
->happeningToday()
->inEurope()
->take(10)
->get();
public function whereActive()
{
return static::decorate(
$this->queryToDecorate->where('active', true)
);
}
public function whereActive()
{
return $this->queryToDecorate->where('active', true)
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.