| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- <?php
- namespace App;
- use App\News;
- use Illuminate\Database\Eloquent\Model;
- class Home extends Model
- {
- protected $table = 'home';
- protected $fillable = [
- 'slide1',
- 'slide2',
- 'slide3',
- 'slide4',
- 'slide5',
- 'left',
- 'left1',
- 'left2',
- 'left3',
- 'left4',
- 'left5',
- 'right',
- 'right1',
- 'right2',
- 'right3',
- 'right4',
- 'right5',
- 'image',
- 'url',
- 'banner_top',
- 'banner_top_url',
- 'banner_top_google',
- 'banner_middle',
- 'banner_middle_url',
- 'banner_middle_google',
- 'banner_first',
- 'banner_first_url',
- 'banner_first_google',
- 'radio1_url',
- 'radio2_url',
- 'radio3_url',
- 'radio1_file',
- 'radio2_file',
- 'radio3_file',
- 'radio1_title',
- 'radio2_title',
- 'radio3_title',
- 'image_2',
- 'image_3',
- 'url_2',
- 'url_3',
- 'banner_underb',
- 'banner_underb_url',
- 'banner_underb_2',
- 'banner_underb_url_2',
- 'banner_underb_3',
- 'banner_underb_url_3',
- 'banner_underb_4',
- 'banner_underb_url_4',
- 'banner_underb_5',
- 'banner_underb_url_5',
- 'banner_underb_google',
- 'banner_top_2',
- 'banner_top_2_url',
- 'banner_middle_2',
- 'banner_middle_2_url',
- 'banner_first_2',
- 'banner_first_2_url',
- 'banner_top_3',
- 'banner_top_3_url',
- 'banner_top_4',
- 'banner_top_4_url',
- 'banner_top_5',
- 'banner_top_5_url',
- 'banner_middle_3',
- 'banner_middle_3_url',
- 'banner_middle_4',
- 'banner_middle_4_url',
- 'banner_middle_5',
- 'banner_middle_5_url',
- 'banner_first_3',
- 'banner_first_3_url',
- 'banner_first_4',
- 'banner_first_4_url',
- 'banner_first_5',
- 'banner_first_5_url',
- 'banner_right_top',
- 'banner_right_top_url',
- 'banner_right_top_2',
- 'banner_right_top_2_url',
- 'banner_right_top_3',
- 'banner_right_top_3_url',
- 'banner_right_top_4',
- 'banner_right_top_4_url',
- 'banner_right_top_5',
- 'banner_right_top_5_url',
- 'banner_right_top_google',
- 'banner_right_bottom',
- 'banner_right_bottom_url',
- 'banner_right_bottom_2',
- 'banner_right_bottom_2_url',
- 'banner_right_bottom_3',
- 'banner_right_bottom_3_url',
- 'banner_right_bottom_4',
- 'banner_right_bottom_4_url',
- 'banner_right_bottom_5',
- 'banner_right_bottom_5_url',
- 'banner_right_bottom_google',
- 'banner_right_middle',
- 'banner_right_middle_url',
- 'banner_right_middle_2',
- 'banner_right_middle_2_url',
- 'banner_right_middle_3',
- 'banner_right_middle_3_url',
- 'banner_right_middle_4',
- 'banner_right_middle_4_url',
- 'banner_right_middle_5',
- 'banner_right_middle_5_url',
- 'banner_right_middle_google',
- 'banner_right_big',
- 'banner_right_big_url',
- 'banner_right_big_2',
- 'banner_right_big_2_url',
- 'banner_right_big_3',
- 'banner_right_big_3_url',
- 'banner_right_big_4',
- 'banner_right_big_4_url',
- 'banner_right_big_5',
- 'banner_right_big_5_url',
- 'banner_right_big_google',
- 'footer_image',
- 'footer_image_2',
- 'footer_image_3',
- 'footer_url',
- 'footer_url_2',
- 'footer_url_3',
- ];
- function loadData()
- {
- $this->data = $this;
- if ($this->slide1 != '')
- $this->slide1 = @News::where('id', '=', $this->slide1)->first();
- if ($this->slide2 != '')
- $this->slide2 = @News::where('id', '=', $this->slide2)->first();
- if ($this->slide3 != '')
- $this->slide3 = @News::where('id', '=', $this->slide3)->first();
- if ($this->slide4 != '')
- $this->slide4 = @News::where('id', '=', $this->slide4)->first();
- if ($this->slide5 != '')
- $this->slide5 = @News::where('id', '=', $this->slide5)->first();
- if ($this->left != '')
- $this->left = @News::where('id', '=', $this->left)->first();
- if ($this->left1 != '')
- $this->left1 = @News::where('id', '=', $this->left1)->first();
- if ($this->left2 != '')
- $this->left2 = @News::where('id', '=', $this->left2)->first();
- if ($this->left3 != '')
- $this->left3 = @News::where('id', '=', $this->left3)->first();
- if ($this->left4 != '')
- $this->left4 = @News::where('id', '=', $this->left4)->first();
- if ($this->left5 != '')
- $this->left5 = @News::where('id', '=', $this->left5)->first();
- if ($this->right1 != '')
- $this->right1 = @News::where('id', '=', $this->right1)->first();
- if ($this->right2 != '')
- $this->right2 = @News::where('id', '=', $this->right2)->first();
- if ($this->right3 != '')
- $this->right3 = @News::where('id', '=', $this->right3)->first();
- if ($this->right4 != '')
- $this->right4 = @News::where('id', '=', $this->right4)->first();
- if ($this->right5 != '')
- $this->right5 = @News::where('id', '=', $this->right5)->first();
- }
- function hasSlider($type)
- {
- $tot = 0;
- if ($type == 'left')
- {
- if(isset($this->left1) && $this->left1 != '')
- $tot += 1;
- if(isset($this->left2) && $this->left2 != '')
- $tot += 1;
- if(isset($this->left3) && $this->left3 != '')
- $tot += 1;
- if(isset($this->left4) && $this->left4 != '')
- $tot += 1;
- if(isset($this->left5) && $this->left5 != '')
- $tot += 1;
- }
- if ($type == 'right')
- {
- if(isset($this->right1) && $this->right1 != '')
- $tot += 1;
- if(isset($this->right2) && $this->right2 != '')
- $tot += 1;
- if(isset($this->right3) && $this->right3 != '')
- $tot += 1;
- if(isset($this->right4) && $this->right4 != '')
- $tot += 1;
- if(isset($this->right5) && $this->right5 != '')
- $tot += 1;
- }
- return $tot > 1;
- }
- }
|