public function postCreate(Request $request) { $rules = array('name' => 'required', 'description' => 'required'); $this->validate($request, $rules); $link = $request->segment(2); $plan = \App\plan::where('link', $link); $plan2 = $plan->get()[0]; $name = $request->name; $desc = $request->description; $job = new \App\job(['name' => $name, 'description' => $desc]); $plan2->job()->save($job); return redirect()->action('plan@getLink', [$link]); }
public function getIndex(Request $request) { $user = \Auth::user(); $edited = \App\plan::where('user_id', $user->id)->orderBy('updated_at', 'DESC')->get(); return view('browse', array('plans' => $user->plan->all(), 'edited' => $edited)); }