/**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $this->setMetadata();
     $articleCategory = new ArticleCategory();
     $articlesSlide = $articleCategory->getArticlesByCategoryKey('slideshow-chinh', 5);
     $articlesHomepage = $articleCategory->getArticlesByCategoryKey('trang-chu', 20);
     $articlesSlideFooter = $articleCategory->getArticlesByCategoryKey('slideshow-footer', 10);
     return view('frontend.sites.index', ['articlesSlide' => $articlesSlide, 'articlesHomepage' => $articlesHomepage, 'articlesSlideFooter' => $articlesSlideFooter]);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $data = [];
     $data['content'] = Article::find($id);
     $data['article_category'] = ArticleCategory::lists('name', 'id');
     return view('pages.admin.article.edit', compact('data'));
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $generator = \Faker\Factory::create('vi_VN');
     $articleCategories = ['Thị trường nhà đất', 'Dự án căn hộ', 'Đầu tư căn hộ', 'Lời khuyên'];
     //, 'Vị trí bài viết', 'Slideshow chính', 'Trang chủ', 'Slideshow footer'];
     $articleCategoryPositionArticles = null;
     foreach ($articleCategories as $key => $value) {
         $articleCategory = ArticleCategory::create(['key' => Common::createKeyURL($value), 'parent_id' => is_null($articleCategoryPositionArticles) ? 0 : $articleCategoryPositionArticles->id, 'priority' => $key, 'is_publish' => 1, 'created_by' => 'vankhoektcn', 'updated_by' => 'vankhoektcn']);
         ArticleCategoryTranslation::create(['article_category_id' => $articleCategory->id, 'locale' => 'vi', 'name' => $value, 'summary' => $value, 'meta_description' => $value, 'meta_keywords' => $value]);
         if ($value == 'Vị trí bài viết') {
             $articleCategoryPositionArticles = $articleCategory;
         }
     }
     $articles = ['Giới Thiệu', 'Tuyển Dụng', 'Tài Khoản Giao Dịch'];
     foreach ($articles as $key => $value) {
         $article = Article::create(['key' => Common::createKeyURL($value), 'priority' => $key, 'is_publish' => 1, 'created_by' => 'vankhoektcn', 'updated_by' => 'vankhoektcn']);
         ArticleTranslation::create(['article_id' => $article->id, 'locale' => 'vi', 'name' => $value, 'summary' => $generator->text($maxNbChars = 200), 'content' => $generator->realText($maxNbChars = 1000, $indexSize = 2), 'meta_description' => $generator->text($maxNbChars = 200), 'meta_keywords' => $generator->text($maxNbChars = 200)]);
     }
     $categories = ArticleCategory::where('parent_id', '=', 0)->lists('id');
     $categories2 = ArticleCategory::where('parent_id', '<>', 0)->lists('id');
     for ($i = 0; $i < 3; $i++) {
         $name = $generator->sentence($nbWords = 6);
         $key = Common::createKeyURL($name);
         $article = Article::create(['key' => $key, 'priority' => $i, 'is_publish' => 1, 'created_by' => 'vankhoektcn', 'updated_by' => 'vankhoektcn']);
         ArticleTranslation::create(['article_id' => $article->id, 'locale' => 'vi', 'name' => $name, 'summary' => $generator->text($maxNbChars = 200), 'content' => $generator->text, 'meta_description' => $generator->text($maxNbChars = 200), 'meta_keywords' => $generator->text($maxNbChars = 200)]);
         Attachment::create(['entry_id' => $article->id, 'table_name' => 'articles', 'path' => '/uploads/notfound.jpg', 'priority' => 0, 'is_publish' => 1]);
         $article->categories()->attach($categories->random());
         //$article->categories()->attach($categories2->random());
     }
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     //
     $categories = ArticleCategory::all();
     $resp = view('admin.articleCreation', array('categories' => $categories));
     return $resp;
 }
Beispiel #5
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $teachers = Teacher::topN(6);
     $articles = Article::topN(6);
     $categories_in_pane = ArticleCategory::all();
     return response()->view('site.classes', array('teachers' => $teachers, 'other_articles' => $articles, 'categories_in_pane' => $categories_in_pane));
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $generator = \Faker\Factory::create('vi_VN');
     $articleCategories = ['Thông tin', 'Bài viết nỗi bật'];
     foreach ($articleCategories as $key => $value) {
         $articleCategory = ArticleCategory::create(['key' => Common::createKeyURL($value), 'parent_id' => 0, 'priority' => 0, 'is_publish' => 1, 'created_by' => 'phantsang', 'updated_by' => 'phantsang']);
         ArticleCategoryTranslation::create(['article_category_id' => $articleCategory->id, 'locale' => 'vi', 'name' => $value, 'summary' => $value, 'meta_description' => $value, 'meta_keywords' => $value]);
     }
     $articles = ['Giới thiệu', 'Dịch vụ của chúng tôi', 'Tại sao chọn chúng tôi'];
     foreach ($articles as $key => $item) {
         $article = Article::create(['key' => Common::createKeyURL($item), 'priority' => 0, 'is_publish' => 1, 'created_by' => 'phantsang', 'updated_by' => 'phantsang']);
         ArticleTranslation::create(['article_id' => $article->id, 'locale' => 'vi', 'name' => $item, 'summary' => $generator->text($maxNbChars = 200), 'content' => $generator->text, 'meta_description' => $generator->text($maxNbChars = 200), 'meta_keywords' => $generator->text($maxNbChars = 200)]);
         Attachment::create(['entry_id' => $article->id, 'table_name' => 'articles', 'path' => '/uploads/notfound.jpg', 'priority' => 0, 'is_publish' => 1]);
     }
     // BÀI VIẾT THÔNG TIN
     $articleCategory = ArticleCategory::findByKey('thong-tin')->first()->id;
     if (!is_null($articleCategory) && count($articleCategory) > 0) {
         for ($i = 0; $i < 10; $i++) {
             $name = $generator->sentence($nbWords = 6);
             $article = Article::create(['key' => Common::createKeyURL($name), 'priority' => 0, 'is_publish' => 1, 'created_by' => 'phantsang', 'updated_by' => 'phantsang']);
             ArticleTranslation::create(['article_id' => $article->id, 'locale' => 'vi', 'name' => $name, 'summary' => $generator->text($maxNbChars = 200), 'content' => $generator->text, 'meta_description' => $generator->text($maxNbChars = 200), 'meta_keywords' => $generator->text($maxNbChars = 200)]);
             /*
             Attachment::create([
             	'entry_id' => $article->id,
             	'table_name' => 'articles',
             	//'path' => $generator->imageUrl($width = 780, $height = 546),
             	'path' => '/uploads/notfound.jpg',
             	'priority' => 0,
             	'is_publish' => 1
             ]);
             */
             $article->categories()->attach($articleCategory);
         }
     }
 }
Beispiel #7
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $categories = ArticleCategory::lists('title', 'id');
     //		$categories = ArticleCategory::all();
     return view('admin.articles.create', compact('categories'));
     //		return view('admin.articles.create',['categories'=>$categories]);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function getEdit($id)
 {
     $news = Article::find($id);
     $languages = Language::all();
     $language = $news->language_id;
     $newscategories = ArticleCategory::all();
     $newscategory = $news->newscategory_id;
     return view('admin.news.create_edit', compact('news', 'languages', 'language', 'newscategories', 'newscategory'));
 }
 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function show($id)
 {
     //
     $teacher = Teacher::find($id);
     $teachers = Teacher::topN(6);
     $articles = Article::topN(6);
     $categories_in_pane = ArticleCategory::all();
     return response()->view('site.teacher', array('teacher' => $teacher, 'teachers' => $teachers, 'other_articles' => $articles, 'categories_in_pane' => $categories_in_pane));
 }
Beispiel #10
0
 /**
  * @param Category $except
  *
  * @return CategoriesController
  */
 protected function getCategoryOptions($except = null)
 {
     /** @var \Kalnoy\Nestedset\QueryBuilder $query */
     $query = ArticleCategory::select('id', 'name')->withDepth();
     if ($except) {
         $query->whereNotDescendantOf($except)->where('id', '<>', $except->id);
     }
     return $this->makeOptions($query->get());
 }
 public function index()
 {
     $article = Article::with('users')->limit(2)->orderBy('updated_at', 'desc')->get();
     $app = Application::with('users')->paginate(6);
     $ArticleCategory = ArticleCategory::all();
     $AppCategory = AppCategory::all();
     $test = AppCategory::with('applications')->where('name', '=', 'communication')->get();
     dd($test);
     return view('homepage.welcome', compact('article', 'app', 'ArticleCategory', 'AppCategory'));
 }
 public function index()
 {
     $title = "Dashboard";
     $article = Article::count();
     $articlecategory = ArticleCategory::count();
     $users = User::count();
     $photo = Photo::count();
     $photoalbum = PhotoAlbum::count();
     return view('admin.dashboard.index', compact('title', 'article', 'articlecategory', 'photo', 'photoalbum', 'users'));
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $data = [];
     $data['article'] = ArticleCategory::with('articles')->get();
     $data['content'] = Schedule::find($id);
     $data['doctor'] = Doctor::whereHas('clinics', function ($q) {
         $q->where('clinic.id', Auth::user()->clinic->id);
     })->orderBy('name')->get();
     return view('frontend.pages.clinic.schedule-update', compact('data'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function register()
 {
     //
     $data = array();
     $data['content'] = null;
     $data['list_gender'][0] = 'L';
     $data['list_gender'][1] = 'P';
     $data['article'] = \App\ArticleCategory::with('articles')->get();
     return view('pages.patient.register')->with('data', $data);
 }
 public function edit($id)
 {
     $data = [];
     $data['article'] = ArticleCategory::with('articles')->get();
     $data['content'] = \App\Doctor::find($id);
     $data['list_province'] = \App\Province::lists('name', 'id');
     $data['list_city'] = \App\City::lists('name', 'id');
     $data['list_specialization'] = \App\Specialization::lists('name', 'id');
     $data['days'] = \App\Day::lists('name', 'id');
     return view('frontend.pages.clinic.doctor-edit', compact('data'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($categorykey)
 {
     $category = ArticleCategory::findByKey($categorykey)->first();
     // push all catetory and own child to list
     $list_sub_categor_id = ArticleCategory::where('parent_id', $category->id)->where('is_publish', 1)->lists('id')->all();
     array_push($list_sub_categor_id, $category->id);
     $articles = Article::whereExists(function ($query) use($list_sub_categor_id) {
         $query->select(DB::raw(1))->from('article_article_category')->whereRaw('article_article_category.article_id = articles.id')->whereIn('article_category_id', $list_sub_categor_id);
     })->orderBy('priority')->get();
     return view('admin.articles.index', ['articles' => $articles, 'category' => $category]);
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     //
     $teachers = Teacher::topN(6);
     $article = Article::find($id);
     $other_articles = Article::topN(6);
     $categories_in_pane = ArticleCategory::all();
     $article->content = MyUtil::replace_reference_tag($article->content) ?: $article->content;
     $resp = view('site.article', array('article' => $article, 'teachers' => $teachers, 'other_articles' => $other_articles, 'categories_in_pane' => $categories_in_pane));
     return $resp;
 }
 public function index()
 {
     $title = "Dashboard";
     $news = Article::count();
     $newscategory = ArticleCategory::count();
     $users = User::count();
     $photo = Photo::count();
     $photoalbum = PhotoAlbum::count();
     $video = Video::count();
     $videoalbum = VideoAlbum::count();
     return view('backend.dashboard.index', compact('title', 'news', 'newscategory', 'video', 'videoalbum', 'photo', 'photoalbum', 'users'));
 }
 public function getArticlesByCategoryKey($categoryKey = '', $limit = 0)
 {
     $articleCategory = ArticleCategory::where('key', $categoryKey)->first();
     if (isset($articleCategory) && !is_null($articleCategory)) {
         if ($limit == 0) {
             return $articleCategory->articles()->where('is_publish', 1)->orderBy('priority')->orderBy('created_at', 'desc')->get();
         } else {
             return $articleCategory->articles()->where('is_publish', 1)->orderBy('priority')->orderBy('created_at', 'desc')->take($limit)->get();
         }
     }
     return [];
 }
 public function getLink()
 {
     $categorykey = "bai-viet";
     $positionParent = ArticleCategory::where('key', 'vi-tri-bai-viet')->first();
     if (isset($positionParent)) {
         $arrayPosId = $positionParent->children->lists('id');
         $category = $this->categories()->whereNotIn('id', $arrayPosId)->first();
         if (isset($category)) {
             $categorykey = $category->key;
         }
     }
     $link = route('article', ['categorykey' => $categorykey, 'articlekey' => $this->key]);
     return $link;
 }
 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function show($id, $pageNo)
 {
     //$category = ArticleCategory::with("articles")->find($id);
     $category = ArticleCategory::find($id);
     $teachers = Teacher::topN(6);
     //query()->orderBy('ord_no')->where('in_intro', '1')->take(6)->get();
     $articles = $category->articles()->getResults();
     $other_articles = Article::topN(6);
     $categories_in_pane = ArticleCategory::all();
     //dd($categories_in_pane);
     //$articleCnt = $category->articles()->getResults();
     $resp = view('site.category', array('category' => $category, 'teachers' => $teachers, 'articles' => $articles, 'other_articles' => $other_articles, 'categories_in_pane' => $categories_in_pane));
     //$resp = view('site.test', array('category'=>$category, 'teachers'=>$teachers, 'articles'=>$articles));
     return $resp;
 }
Beispiel #22
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //
     //return 'hello';
     //$article = Article::all();
     //return $article;
     //return ArticleCategory::find(1)->getForeignKey();
     $article_categories = ArticleCategory::query()->orderBy("ord_no")->get();
     //return $articles;
     $horzPics = MainHorizontalPics::all();
     $articles = Article::topN(15);
     //        foreach ($articles as $article) {
     //            $article["file"] = MyUtil::get_res_file($article->content);
     //        }
     ///return $article;
     return response()->view('site.index', array('categories' => $article_categories, 'articles' => $articles, 'horzPics' => $horzPics));
 }
 public function article($articlekey)
 {
     $article = Article::where('key', $articlekey)->first();
     if ($article != null) {
         // metadata
         $site_title = $article->name . ' - ' . Config::findByKey('site_title')->first()->value;
         SEOMeta::setTitle($site_title);
         SEOMeta::setDescription($article->meta_description);
         SEOMeta::addKeyword([$article->meta_keywords]);
         SEOMeta::addMeta('article:published_time', $article->created_at->toW3CString(), 'property');
         if (isset($article->categories->first()->name)) {
             SEOMeta::addMeta('article:section', $article->categories->first()->name, 'property');
         }
         OpenGraph::setTitle($site_title);
         OpenGraph::setDescription($article->meta_description);
         OpenGraph::setUrl(route('article', ['articlekey' => $articlekey]));
         OpenGraph::addProperty('type', 'article');
         OpenGraph::addProperty('locale', app()->getLocale());
         OpenGraph::addProperty('locale:alternate', ['vi-vn', 'en-us']);
         OpenGraph::addImage($article->getFirstAttachment());
         OpenGraph::addImage($article->attachments->lists('path'));
         OpenGraph::addImage(['url' => Image::url($article->getFirstAttachment(), 300, 300, array('crop')), 'size' => 300]);
         // end metadata
         $info_category = ArticleCategory::findByKey('thong-tin')->first();
         $categories = $info_category->getAllSubCategoryInfo();
         $popular_category = ArticleCategory::where('key', 'bai-viet-noi-bat')->first();
         $popular_articles = is_null($popular_category) ? null : $popular_category->articles()->where('is_publish', 1)->orderBy('priority')->orderBy('created_at', 'desc')->take(5)->get();
         return view('frontend.pages.article', ['article' => $article, 'categories' => $categories, 'popular_articles' => $popular_articles]);
     } else {
         abort(404);
     }
 }
 /**
  * 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 != '') {
             ArticleCategory::where('id', '=', $value)->update(array('position' => $order));
             $order++;
         }
     }
     return $list;
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $articleCategories = ArticleCategory::all();
     $resp = view('admin.articleCategories', array('articleCategories' => $articleCategories));
     return $resp;
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit(Article $article)
 {
     $languages = Language::lists('name', 'id')->toArray();
     $articlecategories = ArticleCategory::lists('title', 'id')->toArray();
     return view('admin.article.create_edit', compact('article', 'languages', 'articlecategories'));
 }
Beispiel #27
0
});
Route::group(['domain' => 'dev.joecurrancodes.dev'], function () {
    /**
     * Static or General Page Requests.
     */
    Route::get('/', 'PagesController@index');
    Route::get('about', 'PagesController@about');
    Route::get('contact', 'PagesController@contact');
    Route::post('contact', 'PagesController@contactPost');
    Route::get('projects', 'PagesController@projects');
    Route::get('dashboard', 'PagesController@dashboard');
    Route::get('blog/category', function () {
        return redirect('blog');
    });
    Route::get('blog/category/{slug}', function ($slug) {
        $category = ArticleCategory::where('name', $slug)->first();
        if (is_null($category)) {
            return redirect('blog');
        }
        $articles = Article::where('category', $category->id)->published()->listing()->paginate(4);
        $pagecode = '8PWLY8FGtvp2nQ5D';
        $meta = Meta::where('code', $pagecode)->firstOrFail();
        return view('core.article.index', compact('articles', 'meta'));
    });
    /**
     * Blog or Article Requests.
     */
    Route::resource('blog', 'BlogController');
    /**
     * User Authentication, Registation & Profiles Requests.
     */
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     DB::transaction(function () use($id) {
         $user = Auth::user();
         $articleCategory = ArticleCategory::findOrFail($id);
         $articleCategory->updated_by = $user->name;
         $articleCategory->deleted_by = $user->name;
         $articleCategory->key = $articleCategory->key . '-' . microtime(true);
         $articleCategory->save();
         // soft delete
         $articleCategory->delete();
     });
 }
 public function register()
 {
     //
     $data = array();
     $data['content'] = null;
     $data['list_gender'][0] = 'L';
     $data['list_gender'][1] = 'P';
     $data['city'] = \App\City::all();
     $data['specialization'] = \App\Specialization::all();
     $data['article'] = \App\ArticleCategory::with('articles')->get();
     return view('frontend.pages.clinic.register')->with('data', $data);
 }
Beispiel #30
0
 /**
  * Function for changing the Article Type into the Article Type Name.
  *
  * @param $value
  * @return
  */
 public function getCategoryAttribute($value)
 {
     $value = ArticleCategory::where('id', $value)->firstOrFail()->name;
     return $value;
 }