public function index() { $home = Home::whereId(1)->first(); $home->hitcounter += 1; $home->save(); $hits = Home::whereId(1)->first(); return view('home', compact('hits')); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store() { $home_values = ['address', 'phone_number']; $musician_values = ['name', 'ssn', 'address']; $home = Request::only($home_values); $results = DB::select('select * from homes where address = ?', array($home['address'])); if ($results == null) { Home::create($home); } $musician = Request::only($musician_values); Musician::create($musician); return redirect('musicians'); }
/** * @author: lmkhang - skype * @date: 2016-01-12 * Save Change */ public function change_stats(Request $request) { //Post $post = $request->all(); //Trim $home = $this->trim_all($post); foreach ($home['id'] as $id) { // echo $id. ' - '.$setting['setting_'.$id].'<br/>'; $home_get = \App\Home::find($id); $home_get->value = $home['home_' . $id]; $home_get->save(); } //set Flash Message $this->setFlash('message', 'Save successfully!'); return redirect()->back()->with('message', 'Save successfully!'); }
public function edit() { $user = User::findOrFail(Auth::user()->id); $entity = Entity::where('user_id', Auth::user()->id)->firstOrFail(); $about = About::where('user_id', Auth::user()->id)->firstOrFail(); $contact = Contact::where('user_id', Auth::user()->id)->firstOrFail(); $home = Home::where('user_id', Auth::user()->id)->firstOrFail(); $quote = Quote::where('user_id', Auth::user()->id)->get(); $quote_count = $quote->count(); $skill = Skill::where('user_id', Auth::user()->id)->get(); $skill_count = $skill->count(); $skill_slider = SkillSlider::where('user_id', Auth::user()->id)->get(); $skill_slider_count = $skill_slider->count(); $portfolio_piece = PortfolioPiece::where('user_id', Auth::user()->id)->get(); $portfolio_piece_count = $portfolio_piece->count(); return view('edit')->with('user', $user)->with('home', $home)->with('entity', $entity)->with('contact', $contact)->with('about', $about)->with('skill', $skill)->with('skill_count', $skill_count)->with('quote', $quote)->with('quote_count', $quote_count)->with('skill_slider', $skill_slider)->with('skill_slider_count', $skill_slider_count)->with('portfolio_piece', $portfolio_piece)->with('portfolio_piece_count', $portfolio_piece_count); }
public function updateHome() { $user = User::find(Auth::user()->id); $home = Home::where('user_id', Auth::user()->id)->firstOrFail(); if (isset($user) && $home != NULL) { if (Input::get('title') != '') { $home->title = Input::get('title'); } if (Input::get('caption') != '') { $home->caption = Input::get('caption'); } if (Input::get('image_id') != '') { $home->image_id = Input::get('image_id'); } if (Input::get('video_url') != '') { $home->video_url = Input::get('video_url'); } $home->save(); return redirect('home')->with('status', 'success'); } else { return 'An error has occured'; } }
public function getAll($where = []) { $home_get = \App\Home::where($where); $home = $home_get->get(); return $home; }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $homes = Home::findorFail($id); $homes->delete(); return redirect('admin/Homepage'); }
@extends('front.frontmaster') @section('content') <?php use App\Home; $homes = Home::latest()->get(); ?> <div class="row"> <div class="col-sm-8"> @foreach($homes as $home) <h4><b>{{$home->title}}</b></h4> <p>{!!$home->body!!}</p> @endforeach <br> <br> </div> <div class="col-sm-4"> @if($errors->any()) {!!$errors->first()!!} @endif <h4>Check your Passport Status</h4> {!!Form::open(['url'=>'admin/statusCheck','target'=>'_top'])!!} <fieldset class="form-group"> <label>Full Name:</label> <input type="text" name="fullname" class="form-control" placeholder="Your Full Name" > </fieldset> <fieldset class="form-group"> <label>Date of birth:</label>
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function crear(Request $request) { $data = $request->all(); $actividad = new Activity_Stage(); $actividad->stage_project_id = $data['project_stage_id']; $actividad->activity_id = $data['activity_id']; $actividad->unity = $data['unity']; $actividad->other_unity = $data['other_unity']; $actividad->quantity = $data['quantity']; $actividad->material = $data['material']; $actividad->hand = $data['hand']; $actividad->transport = $data['transport']; $actividad->save(); $project = Project::find($data['project_id']); $homes = Home::where('project_id', '=', $project->id)->get(); foreach ($homes as $home) { $avance = new Advanced(); $avance->porcent = 0.0; $avance->state = 4; $avance->home_id = $home->id; $avance->project_stage_id = $actividad->stage_project_id; $avance->save(); } $all = Activity_Stage::join('project_stage', 'project_stage.id', '=', 'activity_stage.stage_project_id')->join('projects', 'projects.id', '=', 'project_stage.project_id')->where('projects.id', '=', $project->id)->get(['activity_stage.*']); $valor_total = 0; foreach ($all as $a) { $valor = 0; $valor += $a->hand + $a->transport + $a->material; $valor_total += $valor * $a->quantity; } $project->budget = 0; $project->budget = $valor_total; $project->save(); return response()->json([$all]); }