/**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $post = new Content(['title' => $request->get('title'), 'content' => $request->get('content'), 'published_at' => $request->get('published_at')]);
     $post->save();
     $imageName = $post->id . '.' . $request->file('image')->getClientOriginalExtension();
     $request->file('image')->move(base_path() . '/public/img', $imageName);
     return redirect('post/index');
 }
Esempio n. 2
0
 public function __construct()
 {
     $this->bannersSelect = Content::where('type', 'Banners')->get();
     $this->galleriesSelect = Content::where('type', 'Galleries')->get();
     $this->linksSelect = Content::where('type', 'Links')->get();
     $this->peopleSelect = Content::where('type', 'People')->get();
 }
Esempio n. 3
0
 /**
  * Display the specified content.
  *
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $content = Content::findOrFail($id);
     $uploader = User::find($content->user_id);
     $comments = Comment::all()->where('content_id', '=', $id);
     return view('content.detail', compact('content', 'uploader', 'comments'));
 }
Esempio n. 4
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $social = Content::where('title', 'Sosyal Medya')->first();
     $this->socials = $social != NULL ? $social->links()->get() : NULL;
     view()->share('socials', $this->socials);
     return $next($request);
 }
 public function home()
 {
     // get all site content
     $contents = Content::where('published', '=', true)->orderBy('id', 'desc')->with('type', 'columns', 'columns.type', 'tags', 'categories', 'assets', 'assets.source')->whereNotNull('content_type_id')->get();
     $contents = $this->transformer->collection($contents);
     return view('pages.home', compact('contents'));
 }
 public function home(Content $content, Ticket $ticket, User $user, Application $application, BusinessUnit $businessUnit)
 {
     //FIND USERS WITH SUBMITTED TICKETS
     $users_with_tickets = User::has('tickets')->get();
     //USERS WHO ARE NOT ADMIN
     $non_admin_users = $user->notAdmin()->get();
     $admin_users = $user->admins()->get();
     $tickets_all = $ticket->all()->count();
     $tickets_c = $ticket->completed()->get()->count();
     $prj_brief_records = $content->latest()->brief()->get();
     $prj_notes_records = $content->latest()->notes()->get();
     $status_records = $content->latest()->status()->get();
     $applications = $application->get();
     $users = $user->get();
     return view('pages.home', compact('prj_notes_records', 'status_records', 'tickets_c', 'tickets_all', 'users_with_tickets', 'applications', 'non_admin_users', 'admin_users', 'users'));
 }
 /**
  * Store bottom text
  *
  * @param \Illuminate\Http\Request $request
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function changeText(Request $request)
 {
     $this->validate($request, ['title' => 'required', 'subtitle' => 'required']);
     Content::create($request->all());
     \Session::flash('message', 'Successfully Stored your Data!');
     return redirect()->back();
 }
Esempio n. 8
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     foreach (range(1, 300) as $index) {
         Content::create(['title' => $faker->sentence, 'content' => $faker->paragraph(4), 'images' => '[]', 'thumb_images' => '[]', 'category_id' => '1', 'visitor_count' => '0', 'created_by' => '2', 'updated_by' => '2', 'status' => '1']);
     }
 }
 public function showGallery(Request $r)
 {
     $gal = Content::find($r->input('id'));
     $hc = new HomeController();
     $vars = $hc->getVars();
     $lang = $r->session()->get("lang", "fa");
     return view('gallery', ["lang" => $lang, "gallery" => $gal, "vars" => $vars]);
 }
Esempio n. 10
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index($url)
 {
     $content = Content::where('url', '=', $url)->first();
     if (!$content) {
         abort(404);
     }
     return view('content.custom', compact('content'));
 }
Esempio n. 11
0
 /**
  * Display the specified resource.
  *
  * @param  string  $id
  * @return Response
  */
 public function show($id)
 {
     $contents = Content::with('template')->find($id);
     // $contentDir = base_path().'/resources/content/'.$id;
     // $markdown = \File::get($contentDir.'/post.md');
     // return response()->json(compact('contents', 'markdown'));
     return $contents;
 }
 public function getRelatedBlog($id)
 {
     $ids = DB::select('call related(?)', array($id));
     if (count($ids) < 3) {
         return Content::where("type", "blogs")->orWhere("type", "didactics")->take(3)->get();
     }
     return Content::find([$ids[0]->content_id, $ids[1]->content_id, $ids[2]->content_id]);
 }
Esempio n. 13
0
 public static function popular()
 {
     $populardata = Cache::remember('popular', 60, function () {
         $data = Content::take(15)->orderBy('pageview', 'desc')->get();
         return $data;
     });
     return $populardata;
 }
Esempio n. 14
0
 public function getAll($subtopic_name)
 {
     $me = SubTopic::where('name', $subtopic_name)->get()->toArray();
     $arr = $me[0];
     $subtopic_code = $arr["subtopic_code"];
     $content = Content::where('subtopic_code', $subtopic_code)->get();
     return view('sources')->with(['allcontent' => $content, 'subtopic_name' => $subtopic_name]);
 }
Esempio n. 15
0
 public function destroy($id)
 {
     $content = Content::findOrFail($id);
     $this->authorize('manage-course-contents', $content->course);
     $content->delete();
     session()->flash('success', 'El contenido se ha editado.');
     return redirect()->route('course.show', $content->course->id);
 }
Esempio n. 16
0
 public function haberci($account, $slug)
 {
     $iletisim = \App\Host::where('subdomain', $account)->first();
     $contact = \App\User::find($iletisim->user_id)->contact;
     $about = \App\User::find($iletisim->user_id)->about;
     $sliders = \App\User::find($iletisim->user_id)->slider;
     $haber = \App\Content::where('alias', $slug)->where('user_id', $iletisim->user_id)->first();
     return view('frontend.haber', compact('contact', 'about', 'sliders', 'haber'));
 }
Esempio n. 17
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     //App::setLocale('kh');
     //return trans('administrators.dashboard');
     //$user = Auth::user();
     //return $user->toJson();
     return View('admin.dashboard')->with(['user_total' => \App\User::count(), 'content_total' => \App\Content::count(), 'category_total' => \App\Category::count(), 'slider_total' => \App\Slider::count()]);
 }
Esempio n. 18
0
 public function run()
 {
     DB::table('contents')->truncate();
     $faker = Factory::create();
     foreach (range(1, 50) as $index) {
         $tmpName = $faker->name;
         Content::create(['name' => $tmpName, 'url' => 'content/page/' . $tmpName, 'content' => $faker->text]);
     }
 }
 /**
  * Execute the command.
  *
  * @return void
  */
 public function handle()
 {
     $slug = Slug::create(['name' => $this->request->slug, 'slug_attribute_id' => self::SLUG_ATTRIBUTE_MENU]);
     $this->request['slug_id'] = $slug->id;
     $this->request['gallery'] = '';
     // not yet implemented
     $content = Content::create($this->request->all());
     Activity::create(['text' => $this->auth->linkedName() . ' created new content named ' . $content->linkedName(), 'user_id' => $this->auth->id]);
     Session::flash('flash_message', 'Your content has been created!');
 }
Esempio n. 20
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     $theme = ['nightlife', 'food', 'animals', 'cats', 'transport'];
     $categories = Category::all();
     foreach ($categories as $category) {
         foreach (range(5, 10) as $index) {
             Content::create(['name' => $faker->sentence(rand(4, 6), true), 'category_id' => $category->id, 'user_id' => 1, 'image' => 'http://lorempixel.com/640/480/' . $theme[rand(0, 4)] . '/' . rand(1, 9), 'short_desc' => $faker->paragraph(5, true), 'content' => $faker->paragraph(40, true), 'types' => 1, 'status' => 1]);
         }
     }
 }
 public function updateContent($id, Request $request)
 {
     $content = Content::findOrFail($id);
     $content->update(['title' => $request->title, 'isvisible' => $request->isvisible, 'isfeatured' => $request->isfeatured]);
     if ($request->input('tag_list') == "") {
         $content->tags()->detach($request->input('tag_list'));
     } else {
         $content->tags()->sync($request->input('tag_list'));
     }
     return redirect('/adminPanel/contentMaintenance');
 }
Esempio n. 22
0
 /**
  * Delete a Topic
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $Topic = $this->Topic->findOrFail($id);
     if ($Topic->delete()) {
         Flash::success(trans('app.Successful operation'));
         return redirect()->route('topic.index');
     } else {
         Flash::error(trans('app.Operation failed'));
         return redirect()->back();
     }
 }
Esempio n. 23
0
 public function search($tag)
 {
     $tuple = SubTopic::where('tags', $tag)->get()->toArray();
     if ($tuple == null) {
         return view('search')->with('message', 'not found');
     }
     $tuple = $tuple[0];
     $subtopic_code = $tuple['subtopic_code'];
     dd($subtopic_code);
     $sources = Content::where('subtopic_code', $subtopic_code)->get()->toArray();
     return view('search')->with('message', $sources);
 }
Esempio n. 24
0
 public function search(Request $request)
 {
     $menu = \App\Menu::find(1);
     $search = $request->input('search') ?: '';
     /*$categories = \App\Category::where('level','1')->orderBy('ordering')->get();
       $parentCategory = \App\Category::where('title','like','%'.$search.'%')
                                      ->orWhereIn('parent_id',DB::table('categories')->where('title',$search)->lists('id'))
                                      ->lists('id');*/
     $categories = \App\Category::whereNull('deleted_at')->get();
     $contents = \App\Content::where('title', 'like', '%' . $search . '%')->whereNull('deleted_at')->orderBy('created_at')->paginate(21);
     return view('project_list')->with(['category' => '', 'categories' => $categories, 'contents' => $contents, 'menu' => $menu]);
 }
Esempio n. 25
0
 public function updateContent(Request $request, $id)
 {
     $content = Content::find($id);
     $content->fill($request->all());
     $content->featured = $request->input('featured') ? 1 : 0;
     $content->published = $request->input('published') ? 1 : 0;
     $content->published_at = $request->input('published') ? Carbon::now() : null;
     $content->save();
     $files = $this->disk->files($this->contentDir . $id);
     $response = $content;
     return response()->json(compact('response', 'files'));
 }
Esempio n. 26
0
 public function index()
 {
     if (!isset($_GET['page'])) {
         $_GET['page'] = 1;
     }
     $contents = Cache::remember('contents-' . $_GET['page'], 60, function () {
         $data = Content::orderBy('id', 'desc')->paginate(5);
         $data->setPath('/');
         return $data;
     });
     return view('Site.main', ['contents' => $contents, 'popular' => \App\Layout::popular()]);
 }
Esempio n. 27
0
 public function store(Request $request)
 {
     $input = $request->all();
     $input['detail'] = delFontInline(delScriptTag($input['detail']));
     $comment = Comment::create($input);
     $content = Content::find($comment->content_id);
     $topic = Topic::find($comment->content_id);
     if ($content) {
         return redirect(route('content', $content->link));
     } elseif ($topic) {
         return redirect(route('read_topic', $topic->id));
     }
 }
Esempio n. 28
0
 /**
  * Save map
  * 
  * @return \Illuminate\Http\JsonResponse
  */
 public function save()
 {
     $input = \Input::except('_token');
     // Validate map content
     if (empty($input['id'])) {
         // Pre validate
         $input['seo_slug'] = empty($input['seo_slug']) ? str_slug($input['title']) : $input['seo_slug'];
         // Create validator
         $validator = \Validator::make($input, ['title' => 'required|max:255', 'seo_slug' => 'unique:contents' . (!empty($input['id']) ? ',seo_slug,' . $input['id'] : '')]);
         // When validation fails
         if ($validator->fails()) {
             return response()->json(['errors' => $validator->messages()]);
         }
     }
     // Load content
     if (empty($input['id'])) {
         $content = new Content();
         $content->user_id = \Auth::user()->id;
         $content->fill($input);
         $content->save();
         $map = new Map();
         $map->user_id = \Auth::user()->id;
         $map->content()->associate($content);
     } else {
         $map = Map::find($input['id']);
     }
     // Save changes
     $input['center'] = implode(' ', $input['center']);
     $map->fill($input);
     $map->save();
     // Response
     if (isset($input['close'])) {
         return response()->json(['success' => 'Map saved', 'redirect' => url('/admin/maps/list')]);
     } else {
         return response()->json(['success' => 'Map saved', 'redirect' => url('/admin/maps/form/' . $map->id)]);
     }
 }
Esempio n. 29
0
 public function search(Request $r)
 {
     $lang = $r->session()->get("lang", "fa");
     $query = $r->input("query");
     if (strlen($query) < 2) {
         return view("error", ["messega" => "Search Query must be at least 2 characters"]);
     }
     $result = Content::where("title", "like", "%" . $query . "%")->get();
     $types = array();
     foreach ($result as $res) {
         $types[$res->type] = $res->farsiType();
     }
     array_unique($types);
     $var = $this->getVars();
     return view("searchresult", ["query" => $query, "result" => $result, "types" => $types, "lang" => $lang, "vars" => $var]);
 }
Esempio n. 30
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $main_page = Content::where('type', '=', 'mainpage')->get()->first();
     $main_page_arr = [];
     if (isset($main_page) && $main_page->count()) {
         $main_page_arr = $main_page->toArray();
     }
     if (is_array($main_page_arr) && isset($main_page_arr['text']) && trim($main_page_arr['text']) == '') {
         $main_page_arr['text'] = '<h1>Приносим свои извинения, страница находится в разработке.</h1>';
     }
     if (is_array($main_page_arr) && isset($main_page_arr['title']) && trim($main_page_arr['title']) == '') {
         $main_page_arr['title'] = 'Сайт компании Golden Motors';
     }
     $main_slider = UIComponents::where('name', '=', 'main-slider')->get()->first();
     $main_slider_arr = [];
     if (isset($main_slider) && isset($main_slider->obj)) {
         $obj = json_decode($main_slider->obj);
         if (isset($obj->images)) {
             $main_slider_arr['images'] = $obj->images;
         }
         if (isset($obj->html)) {
             $main_slider_arr['html'] = $obj->html;
         }
         if (isset($obj->html)) {
             $main_slider_arr['configuration'] = $obj->configuration;
         }
     }
     $partners_slider = UIComponents::where('name', '=', 'partners-slider')->get()->first();
     $partners_slider_arr = [];
     if (isset($partners_slider) && isset($partners_slider->obj)) {
         $obj = json_decode($partners_slider->obj);
         if (isset($obj->images)) {
             $partners_slider_arr['images'] = $obj->images;
         }
         if (isset($obj->html)) {
             $partners_slider_arr['html'] = $obj->html;
         }
         if (isset($obj->configuration)) {
             $partners_slider_arr['configuration'] = $obj->configuration;
         }
     }
     $feedbacks_arr = Content::getContent('feedback', 0);
     return view('catalog/index/index', ['mainpage' => $main_page_arr, 'main_slider' => $main_slider_arr, 'partners_slider' => $partners_slider_arr, 'feedbacks' => $feedbacks_arr]);
 }