コード例 #1
0
 public function deleteParentsInfo($uid)
 {
     //Moin
     //Parents Delete Function for admin
     $infoDelete = Parents::where('institute_code', '=', Auth::user()->institute_id)->where('guradian_id', '=', $uid)->delete();
     $infoDelete = User::where('institute_id', '=', Auth::user()->institute_id)->where('uid', '=', $uid)->delete();
     Session::flash('data', 'Data successfully deleted !');
     return Redirect::to('/admin/add/parents');
 }
コード例 #2
0
 public function postAddParents()
 {
     //Moin
     //Parents Registration post Function For admin
     $email = Input::get('email');
     $userc = User::Where('email', '=', $email)->count();
     $marchant = Institute::Where('email', '=', $email)->count();
     if ($userc > 0) {
         Session::flash('data', 'This Email already used. Please Try a another email.');
         return Redirect::to('admin/add/parents');
     } else {
         $iid = User::where('uid', '=', Auth::user()->uid)->pluck('institute_id');
         $gname = Input::get('gname');
         $fname = Input::get('father_name');
         $mname = Input::get('mother_name');
         $fprofession = Input::get('father_profession');
         $mprofession = Input::get('mother_profession');
         $religion = Input::get('religion');
         $address = Input::get('address');
         $phone = Input::get('phone');
         $national_id = Input::get('nid');
         $uname = Input::get('username');
         $uid = mt_rand('1', '9999') . ' ' . $iid;
         //return $uid;
         $pu = new User();
         $pu->name = $gname;
         $pu->uid = $uid;
         $pu->user_name = $uname;
         $pu->user_type = 'Parents';
         $pu->priv = 4;
         $pu->email = $email;
         $pu->password = Hash::make(Input::get('confirm_password'));
         $pu->institute_id = $iid;
         $pu->save();
         $pup = new Parents();
         $pup->guardian_name = $gname;
         $pup->institute_code = $iid;
         $pup->guradian_id = $uid;
         $pup->fathers_name = $fname;
         $pup->mothers_name = $mname;
         $pup->fathers_profession = $fprofession;
         $pup->mothers_profession = $mprofession;
         $pup->phone = $phone;
         $pup->address = $address;
         $pup->national_id = $national_id;
         $pup->religion = $religion;
         $pup->user_name = $uname;
         $pup->user_type = 'Parents';
         $pup->priv = 4;
         $pup->email = $email;
         $pup->password = Hash::make(Input::get('confirm_password'));
         $pup->save();
         Session::flash('data', 'Data successfully added !');
         return Redirect::to('admin/add/parents');
     }
 }
コード例 #3
0
 public function UpdateStudentsEdit($id)
 {
     //Moin
     //Student Update Function for admin
     $name = Input::get('name');
     $roll = Input::get('roll');
     $gid = Input::get('gname');
     $class = Input::get('class');
     $section = Input::get('section');
     $religion = Input::get('religion');
     $bdate = Input::get('bdate');
     $gender = Input::get('gender');
     $email = Input::get('email');
     $phone = Input::get('phone');
     $address = Input::get('address');
     $gname = Parents::where('guradian_id', '=', $gid)->pluck('guardian_name');
     //$sid=Students::where('institute_id', '=', Auth::user()->institute_id)->;
     //return $id.'/'.$name.'/'.$email;
     //return $name.'/'.$roll.'/'.$gname.'/'.$class.'/'.$section.'/'.$religion.'/'.$bdate.'/'.$gender.'/'.$email.'/'.$phone.'/'.$address.'/'.$image;
     $userc = User::where('uid', '=', $id)->where('email', '=', $email)->count();
     $marchant = Students::where('st_id', '=', $id)->where('email', '=', $email)->count();
     //return $userc.$marchant;
     if ($userc > 0 && $marchant > 0) {
         // return 1;
         if (Input::hasFile('image')) {
             $extension = Input::file('image')->getClientOriginalExtension();
             if ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'PNG' || $extension == 'jpg' || $extension == 'JPEG' || $extension == 'BMP') {
                 $date = date('dmyhsu');
                 $fname = mt_rand('199', '999') . '.' . $extension;
                 $destinationPath = 'images/';
                 Input::file('image')->move($destinationPath, $fname);
                 $final = $fname;
                 $re1 = Students::where('institute_code', '=', Auth::user()->institute_id)->where('st_id', '=', $id)->update(['image' => $final]);
             } else {
                 $re = Students::where('institute_code', '=', Auth::user()->institute_id)->where('st_id', '=', $id)->update(['image' => '']);
             }
         }
         $studentup = Students::where('institute_code', '=', Auth::user()->institute_id)->where('st_id', '=', $id)->update(['name' => $name, 'guardian_id' => $gid, 'guardian_name' => $gname, 'gender' => $gender, 'religion' => $religion, 'email' => $email, 'phone' => $phone, 'address' => $address, 'class' => $class, 'section' => $section, 'roll' => $roll, 'birth_certificate' => $bdate]);
         $studentuser = User::where('institute_id', '=', Auth::user()->institute_id)->where('uid', '=', $id)->update(['name' => $name, 'email' => $email]);
         Session::flash('data', 'Data successfully added !');
         return Redirect::to('student/edit/' . $id);
     } else {
         $userc = User::where('email', '=', $email)->count();
         $marchant = Students::where('email', '=', $email)->count();
         if ($userc > 0 && $marchant > 0) {
             // return 3;
             Session::flash('data', 'Email Already Used !');
             return Redirect::to('student/edit/' . $id);
         } else {
             //return 4;
             if (Input::hasFile('image')) {
                 $extension = Input::file('image')->getClientOriginalExtension();
                 if ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'PNG' || $extension == 'jpg' || $extension == 'JPEG' || $extension == 'BMP') {
                     $date = date('dmyhsu');
                     $fname = mt_rand('199', '999') . '.' . $extension;
                     $destinationPath = 'images/';
                     Input::file('image')->move($destinationPath, $fname);
                     $final = $fname;
                     $re1 = Students::where('institute_code', '=', Auth::user()->institute_id)->where('st_id', '=', $id)->update(['image' => $final]);
                 } else {
                     $re = Students::where('institute_code', '=', Auth::user()->institute_id)->where('st_id', '=', $id)->update(['image' => '']);
                 }
             }
             $studentup = Students::where('institute_code', '=', Auth::user()->institute_id)->where('st_id', '=', $id)->update(['name' => $name, 'guardian_id' => $gid, 'guardian_name' => $gname, 'gender' => $gender, 'religion' => $religion, 'email' => $email, 'phone' => $phone, 'address' => $address, 'class' => $class, 'section' => $section, 'roll' => $roll, 'birth_certificate' => $bdate]);
             $studentuser = User::where('institute_id', '=', Auth::user()->institute_id)->where('uid', '=', $id)->update(['name' => $name, 'email' => $email]);
             Session::flash('data', 'Data successfully added !');
             return Redirect::to('student/edit/' . $id);
         }
     }
     //return $studentuser;
 }