/** * Display a listing of the resource. * * @return Response */ public function index() { // $news = News::all(); $auth = User::all(); return view('backend.pages.news.listNews', array('news' => $news, 'auth' => $auth)); }
/** * Display a listing of the news articles. * * @return Response */ public function index() { // get all $news = News::all(); // set response as json with data return Response()->json(['data' => $news, 'code' => 200], 200); }
public function news($page) { Carbon::setLocale('nl'); $posts = News::all()->count(); $pages = ceil($posts / 3); if ($page > $pages) { return redirect('nieuws/pagina-1'); } $news = News::latest()->skip(($page - 1) * 3)->take(3)->get(); return view('pages.public.news')->with(['news' => $news, 'page' => $page, 'pages' => $pages]); }
public function getAdminPanel() { $pageName = 'Dashboard'; $users = Sentry::findAllUsers(); $newUsers = new Collection($users); $userNumber = $newUsers->count(); $propertyNumber = Property::all()->count(); $soldPropertyNumber = Property::where('state', '=', 'sold')->count(); $newsNumber = News::all()->count(); return view('admin.adminIndex')->with(compact('pageName', 'userNumber', 'propertyNumber', 'soldPropertyNumber', 'newsNumber')); }
public function showNewsAction() { if (!Request::has('page_number')) { $page_number = 1; } else { $page_number = Request::input('page_number'); } $news = News::latest('created_at')->skip(($page_number - 1) * 5)->take(5)->get(); $news_amount = count(News::all()); return view('base.news', ['news' => $news, 'page_number' => $page_number, 'news_amount' => $news_amount]); }
public function index() { $totalNumber = 5; // number of items to take for each section $data = ["events" => Event::where('end_datetime', '>', date(time()))->get()->take($totalNumber), "partners" => Partner::all()->take($totalNumber), "news" => News::all()->take($totalNumber), "media" => Media::where('processed', 0)->get()->take($totalNumber * 2)->chunk(3), "staffs" => User::where('is_staff', 1)->get(), "locations" => Location::all()->take($totalNumber)]; $i = 0; foreach ($data['events'] as $event) { $mediaCount = count(Media::where('processed', false)->where('event_id', $event->id)->get()); $data['events'][$i]->mediaCount = $mediaCount; $i++; } return View::make('admin.index')->with($data); }
public function getAbout(Request $request) { if ($request->input('id') == null) { $news = News::all(); $about = About::first(); return view('home.about')->with(['news' => $news, 'about' => $about]); } else { $item = News::where('id', $request->input('id'))->first(); if ($item == null) { return redirect('about'); } return view('home.news')->with('item', $item); } }
/** * http://wiki.atlauncher.com/api:news * * @return Response */ public function v1News() { $data = array(); $i = 0; foreach (News::all() as $item) { if ($i >= 10) { break; } $dt = new DateTime($item->published_at); $data[$i] = array("title" => $item->title, "comments" => $item->comments, "link" => $item->link, "published_at" => $dt->format('U'), "content" => $item->content); $i++; } return Response::make(json_encode(array("error" => false, "code" => 200, "message" => null, "data" => $data), JSON_PRETTY_PRINT))->header('Content-Type', "application/json"); }
public function index($sort = 'departure') { $this->page->title = 'Заказы такси'; $this->page->desc = 'Текущие заказы'; $this->data['sort'] = $sort; if (Sentinel::inRole('admin')) { // АДМИНИСТРАТОР Новые и редактированные заказы $this->data['orders_new'] = Order::whereIn('order_status', array(1, 2))->orderBy('updated_at', 'desc')->get(); // АДМИНИСТРАТОР Текущие заказы if ($sort == 'arrivals') { // Сортировка по прилету $this->data['orders'] = Order::whereRaw('order_status = 3 AND (departure_time > now() OR arrivals_time > now())')->orderBy('arrivals_time')->get(); } else { // Сортировка по вылету $this->data['orders'] = Order::whereRaw('order_status = 3 AND (departure_time > now() OR arrivals_time > now())')->orderBy('departure_time')->get(); } // не олачено $this->data['nopay_orders'] = Order::whereRaw('order_status = 3 AND payment_status = 0 AND (departure_time < now() and arrivals_time < now())')->orderBy('departure_time')->get(); $news = News::all(); // \Session::flash('messages', count($news)); foreach ($news as $key => $val) { \Session::flash('flash_message_' . $key, $val->body); } // АДМИНИСТРАТОР отображение return $this->render('order.list-admin'); } else { // ПОЛЬЗОВАТЕЛЬ Текущие заказы $this->data['orders'] = Order::whereRaw('user_id = ' . $this->user->id . ' AND (departure_time > now() OR arrivals_time > now())')->orderBy('created_at', 'DESC')->get(); // не олачено $this->data['nopay_orders'] = Order::whereRaw('user_id = ' . $this->user->id . ' AND payment_status = 0 AND (departure_time < now() AND arrivals_time < now())')->orderBy('created_at', 'DESC')->get(); $news = News::all(); // \Session::flash('messages', count($news)); foreach ($news as $key => $val) { \Session::flash('flash_message_' . $key, $val->body); } // ПОЛЬЗОВАТЕЛЬ отображение return $this->render('order.list-user'); } }
/** * Отображает карту сайта в нужном формате формате. * * @return \Illuminate\Http\Response */ public function getIndex($format = 'xml', $cached = true) { // Проверка формата вывода данных if (!in_array($format, ['xml', 'html', 'txt', 'ror-rss', 'ror-rdf'])) { abort(404); } // Объект карты сайта $sitemap = App::make('sitemap'); // Кэш карты сайта $sitemap->setCache('laravel.sitemap', 3600, (bool) $cached); // Проверка закеширована ли карта сайта, если нет - "строим" заново if (!$sitemap->isCached()) { // Добавление страниц с постоянными ссылками $sitemap->add(URL::to('/')); $sitemap->add(URL::to('companies/sika/about')); $sitemap->add(URL::to('companies/sika/catalog')); $sitemap->add(URL::to('companies/sfs/about')); $sitemap->add(URL::to('companies/sfs/catalog')); //$sitemap->add(URL::to('companies/sfs/videos')); $sitemap->add(URL::to('companies/primer/about')); $sitemap->add(URL::to('companies/primer/catalog')); //$sitemap->add(URL::to('companies/primer/videos')); $sitemap->add(URL::to('companies/primer/price-list')); // Добавление страниц групп категорий и категорий всех трёх компаний foreach (['sika', 'sfs', 'primer'] as $company) { $groupCategories = GroupsCategory::whereEnabled(TRUE)->with(['categories' => function ($q) { $f = function ($q) { $q->whereEnabled(TRUE); }; $q->whereEnabled(TRUE)->with(['products_sika' => $f, 'products_sfs' => $f, 'products_primer' => $f]); }])->whereHas('company', function ($q) use($company) { $q->whereShortTitle($company); })->get(); // Проходим по группам категорий foreach ($groupCategories as $groupCategory) { // Добавление группы категорий $sitemap->add(URL::to("companies/{$company}/catalog/group/{$groupCategory->id}")); // Добавление категории foreach ($groupCategory->categories as $category) { $sitemap->add(URL::to("companies/{$company}/catalog/category/{$category->id}")); // Добавление товаров для каждой категории foreach ($category->products_sika as $productSika) { // Ссылка на страницу продукта $sitemap->add(URL::to("companies/{$company}/catalog/show/{$productSika->id}")); // Ссылка на техкарту //$sitemap->add(URL::to("assets/img/products/{$company}/tech-carts/{$productSika->tech_cart_file}")); } foreach ($category->products_sfs as $productSfs) { // Ссылка на страницу продукта $sitemap->add(URL::to("companies/{$company}/catalog/show/{$productSfs->id}")); // Ссылка на pdf //$sitemap->add(URL::to("assets/img/products/{$company}/pdf/{$productSfs->file_name}")); } foreach ($category->products_primer as $productPrimer) { $sitemap->add(URL::to("companies/{$company}/catalog/show/{$productPrimer->id}")); } } } // Галереи /*$galleryImages = Gallery::whereHas('company', function ($query) use ($company) { $query->whereShortTitle($company); })->get(); $images = []; // Массив описаний изображений для Sitemap foreach($galleryImages as $image) { $images[] = [ 'url' => URL::to('assets/img/galleries/'.$image->file_name), 'title' => $image->title, ]; } $sitemap->add(URL::to("galleries/show/{$company}"), null, null, null, $images);*/ } /*$certificates = Certificate::all(); $imagesCertificates = []; // Массив описаний изображений для сертификатов foreach($certificates as $certificate) { $imagesCertificates[] = [ 'url' => URL::to('assets/img/certificates/'.$certificate->file_name), 'title' => $certificate->title, ]; } $sitemap->add(URL::to('certificates'), null, null, null, $imagesCertificates);*/ $sitemap->add(URL::to('news')); // Добавляем все статьи новостей $news = News::all(); foreach ($news as $item) { $sitemap->add(URL::to('news/show/' . $item->id)); } $sitemap->add(URL::to('contacts')); } // Отображение карты сайта return $sitemap->render($format); }
/** * Display a listing of news * * @param Request $request * * @return \Illuminate\View\View */ public function index(Request $request) { $news = News::all(); return view('admin.news.index', compact('news')); }
use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Storage; use App\News; // Meta $app->get('/meta', function () { $ships = json_decode(Storage::disk('local')->get('api_ships.json'), false)->results; $maps = json_decode(Storage::disk('local')->get('api_maps.json'), false)->results; $equips = json_decode(Storage::disk('local')->get('api_equips.json'), false)->results; return view('meta')->withShips($ships)->withMaps($maps)->withEquips($equips); }); // API $app->get('/news', function () { $news = News::all(); return response()->json($news); }); $app->post('/news', function (Request $request) { if (!Auth::check()) { return redirect('/login'); } $rules = ['title' => 'required|max:256', 'ship' => 'array', 'quest' => 'array', 'content' => 'max:1024', 'equip' => 'array']; $validator = Validator::make($request->all(), $rules); if ($validator->fails()) { return redirect('/')->withErrors($validator); } $ship = $request->input('ship') ? join(',', $request->input('ship')) : ''; $quest = $request->input('quest') ? join(',', $request->input('quest')) : ''; $equip = $request->input('equip') ? join(',', $request->input('equip')) : ''; News::create(['title' => $request->input('title'), 'ship' => $ship, 'equip' => $equip, 'quest' => $quest, 'content' => $request->input('content')]);
public function postDeleteNews($id) { $news = News::findOrFail($id); $news->delete(News::all()); return redirect('nieuws'); }
/** * Отображает список новостей * * @return Response */ public function getIndex() { $data['news'] = News::all(); return view('admin.news.index', $data); }
public function index() { $news = News::all(); $news = News::paginate(3); return View::make('admin.admin-editor')->with('news', $news); }
public function getIndex() { $news = News::all(); return view('admin.news.news')->with('news', $news); }
/** * Показать все новости. * */ public function getNews() { $news = News::all(); return view('app', compact('news')); }
/** * Display a pages list. * * @return Response */ public function news() { $news = News::all(); return view('util.index', compact('news')); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $all_news = News::all(); return view('admin.news', ['all_news' => $all_news]); }
/** * Get the news page * * @return JSON of all articles */ public function getNewsArchive() { return \App\News::all(); }
public function index() { $news = News::all(); return view('news')->with('news', $news); }
public function listNews() { $news = News::all(); $newsList = ""; $i = 0; foreach ($news as $item) { $updateLink = url('news/' . $item->id . '/edit'); $deleteLink = route('news.delete', ['id' => $item->id]); $rowData = "<td>" . $item->id . "</td><td>" . $item->types . "</td><td>" . $item->author . "</td><td>" . $item->title . "</td><td>" . $item->created_at . "</td><td>" . $item->updated_at . "</td><td><a href=" . $deleteLink . " class=\"btn btn-primary\" role=\"button\">delete</a></td><td><a href=\"" . $updateLink . "\" class=\"btn btn-primary\" role=\"button\">update</a></td>"; if ($i % 2 === 0) { $rowOutput = "<tr class=\"even\">" . $rowData . "</tr>"; } else { $rowOutput = "<tr class=\"odd\">" . $rowData . "</tr>"; } $newsList = $newsList . $rowOutput; $i++; } return view('admin.newsList')->with(['pageName' => 'All The News', 'newsList' => $newsList]); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(Model $objects) { $objects_for_filter = Model::all(); return view('admin.news.list', ['objects' => $objects->paginate(10), 'objects_for_filter' => $objects_for_filter]); }