Exemplo n.º 1
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Component $component)
 {
     $header = $component->where('type', 'header')->first();
     $about = $component->where('type', 'about')->first();
     $terms = $component->where('type', 'terms')->first();
     $offers = $this->offers->orderBy('updated_at', 'desc')->get();
     return view('welcome', compact('header', 'about', 'terms', 'offers'));
 }
Exemplo n.º 2
0
 public function update(Request $request, Component $component)
 {
     $com = $component->findOrFail($request->id);
     $com->fill($request->only('title', 'body'))->save();
     return redirect()->back()->with('status', strtoupper($com->type) . ' has been updated.');
 }