diff --git a/app/controllers/UserController.php b/app/controllers/UserController.php index 6d6bf29..3230253 100644 --- a/app/controllers/UserController.php +++ b/app/controllers/UserController.php @@ -3,6 +3,15 @@ class UserController extends \BaseController { + + + public function index() + { + $users = User::all(); + + return View::make('users.index')->with('users', $users); + } + public function create() { return View::make('users.create'); @@ -63,8 +72,91 @@ class UserController extends \BaseController $user = User::find($user_id); - return View::make('users.profile')->with('user', $user)->with('group_id', $group_id); + return View::make('users.complete')->with('user', $user)->with('group_id', $group_id); + + } + + public function saveProfile() + { + $group_id = \Input::get('group_id'); + + $user_id = \Input::get('user_id'); + + $user = \User::find($user_id); + + $skills = array(); + + if (Input::get('java') === 'Java'){} + array_push($skills, 'Java'); + + if (Input::get('php') === 'PHP') {} + array_push($skills, 'PHP'); + + if (Input::get('python') === 'Python') {} + array_push($skills, 'Python'); + + if (Input::get('cplus') === 'Cplus') {} + array_push($skills, 'C++'); + + if (Input::get('objc') === 'Objc') {} + array_push($skills, 'Objective C'); + + if (Input::get('htmljscss') === 'Html') {} + array_push($skills, 'HTML JS CSS'); + + if (Input::get('android') === 'Android') {} + array_push($skills, 'Android'); + + if (Input::get('ux') === 'UXDesign') {} + array_push($skills, 'Java'); + + if (Input::get('webapps') === 'Webapps') {} + array_push($skills, 'Web Apps'); + + if (Input::get('ruby') === 'Ruby') {} + array_push($skills, 'Ruby on Rails'); + + if (Input::get('people') === 'People') {} + array_push($skills, 'People Skills'); + + $skills = serialize($skills); + + $user->first = \Input::get('first'); + $user->last = \Input::get('last'); + $user->email = \Input::get('email'); + $user->location = \Input::get('location'); + $user->bio = \Input::get('bio'); + $user->skills = $skills; + + if (\Input::hasFile('photo')) { + $photo = \Input::file('photo'); + $filename = uniqid('profile_').'.'.$photo->getClientOriginalExtension(); + $photo->move(public_path('images/users'), $filename); + $user->photo = 'images/users/'.$filename; + } + + $role = UserXrefRole::create(array( + 'user_id' => $user_id, + 'role_id' => $group_id + )); + + $role->save(); + + if ($user->save()) + { + return Redirect::route('users', array('user_id' => $user_id)); + }else + { + \Redirect::back('complete', array($user_id, $group_id )); + } + + } + + public function showProfile($id) + { + $user = User::find($id); + return View::make('users.profile')->with('user', $user); } } \ No newline at end of file diff --git a/app/database/migrations/2014_06_28_024032_alter_user_table_add_columns.php b/app/database/migrations/2014_06_28_024032_alter_user_table_add_columns.php new file mode 100644 index 0000000..3a6dd68 --- /dev/null +++ b/app/database/migrations/2014_06_28_024032_alter_user_table_add_columns.php @@ -0,0 +1,39 @@ +text('bio')->nullable()->after('email'); + $table->string('location', 32)->nullable()->after('bio'); + $table->string('photo', 100)->after('bio')->nullable(); + $table->text('skills')->after('photo')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('users', function(Blueprint $table) + { + $table->dropColumn('bio'); + $table->dropColumn('location'); + $table->dropColumn('photo'); + }); + } + +} diff --git a/app/models/User.php b/app/models/User.php index fb546d5..be2e51c 100755 --- a/app/models/User.php +++ b/app/models/User.php @@ -12,7 +12,8 @@ class User extends Eloquent implements UserInterface, RemindableInterface { * @var string */ protected $table = 'users'; - protected $fillable = array('first', 'last', 'email', 'password'); + protected $fillable = array( + 'first', 'last', 'email', 'password', 'location', 'skills', 'photo', 'bio'); /** * The attributes excluded from the model's JSON form. diff --git a/app/routes.php b/app/routes.php index 215042e..233ed17 100755 --- a/app/routes.php +++ b/app/routes.php @@ -26,6 +26,9 @@ Route::get('users/create', array('as' => 'create', 'uses' => 'UserController@cre Route::post('users/store', array('uses' => 'UserController@store')); Route::get('users/group/{user_id}', array('as' => 'group', 'uses' => 'UserController@chooseGroup')); Route::get('users/group/{user_id}/{group_id}', array('as' => 'complete', 'uses' => 'UserController@completeRegistration')); +Route::post('users/group/complete', array('uses' => 'UserController@saveProfile')); +Route::get('users/{id}', array('as' => 'users', 'uses' => 'UserController@showProfile')); +Route::get('users', array('as' => 'users', 'uses' => 'UserController@index')); /** * User Password Reminder Controller routes diff --git a/app/storage/images/users/logo_53ae5f6817ca8.JPG b/app/storage/images/users/logo_53ae5f6817ca8.JPG new file mode 100644 index 0000000..0406650 Binary files /dev/null and b/app/storage/images/users/logo_53ae5f6817ca8.JPG differ diff --git a/app/storage/uploads/users/logo_53ae5867e86ab.png b/app/storage/uploads/users/logo_53ae5867e86ab.png new file mode 100755 index 0000000..d0e8914 Binary files /dev/null and b/app/storage/uploads/users/logo_53ae5867e86ab.png differ diff --git a/app/storage/uploads/users/logo_53ae59b0039f4.png b/app/storage/uploads/users/logo_53ae59b0039f4.png new file mode 100755 index 0000000..d0e8914 Binary files /dev/null and b/app/storage/uploads/users/logo_53ae59b0039f4.png differ diff --git a/app/storage/uploads/users/logo_53ae5a333aac5.JPG b/app/storage/uploads/users/logo_53ae5a333aac5.JPG new file mode 100755 index 0000000..ae3569e Binary files /dev/null and b/app/storage/uploads/users/logo_53ae5a333aac5.JPG differ diff --git a/app/views/users/choice.blade.php b/app/views/users/choice.blade.php new file mode 100644 index 0000000..63ab3b7 --- /dev/null +++ b/app/views/users/choice.blade.php @@ -0,0 +1,116 @@ + + +
+ +Allowed Size = 200 x 200