public function makeStudentBranch($rid) { $req = CsiRequest::find($rid); $academic = $req->requestedBy->subType->subType; $academic->is_student_branch = 1; $academic->save(); $req->status_code = 1; $req->save(); Flash::success('Success! insitution has been made a student branch'); return redirect()->route('backendInstitutionListStudentBranch'); }
public function makeStudentBranch() { if (Auth::user()->user()->subType->subType->is_student_branch != 1) { $user = Auth::user()->user(); $academic = $user->subType->subType; $academic->is_student_branch = 0; $academic->save(); CsiRequest::create(['requested_by' => $user->id, 'request_type' => 2]); Flash::success('Your request Has been Sent successfully'); } else { Flash::success('You are already a student branch'); } return Redirect::to('/dashboard'); }