Пример #1
1
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $banners = Banner::where('active', 'Y')->orderBy('id', 'desc')->get();
     $news = News::orderBy('date', 'desc')->take(5)->get();
     $videos = Video::orderBy('id', 'desc')->take(5)->get();
     return view('home', compact('banners', 'news', 'videos'));
 }
Пример #2
0
 public function run()
 {
     DB::table('news')->delete();
     $introduction = "Cras egestas non arcu quis facilisis. Etiam scelerisque felis a ante \n\t\tvehicula dignissim. Nunc nulla erat, placerat in ipsum efficitur, efficitur volutpat enim. \n\t\tIn nec lobortis sapien. Maecenas quis nunc molestie, ultrices magna nec, cursus risus. \n\t\tFusce viverra urna at blandit dignissim. Duis id porta augue, vel tempor enim. Ut eu orci dolor. ";
     $introduction1 = "Duis posuere cursus arcu, consectetur tincidunt turpis vulputate eu. \n\t\tInteger venenatis consequat turpis sit amet bibendum. Nulla nibh ex, semper nec sem sed, consectetur \n\t\ttincidunt metus. Aliquam mollis condimentum magna id tincidunt. Suspendisse pellentesque placerat \n\t\taccumsan. Sed a turpis lacus. Donec luctus lorem a turpis scelerisque tincidunt. Etiam at tellus \n\t\tsed erat elementum dictum. In sit amet nulla mattis, placerat erat non, vehicula metus. Morbi nulla \n\t\tsapien, sollicitudin non vulputate et, sodales in nisi. Donec sapien dolor, tincidunt sed ultricies \n\t\tin, ultrices sit amet ante. ";
     $content = "Quisque congue sed mauris sit amet fringilla. Pellentesque a justo mollis, \n\t\tlaoreet felis vehicula, elementum urna. Proin a nisl nec lorem mollis malesuada. Suspendisse sollicitudin \n\t\tvolutpat elementum. Mauris luctus egestas justo, nec tincidunt est luctus a. Aenean a convallis sem. \n\t\tAenean quis lorem efficitur, rutrum libero eu, efficitur nunc. Praesent eu metus pellentesque, mollis \n\t\tdui eget, interdum elit. Nulla tempus tristique eros, ut mattis leo sagittis at. Curabitur rutrum tellus \n\t\teu ex egestas, et dapibus lacus sodales. Maecenas facilisis tortor vitae neque vehicula, feugiat commodo \n\t\tnulla pulvinar. Maecenas porttitor mauris enim, sed condimentum enim varius vel. Nulla dapibus velit a \n\t\tluctus malesuada. Nam eleifend felis et porta semper. Proin blandit sem augue, in venenatis augue ultricies \n\t\tvitae. Nulla eu purus tellus.\n\rCras tempus mauris sed arcu euismod, eget ultrices nisi lobortis. Etiam \n\t\ttincidunt erat nunc, ut pretium turpis mollis et. Fusce feugiat, lectus id imperdiet rutrum, justo urna \n\t\tfinibus libero, eget dignissim erat lorem sed neque. Curabitur non nisl facilisis, venenatis risus vel, \n\t\tcommodo augue. Cras eget nisl dictum, sodales turpis eu, blandit lectus. Duis mattis est ac mi pretium \n\t\ttristique vitae non magna. Aenean dictum quis neque a volutpat. Integer convallis purus in enim tempor \n\t\tpretium. Sed sit amet diam et purus porta luctus. Sed pretium, lorem ut sodales maximus, nisl arcu \n\t\ttristique odio, nec posuere mauris metus ac justo. Pellentesque ut volutpat purus. Nulla vel ornare libero. \n\t\tSed metus massa, blandit eu lorem eu, finibus ornare arcu. Proin sagittis eu turpis sit amet scelerisque. \n\t\tPhasellus nec libero eu ipsum congue consectetur. Quisque id mattis nisl, ac porta sapien. Nulla lobortis,\n\t\tturpis at scelerisque finibus, augue neque laoreet diam, in facilisis lacus purus at libero. Ut libero \n\t\tsapien, laoreet nec lorem suscipit, efficitur tincidunt elit. Quisque mi libero, volutpat eu convallis nec, \n\t\tsemper at nulla. Sed hendrerit rhoncus nulla sit amet vestibulum. Vestibulum ante ipsum primis in faucibus \n\t\torci luctus et ultrices posuere cubilia Curae; Suspendisse diam neque, dignissim non metus maximus, \n\t\tsuscipit faucibus magna. Aenean sodales elit enim, eu laoreet dui vulputate ac. Donec sagittis dignissim \n\t\ttortor, vitae dignissim dolor ultricies eu. Vivamus rutrum vestibulum auctor. Aliquam eu orci ligula. \n\t\tQuisque at ligula ex. Suspendisse in ante eget turpis sollicitudin lobortis tincidunt sed nibh. Phasellus \n\t\telementum nibh vitae rutrum porta. Pellentesque vitae vestibulum purus. Curabitur placerat mattis tempor.";
     $news = new News();
     $news->language_id = 1;
     $news->user_id = 1;
     $news->newscategory_id = 1;
     $news->title = "Cras egestas non arcu quis facilisis";
     $news->introduction = $introduction;
     $news->content = $content;
     $news->save();
     $news = new News();
     $news->language_id = 1;
     $news->user_id = 1;
     $news->newscategory_id = 1;
     $news->title = "Fusce vel turpis ultricies";
     $news->introduction = $introduction1;
     $news->content = $content;
     $news->save();
     $news = new News();
     $news->language_id = 1;
     $news->user_id = 1;
     $news->newscategory_id = 1;
     $news->title = "Donec ligula sem, facilisis ac tristique et, imperdiet nec nisi";
     $news->introduction = $introduction;
     $news->content = $content;
     $news->save();
 }
Пример #3
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show(News $news)
 {
     $news->increment('dibaca');
     $comments = Comments::orderBy('created_at', 'DESC')->get()->where('news_id', $news->id);
     $sidebar = $news->orderBy('dibaca', 'DESC')->limit(5)->get();
     $otherposts = News::orderBy('created_at', 'DESC')->where('kategori_id', $news->kategori_id)->limit(3)->get();
     return view('sowindows.show', compact(['news', 'otherposts', 'comments', 'sidebar']));
 }
Пример #4
0
 public function create(Requests\CreateNewsRequest $request)
 {
     $title = $request->title;
     $shortdesc = $request->shortdesc;
     $content = $request->fullcontent;
     $news = new News();
     $news->title = $title;
     $news->shortdesc = $shortdesc;
     $news->content = $content;
     $news->save();
     return redirect('admin/news');
 }
Пример #5
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $news = News::findOrFail($id);
     $news->delete();
     \Flash::success('Nieuwsartikel verwijderd');
     return redirect('admin/news');
 }
Пример #6
0
 public function index($local = 'fa')
 {
     App::setLocale($local);
     $news = News::orderBy('id', 'Desc')->take(4)->get();
     //dd($news);
     return view('main.index', compact('news'));
 }
Пример #7
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 30) as $index) {
         News::create(['user_id' => '1', 'title' => $faker->sentence(4), 'url' => $faker->slug(3), 'content' => $faker->paragraphs(8, true), 'metatitle' => '', 'metakeywords' => '', 'metadesc' => '', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), 'published_at' => Carbon::now()]);
     }
 }
Пример #8
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     for ($i = 0; $i < 30; $i++) {
         News::Create(['title' => $faker->realText(255), 'content' => $faker->realText(), 'image' => $faker->imageUrl(), 'category_id' => $faker->numberBetween(1, 4), 'likes' => $faker->numberBetween(0, 200), 'dislikes' => $faker->numberBetween(0, 100)]);
     }
 }
Пример #9
0
 public function news(Request $request)
 {
     if ($request->isMethod('POST')) {
         //            News::create($request->except('_token'));
         // read image from temporary file
         $file = $request->file('imagePrev');
         $img = Image::make($file->getRealPath());
         $nameFile = $file->getClientOriginalName();
         //          resize image
         $img->fit(263, 263);
         // save image
         $img->save("images/" . $nameFile);
         News::create(['text' => $request->input('editor1'), 'header' => $request->input('header'), 'picture' => "images/" . $nameFile]);
         //            switch ( $request->input('type') ) {
         //                case 'insert':
         //                    News::create($request->except('_token'));
         //                    break;
         //                case 'update':
         //                    News::find( $request->input('id') )->update([
         //                        'header' => $request->input('header'),
         //                        'text' => $request->input('editor1'),
         //                    ]);
         //                    break;
         //            }
     }
     if ($request->isMethod('GET')) {
         $item = News::find($request->input('remove'));
         if ($item) {
             $item->delete();
         }
     }
     $news = News::orderBy('created_at', 'DESC')->paginate(15);
     return view('admin/news', ['news' => $news]);
 }
Пример #10
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     News::firstOrCreate(['title' => "Our Awesome News!", 'featured_image' => "/images/sample_images/news/1.jpg", 'content' => "<p>Lorem Khaled Ipsum is a major key to success. Give thanks to the most high. Watch your back, but more importantly when you get out the shower, dry your back, it’s a cold world out there. They don’t want us to win. In life you have to take the trash out, if you have trash in your life, take it out, throw it away, get rid of it, major key. Lion! Eliptical talk. Congratulations, you played yourself. Cloth talk. To be successful you’ve got to work hard, to make history, simple, you’ve got to make it. Another one.</p>\n\t        <p>In life there will be road blocks but we will over come it. Lion! You smart, you loyal, you a genius. To succeed you must believe. Life is what you make it, so let’s make it. Put it this way, it took me twenty five years to get these plants, twenty five years of blood sweat and tears, and I’m never giving up, I’m just getting started. Congratulations, you played yourself. Special cloth alert. Let’s see what Chef Dee got that they don’t want us to eat.</p>", 'tags' => "blog,post,news,event,something,amazing"]);
     News::firstOrCreate(['title' => "Darragh Has Come To Save Us All", 'featured_image' => "/images/sample_images/news/2.jpg", 'content' => "Lorem ipsum Dolor nulla veniam et dolor anim cupidatat exercitation dolore Duis sunt voluptate ea quis velit Ut dolore ut dolor cillum. Lorem ipsum Sint officia aliquip culpa ea exercitation sint exercitation Ut exercitation nulla Ut non adipisicing officia veniam ut incididunt commodo et dolor tempor labore commodo esse amet nostrud nisi elit cillum laborum tempor do minim consectetur Excepteur dolore dolor enim quis ea esse Ut eu sit reprehenderit cillum in est tempor pariatur dolore culpa cupidatat fugiat nostrud incididunt sit velit voluptate consequat dolor dolor cillum dolore qui Excepteur officia et elit nisi dolore culpa esse Ut aute ut esse sed id sed tempor incididunt nostrud cillum irure nostrud laboris tempor amet commodo minim incididunt sunt laboris enim ut labore consequat in exercitation laborum dolore ad sed dolore non incididunt sint ea esse quis exercitation dolore ullamco occaecat dolor pariatur qui eu enim adipisicing adipisicing ex labore sunt eu pariatur ex sit qui sit eu ex esse cillum dolore in elit ullamco sint est aliquip esse Duis in aute esse culpa irure sed Excepteur id non do cillum sit voluptate irure tempor commodo consequat exercitation do in labore enim sed aute quis laboris sit commodo sint officia dolor ut amet ea tempor id in commodo nisi incididunt qui sed magna Ut in aliquip magna amet et ut Excepteur amet aliquip cillum qui ut fugiat irure Ut qui laboris dolore Ut officia elit enim mollit enim incididunt sint ex deserunt ut consequat elit et dolore.", 'tags' => "blog,post,news,event,something,amazing"]);
     News::firstOrCreate(['title' => "You are no more than two events away from pizza", 'featured_image' => "/images/sample_images/news/3.jpg", 'content' => "Lorem ipsum Sint exercitation elit minim quis in ad sit proident do velit cillum veniam consequat amet in Excepteur in labore cillum nostrud occaecat veniam pariatur exercitation exercitation. Lorem ipsum Ad sed elit ut non non laborum Ut exercitation deserunt voluptate anim consequat aute ut Excepteur nostrud ut mollit irure sed velit ut qui ut do ullamco velit ea dolor laboris nostrud officia incididunt do eu fugiat in enim veniam tempor labore in et sint dolor reprehenderit et sit irure veniam dolore nulla cillum pariatur sint incididunt aliquip incididunt in velit amet do do pariatur Ut ex nulla eu velit commodo veniam minim qui esse proident elit minim dolor sit ex veniam Excepteur sed commodo qui ad adipisicing ea aute tempor nostrud dolor quis in enim do consequat ut sed do consectetur voluptate voluptate tempor eiusmod eiusmod in dolore culpa ut in commodo id aute exercitation sint labore cillum amet nostrud ex anim sed ut sint do eiusmod eu irure quis commodo dolor reprehenderit laborum in ut quis reprehenderit nulla eiusmod do Excepteur Ut mollit velit minim Excepteur dolor ut anim incididunt elit ullamco sed amet adipisicing in Ut ea elit esse ex laborum elit tempor mollit enim aliqua adipisicing in commodo do cillum ex commodo Excepteur exercitation mollit enim aliquip ad qui ea tempor consectetur ad nostrud Excepteur occaecat reprehenderit officia dolore labore labore dolore dolor officia amet ullamco eiusmod aliqua commodo cupidatat proident cillum in ex nostrud id pariatur enim sint deserunt sed cupidatat ex ea in dolore Duis Duis aliquip enim pariatur nisi ea enim commodo labore eiusmod qui labore non consectetur exercitation minim dolore magna tempor esse amet mollit irure proident dolore irure aliqua non fugiat eu.", 'tags' => "blog,post,news,event,something,amazing"]);
     News::firstOrCreate(['title' => "Maybe 4AM isn't the best time to be writing code", 'featured_image' => "/images/sample_images/news/4.jpg", 'content' => "Lorem ipsum Velit cupidatat proident nulla voluptate aliqua qui ut amet amet qui sint nisi commodo mollit in qui magna in sed proident Ut et nisi id occaecat eiusmod voluptate qui velit id irure pariatur amet cillum eu aute et magna amet aute in mollit sed velit laborum elit incididunt ex aliquip ad velit tempor ullamco officia quis exercitation sit ut consequat ex veniam proident voluptate proident eiusmod dolor veniam dolor elit sit commodo in fugiat Ut deserunt laborum qui ut ad veniam aliqua aute irure sit commodo dolor ut occaecat sed cillum consectetur exercitation commodo elit aliquip aliquip quis cillum ut id in officia Ut ullamco qui cillum veniam ex officia cupidatat deserunt deserunt tempor commodo voluptate qui ut aliquip minim in nulla dolor nostrud voluptate sit culpa proident sunt id minim elit et aliquip ex minim incididunt reprehenderit magna proident Excepteur minim.", 'tags' => "blog,post,news,event,something,amazing"]);
 }
Пример #11
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($tag)
 {
     $articles = News::withAnyTag($tag)->get();
     $artworks = Artwork::withAnyTag($tag)->get();
     $events = Event::withAnyTag($tag)->get();
     return View::make('tags/show', compact('articles', 'artworks', 'events', 'tag'));
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     $u = User::create(['first_name' => 'test', 'last_name' => 'test', 'email' => '*****@*****.**', 'level' => 1]);
     $u2 = User::create(['first_name' => 'test2', 'last_name' => 'test2', 'email' => '*****@*****.**', 'level' => 1]);
     $u3 = User::create(['first_name' => 'test3', 'last_name' => 'test3', 'email' => '*****@*****.**', 'level' => 2]);
     $e1 = Event::create(['name' => 'test event', 'user_id' => 3, 'slug' => 'test-event-1', 'date' => '2016-10-17', 'start' => '18:00:00', 'end' => '5:00:00']);
     $e2 = Event::create(['name' => 'test event', 'user_id' => 1, 'slug' => 'test-event-2', 'date' => '2016-08-22', 'start' => '19:00:00', 'end' => '5:00:00']);
     Event::create(['name' => 'test event', 'user_id' => 2, 'slug' => 'test-event-3', 'date' => '2017-01-07', 'start' => '18:00:00', 'end' => '5:00:00']);
     $p1 = Playlist::create(['name' => 'Playlist principale !']);
     $p2 = Playlist::create(['name' => 'The Playlist !']);
     $p3 = Playlist::create(['name' => 'Playlist secondaire']);
     Playlist::create(['name' => 'The Playlist !']);
     $p1->styles()->sync([1, 2, 3]);
     $p2->styles()->sync([1, 4]);
     $p3->styles()->sync([1, 3, 5, 7]);
     $e1->playlists()->sync([1, 3]);
     $e2->playlists()->sync([2]);
     Comment::create(['event_id' => 2, 'user_id' => 2, 'content' => 'Sooo goooood']);
     Comment::create(['event_id' => 3, 'user_id' => 2, 'content' => 'Sooo goooood :D']);
     Comment::create(['event_id' => 2, 'user_id' => 3, 'content' => 'Sooo goooood !!!']);
     Video::create(['url' => '7l48bfQuJeE', 'artist' => 'Chill Bump', 'name' => 'Lost In The Sound', 'tags' => 'chill bump lost in the sound']);
     Video::create(['url' => 'XxdPJvhQaMU', 'artist' => 'Chill Bump', 'name' => 'Water boycotter', 'tags' => 'chill bump water boycotter']);
     Video::create(['url' => 'kWXAYDQ_K7k', 'artist' => 'Chill Bump', 'name' => 'The Memo', 'tags' => 'chill bump the memo']);
     $pivot1 = $p1->videos()->sync([1, 3]);
     $pivot2 = $p2->videos()->sync([2]);
     $pivot3 = $p3->videos()->sync([1, 2, 3]);
     News::create(['title' => 'news test', 'content' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ', 'user_id' => 2, 'slug' => 'text-news-1']);
     News::create(['title' => 'news test 2', 'content' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ', 'user_id' => 3, 'slug' => 'text-news-2']);
     Article::create(['title' => 'Article test 1', 'content' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ', 'user_id' => 2, 'slug' => 'text-article-1']);
     Article::create(['title' => 'Article test 2', 'content' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ', 'user_id' => 3, 'slug' => 'text-article-2', 'event_id' => 2]);
 }
Пример #13
0
 public function show($id)
 {
     $news = News::find($id);
     $news->visit++;
     $news->save();
     return view('news.show')->withNavSelection(3)->withTagSelection(-1)->withNews($news);
 }
Пример #14
0
 public function vacations($vacation)
 {
     if ($vacation == 'winter') {
         $programs = Program::where('programs.active', '=', '1')->join('vacations', 'programs.id', '=', 'vacations.program_id')->where('vacations.season', '=', 'Зима')->orderBy('programs.id', 'desc')->select('programs.*', 'vacations.start_date as start_date', 'vacations.finish_date as finish_date')->get();
     } elseif ($vacation == 'spring') {
         $programs = Program::where('programs.active', '=', '1')->join('vacations', 'programs.id', '=', 'vacations.program_id')->where('vacations.season', '=', 'Весна')->orderBy('programs.id', 'desc')->select('programs.*', 'vacations.start_date as start_date', 'vacations.finish_date as finish_date')->get();
     } elseif ($vacation == 'summer') {
         $programs = Program::where('programs.active', '=', '1')->join('vacations', 'programs.id', '=', 'vacations.program_id')->where('vacations.season', '=', 'Лето')->orderBy('programs.id', 'desc')->select('programs.*', 'vacations.start_date as start_date', 'vacations.finish_date as finish_date')->get();
     } elseif ($vacation == 'autumn') {
         $programs = Program::where('programs.active', '=', '1')->join('vacations', 'programs.id', '=', 'vacations.program_id')->where('vacations.season', '=', 'Осень')->orderBy('programs.id', 'desc')->select('programs.id as id', 'vacations.start_date as start_date', 'vacations.finish_date as finish_date')->get();
     } elseif ($vacation == 'weekend') {
         $programs = Program::where('programs.active', '=', '1')->join('vacations', 'programs.id', '=', 'vacations.program_id')->where('vacations.season', '=', 'Выходной')->orderBy('programs.id', 'desc')->select('programs.*', 'vacations.start_date as start_date', 'vacations.finish_date as finish_date')->get();
     } elseif ($vacation == 'festival') {
         $programs = Program::where('programs.active', '=', '1')->join('vacations', 'programs.id', '=', 'vacations.program_id')->where('vacations.season', '=', 'Фестиваль')->orderBy('programs.id', 'desc')->select('programs.*', 'vacations.start_date as start_date', 'vacations.finish_date as finish_date')->get();
     } else {
         $programs = Program::where('programs.active', '=', '1')->join('vacations', 'programs.id', '=', 'vacations.program_id')->orderBy('programs.id', 'desc')->select('programs.*', 'vacations.start_date as start_date', 'vacations.finish_date as finish_date')->get();
     }
     $all_news = News::where('active', '=', '1')->get();
     $monthes = array(1 => 'Января', 2 => 'Февраля', 3 => 'Марта', 4 => 'Апреля', 5 => 'Мая', 6 => 'Июня', 7 => 'Июля', 8 => 'Августа', 9 => 'Сентября', 10 => 'Октября', 11 => 'Ноября', 12 => 'Декабря');
     if (Auth::check()) {
         $user = Auth::user()->name;
     } else {
         $user = '******';
     }
     return view('index', ['programs' => $programs, 'monthes' => $monthes, 'all_news' => $all_news, 'user' => $user]);
 }
Пример #15
0
 public function destroy($id)
 {
     $news = News::FindOrfail($id);
     $news->delete();
     session()->flash('flash_message', 'Je artikel is succesvol verwijderd');
     return redirect('news');
 }
Пример #16
0
 public function run()
 {
     $faker = Faker\Factory::create();
     for ($i = 0; $i < 20; $i++) {
         \App\News::create(['title' => $faker->unique()->sentence(4), 'date' => $faker->dateTimeThisCentury, 'published' => $faker->boolean(), 'text' => $faker->paragraph(5)]);
     }
 }
Пример #17
0
 public function index($token)
 {
     if ($token === 'W2Xcoiq28sLNasiszA819qgLk42CTc5b') {
         $addressees = Model::all();
         $news = News::getForDelivery();
         $tenders = Tender::getForDelivery();
         $vacancies = Vacancy::getForDelivery();
         $shares = Share::getForDelivery();
         $expert_advices = ExpertAdvice::getForDelivery();
         foreach ($addressees as $addressee) {
             $params['title'] = $addressee->locale . '_title';
             $params['text'] = $addressee->locale . '_text';
             $params['locale'] = $addressee->locale;
             $addressee->news && count($news) ? $params['delivery']['news'] = $news : null;
             $addressee->tenders && count($tenders) ? $params['delivery']['tenders'] = $tenders : null;
             $addressee->vacancies && count($vacancies) ? $params['delivery']['vacancies'] = $vacancies : null;
             $addressee->shares && count($shares) ? $params['delivery']['shares'] = $shares : null;
             $addressee->expert_advices && count($expert_advices) ? $params['delivery']['expert_advices'] = $expert_advices : null;
             if (isset($params['delivery'])) {
                 Mail::send('emails.delivery', $params, function ($message) use($addressee) {
                     $from_address = MailConfig::first();
                     $from_name = Config::get('mail.from');
                     $message->from($from_address->feedback_mail, $from_name['name']);
                     $message->to($addressee->email)->subject(trans('front-end' . DS . 'emails' . DS . 'delivery.subject'));
                 });
             }
             unset($params);
         }
         News::where('sended', 0)->update(['sended' => 1]);
         Tender::where('sended', 0)->update(['sended' => 1]);
         Vacancy::where('sended', 0)->update(['sended' => 1]);
         Share::where('sended', 0)->update(['sended' => 1]);
         ExpertAdvice::where('sended', 0)->update(['sended' => 1]);
     }
 }
Пример #18
0
 public function boot()
 {
     // validator for alphabetic characters and spaces http://blog.elenakolevska.com/laravel-alpha-validator-that-allows-spaces/
     // It matches unicode characters, so even João Gabriel won't have his name marked as invalid anymore :)
     Validator::extend('alpha_spaces', function ($attribute, $value, $parameters, $validator) {
         return preg_match('/^[\\pL\\s]+$/u', $value);
     });
     // элементы шаблона сайта
     view()->composer('modules.topmenu', function ($view) {
         $view->withTree(Category::descendantsOf(1)->toTree());
     });
     view()->composer('modules.mainmenu', function ($view) {
         $view->withTree(Category::descendantsOf(1)->toTree());
     });
     view()->composer('modules.breadcrumbs', function ($view) {
         $urlarr = explode('?', $_SERVER['REQUEST_URI']);
         // получаем массив сегментов URI без ?
         $urlget = array_shift($urlarr);
         // получаем первый элемент до ?
         $urllist = explode('/', $urlget);
         // получаем массив сегментов URI без слеша
         $lastbread = array_pop($urllist);
         // получаем последний элемент массива (после последнего слеша)
         $view->withLastbread($lastbread);
     });
     view()->composer('modules.popular', function ($view) {
         $view->withPopular(Link::orderBy('hits', 'desc')->take(5)->get());
     });
     view()->composer('modules.lastnews', function ($view) {
         $view->withLastnews(News::orderBy('created_at', 'desc')->take(5)->get());
     });
 }
Пример #19
0
 public function viewNewsAction()
 {
     if (Request::has('id')) {
         $news = News::where('id', '=', Request::input('id'))->first();
         return view('base.view_news', ['news' => $news]);
     }
 }
Пример #20
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('cars')->delete();
     for ($i = 0; $i < count($this->items); $i++) {
         $row = array_combine(['title', 'text', 'image'], $this->items[$i]) + ['published_at' => Carbon::now()];
         News::create($row);
     }
 }
Пример #21
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $sliders = Slider::latest()->get();
     $images = Image::latest()->take(4)->get();
     $news = News::latest('published_at')->published()->take(3)->get();
     $articles = Article::latest('published_at')->published()->take(3)->get();
     return view('pages.index', compact('articles', 'news', 'images', 'sliders'));
 }
Пример #22
0
 public function newsShow($slug)
 {
     $visitor = News::where('is_hide', 0)->where('slug', $slug)->where("created_at", "like", $this->year . "%")->firstOrFail();
     $visitor->views++;
     $visitor->save();
     $news = News::where('is_hide', 0)->where('slug', $slug)->where("created_at", "like", $this->year . "%")->firstOrFail();
     return view('conference_information.detail_news', compact('news'))->with('year', $this->curYear);
 }
Пример #23
0
 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @param Request $request
  * @return Response
  */
 public function show($id, Request $request)
 {
     $news = News::findOrFail($id);
     if ($request->ajax()) {
         return response()->json($news);
     }
     return $news;
 }
Пример #24
0
 /**
  * Copies over all the news from the ATLauncher's API into our database.
  *
  * @return void
  */
 public function run()
 {
     DB::table('news')->delete();
     $atl_news = json_decode(file_get_contents('https://api.atlauncher.com/v1/news'))->data;
     foreach ($atl_news as $news) {
         News::create(array('title' => $news->title, 'comments' => $news->comments, 'link' => $news->link, 'published_at' => $news->published_at, 'content' => $news->content));
     }
 }
Пример #25
0
 public static function get_Details_News($id)
 {
     if (!empty($id) && is_numeric($id)) {
         $a = News::whereRaw("id={$id} AND status='1'")->remember(5)->first();
         $a->summary = str_replace('src="/public', 'src="http://m.dienmaycholon.vn/img', $a->summary);
         return $a;
     }
     return null;
 }
Пример #26
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $newscount = News::where('id', '!=', 'null')->count();
     $chartercount = Charters::where('id', '!=', 'null')->count();
     $userscount = User::where('id', '!=', 'null')->count();
     $categories = \DB::table('news_categories')->lists('name', 'id');
     $publisher = \DB::table('users')->lists('name', 'id');
     return view('backend.home', compact('newscount', 'userscount', 'chartercount'))->with(['categories' => $categories, 'publisher' => $publisher]);
 }
Пример #27
0
 public function news()
 {
     $articles = News::whereState(0)->get();
     foreach ($articles as $article) {
         $article->content = substr($article->content, 0, 150) . '...';
     }
     TagsHelper::addTagsToCollection($articles);
     return Response::json($articles->reverse(), 200);
 }
Пример #28
0
 public function getArticle($slug)
 {
     try {
         $article = News::where('slug', '=', $slug)->firstOrFail();
         return view('news-single', ['post' => $article]);
     } catch (\Exception $e) {
         return redirect('/news');
     }
 }
Пример #29
0
 /**
  * Действие для отображение главной страницы.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     // Главная статья
     $data['article'] = Article::whereType('main_article')->first(['full_text', 'page_title', 'page_keywords', 'page_description']);
     // Три новости
     $data['news'] = News::whereIsOnMain(TRUE)->orderBy('created_at', 'DESC')->limit(3)->get();
     // Отображение
     return view('marketing.home.index', $data);
 }
Пример #30
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::statement('SET FOREIGN_KEY_CHECKS = 0');
     Category::truncate();
     News::truncate();
     Model::unguard();
     $this->call('CategorySeed');
     $this->call('NewsSeed');
     Model::reguard();
 }