Ejemplo n.º 1
0
 public function create()
 {
     //        dd(\Session::all());
     $model = new Portal();
     $portals = $model->getPortals(["parent" => 0]);
     if ($portals && is_array($portals)) {
         foreach ($portals as $portal) {
             switch ($portal->name) {
                 case '今日要闻':
                     $positions[2] = $portal->id;
                     break;
                 case '图片新闻':
                     $positions[4] = $portal->id;
                     break;
                 case '媒体报导':
                     $positions[3] = $portal->id;
                     break;
             }
             $pids[] = $portal->id;
         }
         $article_model = new Article();
         foreach ($pids as $pid) {
             $articles[$pid] = $article_model->getArticles(['Portal_id' => $pid]);
         }
         return view("index", ["portals" => $portals, 'articles' => $articles, 'positions' => $positions]);
     }
     return view("index");
 }
Ejemplo n.º 2
0
 public function ajaxPublish(Request $request)
 {
     $id = (int) $request->get('id');
     $portal = new Portal();
     $portals = $portal->getPortals();
     $data = array("portals" => $portals);
     if (isset($id) && $id > 0) {
         $model = new Article();
         $article = $model->getArticle(["id" => $id]);
         $data['article'] = $article;
     }
     return view('ajax/admin/publish', $data)->renderSections();
 }