Пример #1
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $news = News::with('langs');
     if (!$this->systemAdmin) {
         $news->where('department_id', auth()->user()->department_id);
     }
     if (session('department_filter_id')) {
         $news = $news->where('department_id', session('department_filter_id'));
     }
     $news = $news->sort()->get();
     $this->loadLangs($news);
     return view('admin.news.index', ['title' => trans('static.news'), 'url' => action('Admin\\NewsController@create'), 'news' => $news]);
 }
Пример #2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $news = News::with('categories')->where('id', $id)->first();
     return view('dashboard/edit_news')->with('categories', Category::get())->with("news", $news);
 }
Пример #3
0
 /**
  * @return mixed
  */
 public function index()
 {
     return view('news.index')->withAllnews($this->news->with('photo')->with('user')->latest()->paginate(10));
 }