Exemple #1
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create(Request $request)
 {
     $circle = Circle::findOrFail($request->circle_id);
     $batch = Batch::where('circle_id', $request->circle_id)->orderBy('seqno', 'DESC')->first();
     $seqno = 1;
     if (isset($batch)) {
         $seqno = $batch->seqno + 1;
     }
     return view('batch.create', ['circle' => $circle, 'seqno' => $seqno]);
 }
Exemple #2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $this->validate($request, ['year' => 'required', 'grade' => 'required|numeric|min:3|max:13']);
     $circle = Circle::findOrFail($id);
     $circle->year = $request->year;
     $circle->setGrade($request->grade);
     $circle->save();
     return redirect('circle/' . $id);
 }