/** * Bind data to the view. * * @param View $view * @return void */ public function compose(View $view) { $twoweeks = time() - 7 * 24 * 60 * 60 * 2; $events = \teambernieny\Event::with('neighborhood')->with('files')->with('volunteers')->where('Date', '>', date('Y-m-d', $twoweeks))->where('id', '!=', '1')->orderby('Date', 'DESC')->get(); $eventrows = array(); foreach ($events as $event) { $totalrows = 0; foreach ($event->files as $file) { $totalrows = $totalrows + $file->TotalRows; $filenew = \teambernieny\File::with('user')->find($file->id); $file = $filenew; } $eventrows[$event->id] = $totalrows; } $view->with(['events' => $events, 'eventrows' => $eventrows]); }
public function postEdit(Request $request) { $file = \teambernieny\File::find($request->file_id); $file->Name = $request->FileName; $file->TotalRows = $request->TotalRows; if ($request->CompletedRows == "") { $file->CompletedRows = '0'; } else { $file->CompletedRows = $request->CompletedRows; } if ($request->Completed == "true") { $file->Completed = 1; $file->user_id = $request->user_id; } else { $file->Completed = 0; $file->user_id = null; } $file->save(); return $this->returnfileAdd($request); }