Пример #1
0
 public function get_events_by_category($cat)
 {
     if ($cat > 6) {
         abort(404);
     }
     $status = Status::first();
     if ($status->add_winners == 0) {
         return EventDetails::where('grp', $cat)->select('event_name', 'event_description')->get()->toArray();
     } else {
         return EventDetails::where('grp', $cat)->get()->toArray();
     }
 }
Пример #2
0
 public function create_event()
 {
     if (\Auth::check()) {
         $user = User::where('email', Session::get('email'))->first();
         $data = Input::all();
         //dd($data);
         array_pop($data);
         $rules = ['event_name' => 'required', 'file' => 'mimes:application/pdf'];
         $validator = Validator::make($data, $rules);
         if ($validator->fails()) {
             return Redirect::route('add_event')->withErrors($validator->errors())->withInput();
         }
         $event = new Events();
         $event->society_email = $user->email;
         if (sizeof(Events::all()) != 0) {
             $event_count = Events::all()->last()->id + 1;
         } else {
             $event_count = 0;
         }
         $event->event_id = strtolower(substr($user->society, 0, 4)) . $event_count;
         $eventdetails = new EventDetails();
         $eventdetails->event_id = $event->event_id;
         $eventdetails->event_name = $data['event_name'];
         $eventdetails->event_description = json_encode($data['short_des']);
         $eventdetails->long_des = json_encode($data['long_des']);
         $eventdetails->rules = json_encode($data['rules']);
         // rules n long des ke columns banenge
         // n vo yahan par se vahan jayenge
         if (Status::first()->add_events == 1) {
             $data['timing'] = $data['date'] . " " . $data['time'];
             $data['contact'] = array(array("name" => $data['contact_name1'], "number" => $data['contact_number1']), array("name" => $data['contact_name2'], "number" => $data['contact_number2']));
             $data['prize_money'] = array($data['prize_money1'], $data['prize_money2']);
             if (rtrim($data['timing']) != '' && strpos($data['timing'], 'undefined') === false) {
                 $tv = preg_split('/[- :]/', $data['timing']);
                 $d = mktime($tv[3], $tv[4], 0, $tv[1], $tv[2], $tv[0]);
                 $timestamp = date("Y-m-d h:i:s", $d);
                 $eventdetails->timing = $timestamp;
             }
             $eventdetails->contact = json_encode($data['contact']);
             $eventdetails->prize_money = json_encode($data['prize_money']);
             $eventdetails->approved = 0;
             if (Input::file('file') != null && Input::file('file')->isValid()) {
                 $destinationPath = 'uploads';
                 // upload path
                 $extension = Input::file('file')->getClientOriginalExtension();
                 // getting image extension
                 $fileName = rand(11111, 99999) . '.' . $extension;
                 // renameing image
                 Input::file('file')->move($destinationPath, $fileName);
                 // uploading file to given path
                 $eventdetails->attachment = $fileName;
             }
         }
         $event->save();
         if ($eventdetails->save()) {
             return Redirect::route('view_event');
         } else {
             Session::flash('success', '0');
             return Redirect::back();
         }
     } else {
         return Redirect::route('root');
     }
 }
Пример #3
0
 public function del_soc($id)
 {
     if (\Auth::check()) {
         $user = User::where('email', Session::get('email'))->first();
         if ($user->priviliges == 1) {
             $soc = User::where('id', $id)->first();
             $events = Events::where('society_email', $soc->email)->get();
             if ($events) {
                 foreach ($events as $eve) {
                     $event_details = EventDetails::where('event_id', $eve->event_id)->delete();
                     $eve->delete();
                 }
             }
         }
         if ($soc->delete()) {
             return Redirect::route('admin_panel');
         }
     }
     return Redirect::route('admin_panel');
 }
Пример #4
0
 public function get_soc_mem_details($type, $id)
 {
     if (\Auth::check()) {
         $user = User::where('email', Session::get('email'))->first();
         if ($user->priviliges == 1) {
             $soc = User::where('id', $id)->get()->first();
             $members = Members::where('soc_id', $soc['email'])->where('type', $type)->get();
             $members = $members->toArray();
             foreach ($members as $key => $field) {
                 if ($members[$key]['events'] != '' && $members[$key]['events'] != null && $members[$key]['events'] != 'null') {
                     $x = EventDetails::where('event_id', $members[$key]['events'])->first();
                     if ($x != '') {
                         $members[$key]['events'] = EventDetails::where('event_id', $members[$key]['events'])->first()->event_name;
                     } else {
                         $members[$key]['events'] = '';
                     }
                 }
             }
             $disp_events = Events::where('society_email', $soc->email)->get()->pluck('event_id');
             $disp_event_details = array();
             foreach ($disp_events as $disp) {
                 $disp_event_details[] = EventDetails::where('event_id', $disp)->first();
             }
             return \View::make('team_table', array('members' => $members, 'type' => $type, 'disp_events' => $disp_event_details));
         }
     }
     return Route::back();
 }
Пример #5
0
 public function root()
 {
     $events = Events::all();
     $eventdetails = EventDetails::all();
     return View::make('zeal', ['events' => $events, 'eventdetails' => $eventdetails]);
 }