Exemplo n.º 1
0
 public function edit($id)
 {
     $course = Course::find($id);
     $classifications = Classification::all();
     $generations = Generation::all();
     $programs = Program::all();
     $majors = Major::all();
     $menu = 'project';
     return View::make('courses.edit', compact('course', 'classifications', 'programs', 'generations', 'majors', 'menu'));
 }
Exemplo n.º 2
0
 public function storeUser()
 {
     $redir = $this->check();
     if (isset($redir)) {
         return $redir;
     }
     $user = Sentry::getUser();
     if (Input::has('editor1')) {
         $summary = Input::get('editor1');
         $user->summary = $summary;
     }
     if (Input::has('editor2')) {
         $experience = Input::get('editor2');
         $user->experience = $experience;
     }
     if (Input::has('del-prog')) {
         $del = Input::get('del-prog');
         $ar = array();
         foreach ($del as $key => $val) {
             $ar[] = $key;
         }
         foreach ($ar as $delid) {
             $progs = Program::where('ProgramName', '=', $delid)->get();
             foreach ($progs as $prog) {
                 $user->programs()->detach($prog->id);
             }
         }
     } elseif (Input::has('program') && !Input::has('del-prog')) {
         $id = Input::get('program');
         $progs = Program::where('ProgramName', '=', $id)->take(1)->get();
         foreach ($progs as $prog) {
             $user->programs()->attach($prog->id);
         }
     }
     if (Input::has('email') && Input::has('fname') && Input::has('lname')) {
         $email = Input::get('email');
         $fname = Input::get('fname');
         $lname = Input::get('lname');
         $user->email = $email;
         $user->first_name = $fname;
         $user->last_name = $lname;
     }
     if (Input::hasFile('photo') && Input::file('photo')->isValid()) {
         $formatTable = array('image/jpeg', 'image/png', 'image/gif', 'image/tga', 'image/tif', 'image/bmp');
         $file = Input::file('photo');
         $mime = $file->getMimeType();
         foreach ($formatTable as $mimecheck) {
             if ($mime == $mimecheck) {
                 $filename = Str::random(20) . '.' . $file->getClientOriginalExtension();
                 $destinationPath = "public/uploads";
                 $succes = $file->move($destinationPath, $filename);
                 $bodytag = str_replace("public/", "", $succes->getPathname());
                 $user->avatar = $bodytag;
                 $img = Image::make($bodytag)->resize(612, 612)->save();
             }
         }
     }
     $user->save();
     //$user = Sentry::getUser();
     //$prgs= $user->programs()->get(); var_dump($prgs); $user->programs()->attach(714);
     $this->layout->title = APPNAME;
     $programs = Program::all();
     $this->layout->content = View::make('main.profile.edit')->with('user', $user)->with('programs', $programs);
 }
Exemplo n.º 3
0
 public function getAllprogram()
 {
     $program = Program::all();
     return Response::json($program);
 }