コード例 #1
0
 public function run()
 {
     DB::table('news_category')->delete();
     $news_category = new NewsCategory();
     $news_category->language_id = 1;
     $news_category->user_id = 1;
     $news_category->title = "Lorem Ipsum";
     $news_category->save();
 }
コード例 #2
0
ファイル: NewsController.php プロジェクト: ryleto/nightjar
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function getEdit($id)
 {
     $news = News::find($id);
     $languages = Language::all();
     $language = $news->language_id;
     $newscategories = NewsCategory::all();
     $newscategory = $news->newscategory_id;
     return view('admin.news.create_edit', compact('news', 'languages', 'language', 'newscategories', 'newscategory'));
 }
コード例 #3
0
 public function index()
 {
     $title = "Dashboard";
     $news = News::count();
     $newscategory = NewsCategory::count();
     $users = User::count();
     $photo = Photo::count();
     $photoalbum = PhotoAlbum::count();
     $video = Video::count();
     $videoalbum = VideoAlbum::count();
     return view('admin.dashboard.index', compact('title', 'news', 'newscategory', 'video', 'videoalbum', 'photo', 'photoalbum', 'users'));
 }
コード例 #4
0
ファイル: News.php プロジェクト: adminarchitect/news
 public function filters()
 {
     return ['title' => ['type' => 'text'], 'status' => ['type' => 'select', 'options' => ['' => '--Any--'] + NewsItem::$statuses], 'news_category_id' => ['title' => 'Belongs to', 'type' => 'select', 'options' => ['' => '--Any--'] + NewsCategory::lists('title', 'id')->toArray(), 'query' => function ($query, $value = null) {
         return $query->whereIn('news_items.id', NewsItemCategory::where('news_category_items.news_category_id', (int) $value)->lists('news_item_id')->toArray());
     }]];
 }
コード例 #5
0
 /**
  * Reorder items
  *
  * @param items list
  * @return items from @param
  */
 public function getReorder(ReorderRequest $request)
 {
     $list = $request->list;
     $items = explode(",", $list);
     $order = 1;
     foreach ($items as $value) {
         if ($value != '') {
             NewsCategory::where('id', '=', $value)->update(array('position' => $order));
             $order++;
         }
     }
     return $list;
 }
コード例 #6
0
ファイル: NewsController.php プロジェクト: hilmysyarif/sic
 public function storeCategory(Request $request)
 {
     //$news2=Request::all();
     //News::create($news2);
     //return redirect('/admin/news');
     //
     $news2 = new NewsCategory(array('name' => Input::get('name')));
     $news2->save();
     return \Redirect::route('news.category', array($news2->id));
 }