File tree 2 files changed +46
-0
lines changed 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php namespace Lecturize \Taxonomies \Traits ;
2
+
3
+ use Lecturize \Taxonomies \Models \Taxonomy ;
4
+ use Lecturize \Taxonomies \Models \Term ;
5
+
6
+ /**
7
+ * Class ModelFinder
8
+ * @package Lecturize\Taxonomies\Traits
9
+ */
10
+ trait ModelFinder
11
+ {
12
+ /**
13
+ * Find term.
14
+ *
15
+ * @param string $slug
16
+ * @return Term
17
+ */
18
+ public function findTerm ($ slug ): Term
19
+ {
20
+ return Term::whereSlug ($ slug )->first ();
21
+ }
22
+
23
+ /**
24
+ * Find taxonomy by term.
25
+ *
26
+ * @param string $term_id
27
+ * @param string $taxonomy
28
+ * @return Taxonomy
29
+ */
30
+ public function findTaxonomyByTerm ($ term_id , $ taxonomy ): Taxonomy
31
+ {
32
+ return Taxonomy::where ('term_id ' , $ term_id )
33
+ ->where ('taxonomy ' , $ taxonomy )
34
+ ->first ();
35
+ }
36
+ }
Original file line number Diff line number Diff line change
1
+ <?php namespace Lecturize \Taxonomies \Traits ;
2
+
3
+ /**
4
+ * Class ModelGetter
5
+ * @package Lecturize\Taxonomies\Traits
6
+ */
7
+ trait ModelGetter
8
+ {
9
+ // @todo
10
+ }
You can’t perform that action at this time.
0 commit comments