1: <?php
2:
3: /**
4: * Deep
5: *
6: * @package rsanchez\Deep
7: * @author Rob Sanchez <info@robsanchez.com>
8: */
9:
10: namespace rsanchez\Deep\Model;
11:
12: use Illuminate\Database\Eloquent\Model;
13: use rsanchez\Deep\Collection\SiteCollection;
14:
15: /**
16: * Model for the sites table
17: */
18: class Site extends Model
19: {
20: /**
21: * {@inheritdoc}
22: */
23: protected $table = 'sites';
24:
25: /**
26: * {@inheritdoc}
27: */
28: protected $primaryKey = 'site_id';
29:
30: /**
31: * {@inheritdoc}
32: *
33: * @param array $models
34: * @return \rsanchez\Deep\Collection\SiteCollection
35: */
36: public function newCollection(array $models = array())
37: {
38: return new SiteCollection($models);
39: }
40:
41: /**
42: * Get the system preferences for this site
43: * @return array|null
44: */
45: public function getSiteSystemPreferencesAttribute($value)
46: {
47: return $value ? @unserialize(@base64_decode($value)) : $value;
48: }
49:
50: /**
51: * Get the member preferences for this site
52: * @return array|null
53: */
54: public function getSiteMemberPreferencesAttribute($value)
55: {
56: return $value ? @unserialize(@base64_decode($value)) : $value;
57: }
58:
59: /**
60: * Get the template preferences for this site
61: * @return array|null
62: */
63: public function getSiteTemplatePreferencesAttribute($value)
64: {
65: return $value ? @unserialize(@base64_decode($value)) : $value;
66: }
67:
68: /**
69: * Get the pages for this site
70: * @return array|null
71: */
72: public function getSitePagesAttribute($value)
73: {
74: return $value ? @unserialize(@base64_decode($value)) : $value;
75: }
76: }
77: