/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $post = Post::findOrFail($id); $contacts = json_decode($post->phone); $section = Section::where('service_id', '1')->where('status', 1)->orderBy('sort_id')->get(); return view('admin.posts.edit', compact('post', 'contacts', 'section')); }
public function showMaterials($section, $id) { $section = Section::where('slug', $section)->first(); $profiles = Profile::where('section_id', $section->id)->take(5)->get(); $posts = Post::where('section_id', $id)->where('status', 1)->orderBy('id', 'DESC')->paginate(10); return view('board.posts', compact('section', 'profiles', 'posts')); }
public function getCategory($slug, Section $section, Product $shop) { $sec = $section->where(['section_slug' => $slug])->get(); //получаю "категорию" по слагу $products = $sec[0]->products()->get(); //получаю коллекцию продуктов $sec = $sec[0]->section_slug; $sections = $section->getSection(); return view('pages.shop.category', ['categories' => $sec, 'sections' => $sections, 'products' => $products]); }
/** * Show the application dashboard. * * @return \Illuminate\Http\Response */ public function index($name) { $page = Page::where('name', 'LIKE', $name)->first(); $section = Section::where('id', 'LIKE', $page->section_id)->first(); $articles = Article::where('page_id', 'LIKE', $page->id)->orderBy('publish_time', 'desc')->get(); $articles_attachments = []; foreach ($articles as $article) { $articles_attachments[$article->id] = Attachment::where('article_id', 'LIKE', $article->id)->get(); } return view('page.index', ['page' => $page, 'section' => $section, 'articles' => $articles, 'articles_attachments' => $articles_attachments]); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $name = $request->get('name'); $section = Section::where('name', $name)->first(); if (count($section) > 0) { return response()->json(['success' => false, 'message' => 'Section name already exist']); } $section = Section::create(['name' => $request->get('name')]); if (!$section->save()) { return response()->json(['success' => false, 'message' => 'Failed to save record']); } return response()->json(['success' => true, 'message' => 'New section saved successfully!']); }
public function index($cid) { $course = Course::find($cid); $sections = Section::where('course_id', '=', $cid)->get(); return view('sections.index')->with('sections', $sections)->with('course', $course); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { // $sectionId = Request::get('id'); Section::where('id', $sectionId)->delete(); return redirect("sections"); }
/** * Bootstrap any application services. * * @return void */ public function boot() { return \View::share(['sections' => App\Section::where('parent_id', 0), 'priceRange' => [App\Product::min('price'), App\Product::max('price')], 'favorites' => App\Product::orderBy('views', 'desc')->limit(6)->get(), 'latestPosts' => App\Blog::orderBy('id', 'desc')->limit(4)->get(), 'favSection' => App\Product::orderBy('views', 'desc')->get()->first()->section->name, 'affiliate' => App\Shop::get()]); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // $section = new Section(); $section->where('id', $id)->update(['is_active' => 0]); //return Redirect::route('sections.index')->with('flash_notice', 'You are successfully delete!'); }
/** * Get all of the Sections of a given user. * * @param User $user * @return Collection */ public function forUser(User $user) { return Section::where('user_id', $user->id)->orderBy('created_at', 'asc')->get(); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $course = Course::find($id); $sections = Section::where('course_id', '=', $id); $sections->delete(); $course->delete(); Session::flash("message", "Course and sections deleted successfully"); return redirect()->back(); }
public function postRoutineByClass() { //Moin //Exam routine search Function for admin //return 1; $class = Input::get('class'); //return $class; if ($class != '') { $examname = Exam::where('institute_code', '=', Auth::user()->institute_id)->lists('exam_id', 'exam_name'); $classname = ClassAdd::where('institute_code', '=', Auth::user()->institute_id)->lists('class_id', 'class_name'); $schedule = ExamSchedule::where('institute_code', '=', Auth::user()->institute_id)->get(); $teacher = Teacher::where('institute_code', '=', Auth::user()->institute_id)->get(); $sid = ClassRoutine::where('class_name', 'LIKE', $class)->pluck('institute_code'); $sat = ClassRoutine::where('class_name', '=', $class)->where('institute_code', '=', $sid)->where('day', '=', 'SATURDAY')->get(); $sun = ClassRoutine::where('class_name', '=', $class)->where('institute_code', '=', $sid)->where('day', '=', 'SUNDAY')->get(); $mon = ClassRoutine::where('class_name', '=', $class)->where('institute_code', '=', $sid)->where('day', '=', 'MONDAY')->get(); $tue = ClassRoutine::where('class_name', '=', $class)->where('institute_code', '=', $sid)->where('day', '=', 'TUESDAY')->get(); $wed = ClassRoutine::where('class_name', '=', $class)->where('institute_code', '=', $sid)->where('day', '=', 'WEDNESDAY')->get(); $thu = ClassRoutine::where('class_name', '=', $class)->where('institute_code', '=', $sid)->where('day', '=', 'THURSDAY')->get(); $fri = ClassRoutine::where('class_name', '=', $class)->where('institute_code', '=', $sid)->where('day', '=', 'FRIDAY')->get(); $search1 = Section::where('class_name', '=', $class)->where('institute_code', '=', $sid)->orderBy('section_name', 'ASC')->lists('section_category', 'section_name'); $indsec = ClassRoutine::where('class_name', '=', $class)->where('institute_code', '=', $sid)->get(); //return $indsec; return view('admin.addroutine', ['examview' => $examname, 'classview' => $classname, 'examschedule' => $schedule, 'sat' => $sat, 'sun' => $sun, 'mon' => $mon, 'tue' => $tue, 'wed' => $wed, 'thu' => $thu, 'fri' => $fri, 'sec' => $indsec, 'section' => $search1, 'teacher' => $teacher]); } }
public static function getSectionByGradeAndOrder($grade, $order, $school) { $section = Section::where('grade', '=', $grade)->where('order', '=', $order)->where('schools_id', '=', $school)->firstOrFail(); return $section; }
public function getProjects() { $service = Service::where('slug', 'proekty')->first(); $section = Section::where('service_id', '2')->where('status', 1)->orderBy('sort_id')->get(); return view('tender.section', compact('service', 'section')); }