1 | <?php |
||
5 | class Models |
||
6 | { |
||
7 | /** |
||
8 | * Map for the messenger's models. |
||
9 | * |
||
10 | * @var array |
||
11 | */ |
||
12 | protected static $models = []; |
||
13 | |||
14 | /** |
||
15 | * Map for the messenger's tables. |
||
16 | * |
||
17 | * @var array |
||
18 | */ |
||
19 | protected static $tables = []; |
||
20 | |||
21 | /** |
||
22 | * Internal pointer name for the app's "user" model. |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | private static $userModelLookupKey = 'User'; |
||
27 | |||
28 | /** |
||
29 | * Set the model to be used for threads. |
||
30 | * |
||
31 | * @param string $model |
||
32 | */ |
||
33 | public static function setMessageModel($model) |
||
37 | |||
38 | /** |
||
39 | * Set the model to be used for participants. |
||
40 | * |
||
41 | * @param string $model |
||
42 | */ |
||
43 | public static function setParticipantModel($model) |
||
47 | |||
48 | /** |
||
49 | * Set the model to be used for threads. |
||
50 | * |
||
51 | * @param string $model |
||
52 | */ |
||
53 | public static function setThreadModel($model) |
||
57 | |||
58 | /** |
||
59 | * Set the model to be used for users. |
||
60 | * |
||
61 | * @param string $model |
||
62 | */ |
||
63 | public static function setUserModel($model) |
||
67 | |||
68 | /** |
||
69 | * Set custom table names. |
||
70 | * |
||
71 | * @param array $map |
||
72 | */ |
||
73 | public static function setTables(array $map) |
||
77 | |||
78 | /** |
||
79 | * Get a custom table name mapping for the given table. |
||
80 | * |
||
81 | * @param string $table |
||
82 | * @return string |
||
83 | */ |
||
84 | public static function table($table) |
||
88 | |||
89 | /** |
||
90 | * Get the class name mapping for the given model. |
||
91 | * |
||
92 | * @param string $model |
||
93 | * @return string |
||
94 | */ |
||
95 | public static function classname($model) |
||
99 | |||
100 | /** |
||
101 | * Get an instance of the messages model. |
||
102 | * |
||
103 | * @param array $attributes |
||
104 | * @return \Transmissor\Models\Messenger\Message |
||
105 | */ |
||
106 | public static function message(array $attributes = []) |
||
110 | |||
111 | /** |
||
112 | * Get an instance of the participants model. |
||
113 | * |
||
114 | * @param array $attributes |
||
115 | * @return \Transmissor\Models\Messenger\Participant |
||
116 | */ |
||
117 | public static function participant(array $attributes = []) |
||
121 | |||
122 | /** |
||
123 | * Get an instance of the threads model. |
||
124 | * |
||
125 | * @param array $attributes |
||
126 | * @return \Transmissor\Models\Messenger\Thread |
||
127 | */ |
||
128 | public static function thread(array $attributes = []) |
||
132 | |||
133 | /** |
||
134 | * Get an instance of the user model. |
||
135 | * |
||
136 | * @param array $attributes |
||
137 | * @return \Illuminate\Database\Eloquent\Model |
||
138 | */ |
||
139 | public static function user(array $attributes = []) |
||
143 | |||
144 | /** |
||
145 | * Get an instance of the given model. |
||
146 | * |
||
147 | * @param string $model |
||
148 | * @param array $attributes |
||
149 | * @return \Illuminate\Database\Eloquent\Model |
||
150 | */ |
||
151 | protected static function make($model, array $attributes = []) |
||
157 | } |
||
158 |