-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef57303
commit f064018
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php namespace Lecturize\Taxonomies\Traits; | ||
|
||
use Lecturize\Taxonomies\Models\Taxonomy; | ||
use Lecturize\Taxonomies\Models\Term; | ||
|
||
/** | ||
* Class ModelFinder | ||
* @package Lecturize\Taxonomies\Traits | ||
*/ | ||
trait ModelFinder | ||
{ | ||
/** | ||
* Find term. | ||
* | ||
* @param string $slug | ||
* @return Term | ||
*/ | ||
public function findTerm($slug): Term | ||
{ | ||
return Term::whereSlug($slug)->first(); | ||
} | ||
|
||
/** | ||
* Find taxonomy by term. | ||
* | ||
* @param string $term_id | ||
* @param string $taxonomy | ||
* @return Taxonomy | ||
*/ | ||
public function findTaxonomyByTerm($term_id, $taxonomy): Taxonomy | ||
{ | ||
return Taxonomy::where('term_id', $term_id) | ||
->where('taxonomy', $taxonomy) | ||
->first(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php namespace Lecturize\Taxonomies\Traits; | ||
|
||
/** | ||
* Class ModelGetter | ||
* @package Lecturize\Taxonomies\Traits | ||
*/ | ||
trait ModelGetter | ||
{ | ||
// @todo | ||
} |