public function post(Step2Request $request) { // if id is found, update advisor if ($advisor_id = $request->input('id')) { $advisor = Advisor::find($advisor_id); $advisor->update($request->all()); } else { // create new advisor $advisor = new Advisor($request->all()); $advisor->school_id = Session::get('school')->id; $advisor->event_id = Session::get('event')->id; $advisor->save(); } Session::set('advisor', Advisor::find($advisor->id)); if (!$request->input('other_school')) { // auto create first advisor $attendee = new Attendee(); // split up the attending advisor name $attendee_name = explode(' ', $request->input('attending_advisor')); if (is_array($attendee_name) && count($attendee_name) > 1) { $attendee->first_name = $attendee_name[0]; $attendee->last_name = $attendee_name[1]; } else { $attendee->first_name = $request->input('attending_advisor'); $attendee->last_name = ''; } $attendee->event_id = Session::get('event')->id; $attendee->school_id = Session::get('school')->id; $attendee->role_id = Role::where(['name' => 'Advisor', 'event_id' => Session::get('event')->id])->first()->id; $attendee->advisor_id = Session::get('advisor')->id; $attendee->save(); Flash::info(trans('notifications.edit_as_needed')); } return redirect('/event/' . Session::get('event')->slug . '/step/3'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { // $advisor = Advisor::find($id); $advisor->delete(); return redirect()->route('advisor.index'); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($event_id, $advisor_id) { Advisor::find($advisor_id)->delete(); return redirect('/admin/event/' . $event_id . '/advisors'); }
<?php $totals = \App\School::totals(Session::get('event')->id); $advisor = \App\Advisor::find(Session::get('advisor')); $total = $totals->flatten()->sum(); ?> <div class="widget stacked"> <div class="widget-header"> <i class="icon-star"></i> <h3>Invoice Summary</h3> </div> <!-- /widget-header --> <div class="widget-content"> <table class="table"> @foreach ($totals as $role => $charges) <tr> <th align="right">{{ str_plural(\App\Role::find($role)->name) }}</th> <td>{{ count($charges) }}</td> <td>x ${{ \App\Role::find($role)->cost }} =</td> <td align="right">${{ collect($charges)->sum() }}.00</td> </tr> @endforeach <tr> <th align="right">Total</th> <td colspan="3" align="right"><big><strong>${{ \App\School::total() }}.00</strong></big></td> </tr> </table> </div> </div>
public function index() { return view('step.parent', ['step' => 3, 'attendees' => Advisor::find(Session::get('advisor')->id)->attendees]); }