public function Posts() { $channel = \Model\Channel\ModelName::general(); $categories = \Model\Category\ModelName::all(); $backgroundMain = \Model\Background\ModelName::where('published', '=', true)->first(); return view('Front::post.posts', ['channel' => $channel, 'categories' => $categories, 'backgroundMain' => $backgroundMain]); }
/** * Run the database seeds. * * @return void */ public function run() { \Model\Channel\ModelName::truncate(); \Model\Channel\ModelName::create(['id' => 1, 'name' => 'general', 'display' => 'Главная', 'published' => true]); \Model\Channel\ModelName::create(['id' => 2, 'name' => 'ktr', 'display' => 'КТР', 'published' => true]); \Model\Channel\ModelName::create(['id' => 3, 'name' => 'muzkanal', 'display' => 'Муз Канал', 'published' => true]); \Model\Channel\ModelName::create(['id' => 4, 'name' => 'balastan', 'display' => 'Баластан', 'published' => true]); \Model\Channel\ModelName::create(['id' => 5, 'name' => 'madaniyat', 'display' => 'Маданият', 'published' => true]); }
public function allphotos() { $channel = \Model\Channel\ModelName::name('kyrgyzradio')->first(); $perPage = 24; $backgroundMain = \Model\Background\ModelName::where('published', '=', true)->first(); $postAll = \Model\Media\ModelName::where('published', '=', true)->where('kyrgyzradio', '=', '1')->orderBy('id', 'desc')->paginate($perPage); // Photo Gallery $photoGalleries = \Model\PhotoParent\ModelName::where('kyrgyzradio', '=', '1')->where('published', '=', true)->take('10')->orderBy('id', 'desc')->get(); return view('Front::channel.kyrgyzradio.allphotos', ['channel' => $channel, 'backgroundMain' => $backgroundMain, 'photoGalleries' => $photoGalleries, 'postAll' => $postAll, 'perPage' => $perPage]); }
/** * Run the database seeds. * * @return void */ public function run() { \Model\Channel\ModelName::truncate(); \Model\Channel\ModelName::create(['id' => 1, 'name' => 'general', 'display' => 'Общий', 'file' => 'images/logo_notext.png', 'published' => true]); \Model\Channel\ModelName::create(['id' => 2, 'name' => 'ktrk', 'display' => 'КТРК', 'file' => 'img/icons/2.svg', 'published' => true]); \Model\Channel\ModelName::create(['id' => 3, 'name' => 'muzkanal', 'display' => 'Музыка', 'file' => 'img/icons/3.png', 'published' => true]); \Model\Channel\ModelName::create(['id' => 4, 'name' => 'balastan', 'display' => 'Баластан', 'file' => 'img/icons/4.png', 'published' => true]); \Model\Channel\ModelName::create(['id' => 5, 'name' => 'madaniyat', 'display' => 'Маданият', 'file' => 'img/icons/5.png', 'published' => true]); \Model\Channel\ModelName::create(['id' => 6, 'name' => 'kyrgyzradio', 'display' => 'Кыргыз Радио', 'file' => 'img/icons/6.png', 'published' => true]); \Model\Channel\ModelName::create(['id' => 7, 'name' => 'birinchi', 'display' => 'Биринчи Радио', 'file' => 'img/icons/7.png', 'published' => true]); \Model\Channel\ModelName::create(['id' => 8, 'name' => 'dostuk', 'display' => 'Достук', 'file' => 'img/icons/8.png', 'published' => true]); \Model\Channel\ModelName::create(['id' => 9, 'name' => 'minkiyal', 'display' => 'Мин Кыял', 'file' => 'img/icons/9.png', 'published' => true]); \Model\Channel\ModelName::create(['id' => 10, 'name' => 'baldar', 'display' => 'Балдар', 'published' => true]); }
public function news(\Model\Post\ModelName $post) { $post->incrementViewed(); $channel = \Model\Channel\ModelName::name('dostuk')->first(); $backgroundMain = \Model\Background\ModelName::where('published', '=', true)->first(); $dostukProjects = \Model\Project\ModelName::where('published', '=', true)->where('dostuk', '=', 1)->get(); $parent = \Model\PhotoParent\ModelName::where('id', '=', $post->parentId)->first(); if ($parent != null) { $images = json_decode($parent->images); } else { $images = null; } return view('Front::channel.dostuk.news', ['channel' => $channel, 'post' => $post, 'backgroundMain' => $backgroundMain, 'dostukProjects' => $dostukProjects, 'images' => $images]); }
public function allphotos() { $channel = \Model\Channel\ModelName::name('madaniyat')->first(); $perPage = 24; $backgroundMain = \Model\Background\ModelName::where('published', '=', true)->first(); $postAll = \Model\Media\ModelName::where('published', '=', true)->where('madaniyat', '=', '1')->orderBy('id', 'desc')->paginate($perPage); $lc = app()->getlocale(); if ($lc == 'kg') { $madaniyatProjects = \Model\Project\ModelName::where('published', '=', true)->where('madaniyat', '=', 1)->where('name', '<>', '')->get(); } else { $madaniyatProjects = \Model\Project\ModelName::where('published', '=', true)->where('madaniyat', '=', 1)->where('nameRu', '<>', '')->get(); } // Photo Gallery $photoGalleries = \Model\PhotoParent\ModelName::where('madaniyat', '=', '1')->where('published', '=', true)->take('10')->orderBy('id', 'desc')->get(); return view('Front::channel.madaniyat.allphotos', ['channel' => $channel, 'backgroundMain' => $backgroundMain, 'photoGalleries' => $photoGalleries, 'postAll' => $postAll, 'perPage' => $perPage, 'madaniyatProjects' => $madaniyatProjects]); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy(Channel $channel) { $channel->delete(); return redirect()->route('admin.channel.index'); }
public function categoryPage(\Model\Category\ModelName $category) { $channel = \Model\Channel\ModelName::general(); $perPage = 10; $category_id = $category->id; $posts = \Model\Post\ModelName::where('category_id', '=', $category_id)->get(); $categories = \Model\Category\ModelName::all(); $backgroundMain = \Model\Background\ModelName::where('published', '=', true)->first(); return view('Front::category.index', ['perPage' => $perPage, 'posts' => $channel->posts()->paginate($perPage), 'category' => $category, 'categories' => $categories, 'backgroundMain' => $backgroundMain]); }
public function ChannelTeleprogram($channel) { $lc = app()->getlocale(); $backgroundMain = \Model\Background\ModelName::where('published', '=', true)->first(); $channels = \Model\Channel\ModelName::take(8)->skip(1)->get(); date_default_timezone_set('Asia/Bishkek'); $now = date("d-m-Y H:i"); $currentDate = date('d-m-Y'); $currentTime = date('H:i'); $weekDay = date('N', strtotime($now)); $channel = \Model\Channel\ModelName::where('id', '=', $channel->id)->first(); if ($channel) { $schedules = \Model\Schedule\ModelName::where('channel_id', '=', $channel->id)->orderBy('date', 'desc')->get(); for ($i = 1; $i <= 7; $i++) { if ($i < $weekDay) { $weekDayNew = date('d-m-Y', strtotime('-' . ($weekDay - $i) . ' day')); $week[] = $weekDayNew; } elseif ($i > $weekDay) { $weekDayNew = date('d-m-Y', strtotime('+' . ($i - $weekDay) . ' day')); $week[] = $weekDayNew; } else { $weekDayNew = date('d-m-Y', strtotime($now)); $week[] = $weekDayNew; } } if (!empty($schedules)) { $programs = array(); for ($j = 0; $j < count($week); $j++) { foreach ($schedules as $schedule) { if (strtotime($week[$j]) == strtotime($schedule->date)) { $program = json_decode($schedule->program); $programNew = array_add($program, 'date', $schedule->date); $programs[] = $programNew; } } } // dd($programs); // $programs = array_reverse($programs); } } // dd($programs); return view('Front::pages.teleprogram', ['lc' => $lc, 'currentDate' => $currentDate, 'currentTime' => $currentTime, 'backgroundMain' => $backgroundMain, 'schedules' => $schedules, 'programs' => $programs, 'week' => $week, 'channels' => $channels, 'channel' => $channel, 'positionTop' => $this->positionTop, 'positionRight' => $this->positionRight, 'positionCenter' => $this->positionCenter, 'positionBottom' => $this->positionBottom, 'positionLeft' => $this->positionLeft]); }
public function isChannelIcon($query) { $channel = \Model\Channel\ModelName::where('id', '=', $query)->first(); return $channel->file; }
public function broadcastsprogramm() { $channel = \Model\Channel\ModelName::name('birinchi')->first(); $backgroundMain = \Model\Background\ModelName::where('published', '=', true)->first(); return view('Front::channel.birinchi.broadcastsprogramm', ['channel' => $channel, 'backgroundMain' => $backgroundMain]); }
public function broadcasts() { $channel = \Model\Channel\ModelName::name('madaniyat')->first(); $backgroundMain = \Model\Background\ModelName::where('published', '=', true)->first(); return view('Front::channel.madaniyat.broadcasts', ['channel' => $channel, 'backgroundMain' => $backgroundMain]); }
public function teleprogram(Request $request) { $channel = \Model\Channel\ModelName::where('name', '=', 'muzkanal')->first(); $lc = app()->getlocale(); $backgroundMain = \Model\Background\ModelName::where('published', '=', true)->first(); date_default_timezone_set('Asia/Bishkek'); $now = date("d-m-Y H:i"); $currentDate = date('d-m-Y'); $currentTime = date('H:i'); $weekDay = date('N', strtotime($now)); if ($channel) { $schedules = \Model\Schedule\ModelName::where('channel_id', '=', $channel->id)->orderBy('date', 'desc')->get(); for ($i = 1; $i <= 7; $i++) { if ($i < $weekDay) { $weekDayNew = date('d-m-Y', strtotime('-' . ($weekDay - $i) . ' day')); $week[] = $weekDayNew; } elseif ($i > $weekDay) { $weekDayNew = date('d-m-Y', strtotime('+' . ($i - $weekDay) . ' day')); $week[] = $weekDayNew; } else { $weekDayNew = date('d-m-Y', strtotime($now)); $week[] = $weekDayNew; } } if (!empty($schedules)) { $programs = array(); foreach ($schedules as $schedule) { $scheduleWeek = date('N', strtotime($schedule->date)); for ($j = 0; $j < count($week); $j++) { if (strtotime($week[$j]) == strtotime($schedule->date)) { $program = json_decode($schedule->program); $programNew = array_add($program, 'date', $schedule->date); $programs[] = $programNew; } } } $programs = array_reverse($programs); } } // dd($programs); return view('Front::channel.muzkanal.teleprogram', ['lc' => $lc, 'currentDate' => $currentDate, 'currentTime' => $currentTime, 'backgroundMain' => $backgroundMain, 'schedules' => $schedules, 'programs' => $programs, 'week' => $week]); }
public function Posts() { $channel = \Model\Channel\ModelName::name('kyrgyzradio')->first(); return view('Front::channel.kyrgyzradio.posts', ['channel' => $channel]); }
| Model Factories |-------------------------------------------------------------------------- | | Here you may define all of your model factories. Model factories give | you a convenient way to create models for testing and seeding your | database. Just tell the factory how a default model should look. | */ $factory->define(\Model\User\ModelName::class, function (Faker\Generator $faker) { $channels = \Model\Channel\ModelName::all(); $channel = $channels[rand(0, count($channels) - 1)]; return ['name' => $faker->name, 'email' => $faker->unique()->email, 'password' => bcrypt("123123"), 'role' => 'manager', 'channel_id' => $channel->id()]; }); $factory->define(\Model\Post\ModelName::class, function (Faker\Generator $faker) { $categories = \Model\Category\ModelName::all(); $category = $categories[rand(0, count($categories) - 1)]; $channels = \Model\Channel\ModelName::all(); $channel = $channels[rand(0, count($channels) - 1)]; return ['category_id' => $category->id(), 'channel_id' => $channel->id(), 'name' => $faker->unique()->sentence(), 'title' => $faker->unique()->sentence(), 'content' => $faker->unique()->paragraph(), 'description' => $faker->unique()->sentence(), 'published' => true, 'general' => rand(0, 1)]; }); // // Category // $factory->define(\Model\Category\ModelName::class, function (Faker\Generator $faker) { // return [ // 'name' => $faker->word(), // 'title' => $faker->word(), // 'published' => true, // ]; // }); $factory->define(\Model\Tag\Tag::class, function (Faker\Generator $faker) { return ['name' => $faker->word]; });
public function Ktr() { $channel = \Model\Channel\ModelName::name('ktr')->first(); return view('Front::channel.ktr.index', ['channel' => $channel]); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit(Schedule $schedule) { $channels = \Model\Channel\ModelName::take(8)->skip(1)->lists('display', 'id')->toArray(); $date = $schedule->date; // $program = json_decode($schedule->program); $extra = $schedule->extra; return view('Admin::schedule.edit', ['date' => $date, 'extra' => $extra, 'schedule' => $schedule, 'channels' => $channels]); }
public function Posts() { $channel = \Model\Channel\ModelName::name('balastan')->first(); return view('Front::channel.balastan.posts', ['channel' => $channel]); }
public function scopeGeneral($query, \Model\Channel\ModelName $channel = null) { return $query->where('general', '=', true)->orWhere('channel_id', '=', $channel->id()); }
public function Posts() { $channel = \Model\Channel\ModelName::name('madaniyat')->first(); return view('Front::channel.madaniyat.posts', ['channel' => $channel]); }
public function gallery() { $channel = \Model\Channel\ModelName::name('minkiyal')->first(); $backgroundMain = \Model\Background\ModelName::where('published', '=', true)->first(); return view('Front::channel.minkiyal.gallery', ['channel' => $channel, 'backgroundMain' => $backgroundMain]); }
public function Posts() { $channel = \Model\Channel\ModelName::general(); $categories = \Model\Category\ModelName::all(); return view('Front::post.posts', ['channel' => $channel, 'categories' => $categories]); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit(Post $post) { $channelList = \Model\Channel\ModelName::lists('display', 'id')->toArray(); $categoryList = \Model\Category\ModelName::lists('titleRu', 'id')->toArray(); $PhotoParentList = \Model\PhotoParent\ModelName::lists('name', 'id')->toArray(); $relatedPosts = \Model\Post\ModelName::where('title', '<>', '')->where('id', '<>', $post->id)->lists('title', 'id')->toArray(); $relatedPosts2 = \Model\Post\ModelName::where('titleRu', '<>', '')->where('id', '<>', $post->id)->lists('titleRu', 'id')->toArray(); $dostukProgramList = \Model\Project\ModelName::where('dostuk', '=', '1')->lists('name', 'id')->toArray(); $birinchiProgramList = \Model\Project\ModelName::where('birinchi', '=', '1')->lists('name', 'id')->toArray(); $kyrgyzradioProgramList = \Model\Project\ModelName::where('kyrgyzradio', '=', '1')->lists('name', 'id')->toArray(); $tags = \Model\Tag\Tag::lists('name', 'id'); $tags2 = \Model\Tag\Tag::lists('name', 'id'); return view('Admin::post.edit', ['post' => $post, 'tags' => $tags, 'tags2' => $tags2, 'relatedPosts' => $relatedPosts, 'relatedPosts2' => $relatedPosts2, 'channelList' => $channelList, 'categoryList' => $categoryList, 'PhotoParentList' => $PhotoParentList, 'dostukProgramList' => $dostukProgramList, 'birinchiProgramList' => $birinchiProgramList, 'kyrgyzradioProgramList' => $kyrgyzradioProgramList]); }