Skip to content

Commit

Permalink
Additional test + docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalbaljet committed Oct 28, 2020
1 parent 7eb0e96 commit 826bd3d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@

use Illuminate\Support\Facades\Facade;

/*
* @method static \ProtoneMedia\LaravelCrossEloquentSearch\Searcher orderByAsc()
* @method static \ProtoneMedia\LaravelCrossEloquentSearch\Searcher orderByDesc()
* @method static \ProtoneMedia\LaravelCrossEloquentSearch\Searcher dontParseTerm()
* @method static \ProtoneMedia\LaravelCrossEloquentSearch\Searcher startWithWildcard()
* @method static \ProtoneMedia\LaravelCrossEloquentSearch\Searcher add($query, $columns, string $orderByColumn = 'updated_at')
* @method static \ProtoneMedia\LaravelCrossEloquentSearch\Searcher paginate($perPage = 15, $pageName = 'page', $page = null)
* @method static \Illuminate\Support\Collection parseTerms(string $terms, callable $callback = null)
* @method static \Illuminate\Database\Eloquent\Collection|\Illuminate\Contracts\Pagination\LengthAwarePaginator get(string $terms = null)
*
* @see \ProtoneMedia\LaravelCrossEloquentSearch\Searcher
*/
class Search extends Facade
{
/**
Expand Down
3 changes: 2 additions & 1 deletion tests/SearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,11 @@ public function it_can_eager_load_relations()
$postB->comments()->create(['body' => 'ok']);
}

$results = Search::add(Post::with('comments'), 'title')
$results = Search::add(Post::with('comments')->withCount('comments'), 'title')
->get('foo');

$this->assertCount(1, $results);
$this->assertEquals(10, $results->first()->comments_count);
$this->assertTrue($results->first()->relationLoaded('comments'));
}
}

0 comments on commit 826bd3d

Please sign in to comment.