1 | <?php namespace Arcanedev\LaravelTracker\Trackers; |
||
11 | abstract class AbstractTracker |
||
12 | { |
||
13 | /* ----------------------------------------------------------------- |
||
14 | | Properties |
||
15 | | ----------------------------------------------------------------- |
||
16 | */ |
||
17 | |||
18 | /** @var \Illuminate\Contracts\Foundation\Application */ |
||
19 | private $app; |
||
20 | |||
21 | /* ----------------------------------------------------------------- |
||
22 | | Constructor |
||
23 | | ----------------------------------------------------------------- |
||
24 | */ |
||
25 | |||
26 | /** |
||
27 | * AbstractTracker constructor. |
||
28 | * |
||
29 | * @param \Illuminate\Contracts\Foundation\Application $app |
||
30 | */ |
||
31 | 90 | public function __construct(Application $app) |
|
35 | |||
36 | /* ----------------------------------------------------------------- |
||
37 | | Common Methods |
||
38 | | ----------------------------------------------------------------- |
||
39 | */ |
||
40 | |||
41 | /** |
||
42 | * Get the config instance. |
||
43 | * |
||
44 | * @return \Illuminate\Contracts\Config\Repository |
||
45 | */ |
||
46 | 54 | protected function config() |
|
50 | |||
51 | /** |
||
52 | * Get the session store instance. |
||
53 | * |
||
54 | * @return \Illuminate\Session\Store |
||
55 | */ |
||
56 | 9 | protected function session() |
|
60 | |||
61 | /** |
||
62 | * Get the tracker config. |
||
63 | * |
||
64 | * @param string $key |
||
65 | * @param mixed|null $default |
||
66 | * |
||
67 | * @return mixed |
||
68 | */ |
||
69 | 54 | protected function getConfig($key, $default = null) |
|
73 | |||
74 | /** |
||
75 | * Make the model. |
||
76 | * |
||
77 | * @param string $name |
||
78 | * |
||
79 | * @return \Illuminate\Database\Eloquent\Model|mixed |
||
80 | */ |
||
81 | 45 | protected function makeModel($name) |
|
82 | { |
||
83 | 45 | return $this->make( |
|
84 | 45 | $this->getConfig("models.$name") |
|
85 | ); |
||
86 | } |
||
87 | |||
88 | /** |
||
89 | * Make/Get the instance from the app. |
||
90 | * |
||
91 | * @param string $abstract |
||
92 | * |
||
93 | * @return mixed |
||
94 | */ |
||
95 | 57 | protected function make($abstract) |
|
99 | } |
||
100 |