/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(Request $request) { // $user = User::getAuthUser(); if ($user->canCreateSessions(Input::get('team_id'))) { $validator = Validator::make($request->all(), ['topic' => 'required', 'date' => 'required']); if ($validator->fails()) { return response()->json(['message' => $validator->messages()], 400); } Session::create(Input::all()); } else { return response()->json(['message' => 'You do not have permission to create a session for this team'], 400); } }
public function postEditSchedule(int $id) { $file = fopen(request()->file('schedule_file')->getRealPath(), 'r'); $l = 0; while ($line = fgetcsv($file)) { if ($l++ === 0) { continue; } //skipping headers Session::create(['title' => $line[0], 'description' => $line[1], 'begin' => $line[2], 'end' => $line[3], 'event_id' => $id]); } $total = $l - 1; //skipping header if ($total > 0) { \Session::flash('success', __('One activity was imported.', 'A total of %d activities were imported.', $total)); } else { \Session::flash('warning', _('No activity was found in the file.')); } return $this->edit('schedule', $id); }
/** * Create session hash for the logged in user * * @return Void */ protected function setSessionHash() { $hash = uniqid(); Session::create(['user_id' => $this->user->id, 'hash' => $hash]); $this->hash = $hash; }