Exemplo n.º 1
0
 public function postRegister(Request $request)
 {
     //return \Redirect::back()->with('message','register function hijacked');
     //temporarily for infosys users only.
     $request['email'] = $request->input('email');
     //.'@infosys.com';
     $validator = $this->validator($request->all());
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
     $activation_code = str_random(60);
     $user = new \App\User();
     $user->name = $request->input('name');
     $user->email = $request->input('email');
     $user->password = bcrypt($request->input('password'));
     $user->activation_code = $activation_code;
     if ($user->save()) {
         /*create profile*/
         $profile = new \App\Profile();
         $profile->save();
         $user->profile()->save($profile);
         $data = array('name' => $user->name, 'code' => $activation_code);
         \Mail::send('emails.activate', $data, function ($message) use($user) {
             $message->to($user->email, $user->name)->subject('Please activate your account.');
         });
         \Auth::login($user);
         flash('Please check your email for activating your account(check spam folder just in case or contact us if you did not receive email).');
         return redirect()->route('rules');
     } else {
         flash('Your account couldn\\’t be created please try again');
         return redirect()->back()->withInput();
     }
 }
Exemplo n.º 2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     App\User::create(['name' => 'admin', 'email' => '*****@*****.**', 'password' => bcrypt('admin')]);
     App\Profile::create(['user_id' => 1]);
     App\User::find(1)->roles()->attach(1);
     factory(App\User::class, 50)->create()->each(function ($u) {
         $u->profile()->save(factory(App\Profile::class)->make());
         $u->roles()->attach(rand(1, 4));
     });
 }
Exemplo n.º 3
0
  * Products
  */
 Route::get('products/search', ['as' => 'admin.products.search', 'uses' => 'ProductsController@search']);
 Route::get('products/{slug}/images', ['as' => 'admin.products.edit_images', 'uses' => 'ProductsController@editImages']);
 Route::post('products/{slug}/images', ['as' => 'admin.products.update_images', 'uses' => 'ProductsController@updateImages']);
 Route::bind('products', function ($slug) {
     return App\Product::whereSlug($slug)->with('images')->firstOrFail();
 });
 Route::resource('products', 'ProductsController');
 /**
  * ===========================================================
  * Profiles
  */
 Route::post('profiles/image/{id}', ['as' => 'admin.profiles.image', 'uses' => 'ProfilesController@postImage']);
 Route::bind('profiles', function ($id) {
     return App\Profile::findOrFail($id);
 });
 Route::resource('profiles', 'ProfilesController', ['except' => 'destroy']);
 /**
  * =================================================================================
  * Roles
  */
 Route::get('roles/detatch_user/{user}/role/{role}', ['as' => 'admin.roles.detatch_user', 'uses' => 'RolesController@detatchUser']);
 Route::get('roles/search', ['as' => 'admin.roles.search', 'uses' => 'RolesController@search']);
 Route::bind('roles', function ($id) {
     return App\Role::with('users')->findOrFail($id);
 });
 Route::resource('roles', 'RolesController');
 /**
  * =============================================================
  * Todos
 public function register(Request $request)
 {
     if (!$request->has('name') || !$request->has('phone') || !$request->has('age') || !$request->has('gender') || !$request->has('payee_name') || !$request->has('available_from') || !$request->has('available_to') || !$request->has('differently_abled') || !$request->has('willingToGoOut')) {
         return view('error')->with('error', 'Please provide all the fields.');
     }
     $user = new \App\Profile();
     $input = $request->all();
     $availableFrom = explode('-', $input['available_from']);
     $availableTo = explode('-', $input['available_to']);
     $availableFrom = $availableFrom[2] . '-' . $availableFrom[1] . '-' . $availableFrom[0];
     $availableTo = $availableTo[2] . '-' . $availableTo[1] . '-' . $availableTo[0];
     $user->middleman_id = \Auth::id();
     $user->name = $input['name'];
     $user->phone = $input['phone'];
     $user->age = $input['age'];
     $user->gender = $input['gender'];
     $user->payee_name = $input['payee_name'];
     $user->available_from = $input['available_from'];
     $user->available_to = $input['available_to'];
     // $user->differently_abled = $input['differently_abled'];
     // $user->willingToGoOut = $input['willingToGoOut'];
     if ($input['differently_abled'] == 'true') {
         $user->differently_abled = true;
     } else {
         $user->differently_abled = false;
     }
     if ($input['willingToGoOut'] == 'true') {
         $user->willingToGoOut = true;
     } else {
         $user->willingToGoOut = false;
     }
     if (isset($input['email'])) {
         $user->email = $input['email'];
     }
     $user->save();
     if (isset($input['skill-agriculture'])) {
         $skill = new \App\Skill();
         $sk = \App\Hardskill::where('skill', '=', 'agriculture')->get()->first();
         $skill->skill_id = $sk->id;
         $skill->profile_id = $user->id;
         $skill->save();
     }
     if (isset($input['skill-embroidery'])) {
         $skill = new \App\Skill();
         $sk = \App\Hardskill::where('skill', '=', 'embroidery')->get()->first();
         $skill->skill_id = $sk->id;
         $skill->profile_id = $user->id;
         $skill->save();
     }
     if (isset($input['skill-masonry'])) {
         $skill = new \App\Skill();
         $sk = \App\Hardskill::where('skill', '=', 'masonry')->get()->first();
         $skill->skill_id = $sk->id;
         $skill->profile_id = $user->id;
         $skill->save();
     }
     if (isset($input['skill-carpentry'])) {
         $skill = new \App\Skill();
         $sk = \App\Hardskill::where('skill', '=', 'carpentry')->get()->first();
         $skill->skill_id = $sk->id;
         $skill->profile_id = $user->id;
         $skill->save();
     }
     if (isset($input['skill-gardening'])) {
         $skill = new \App\Skill();
         $sk = \App\Hardskill::where('skill', '=', 'gardening')->get()->first();
         $skill->skill_id = $sk->id;
         $skill->profile_id = $user->id;
         $skill->save();
     }
     if (isset($input['skill-cooking'])) {
         $skill = new \App\Skill();
         $sk = \App\Hardskill::where('skill', '=', 'cooking')->get()->first();
         $skill->skill_id = $sk->id;
         $skill->profile_id = $user->id;
         $skill->save();
     }
     if (isset($input['skill-packaging'])) {
         $skill = new \App\Skill();
         $sk = \App\Hardskill::where('skill', '=', 'packaging')->get()->first();
         $skill->skill_id = $sk->id;
         $skill->profile_id = $user->id;
         $skill->save();
     }
     // return response()->json(['success' => $user->id]);
     return redirect('/profiles');
 }
Exemplo n.º 5
0
        $helper = $fb->getRedirectLoginHelper();
        $logoutUrl = $helper->getLogoutUrl($token, 'http://mfunder.testyourprojects.net/auth/logout');
        //echo $logoutUrl; exit;
        return redirect('/home')->with('logoutUrl', $logoutUrl);
    } else {
        // Register the new user or whatever.
        $user = new App\User();
        $user->name = $name;
        $user->type = 'general';
        $user->register_type = 'facebook';
        $user->username = $u_name;
        $user->email = $email;
        $user->password = bcrypt($u_name);
        $user->save();
        $user_obj = App\User::where('email', $email)->first();
        $profile = new App\Profile();
        $profile->user_id = $user_obj->id;
        //$profile = $user->profile()->save($profile);
        $profile->save();
        if (Auth::attempt($credentials)) {
            return redirect('/home')->with('message', 'Successfully logged in with Facebook');
        }
    }
});
//==============================
//==============================
Route::get('google', 'AccountController@google_redirect');
Route::get('account/google', 'AccountController@google');
Route::get('twitter', 'AccountController@twitter_redirect');
Route::get('account/twitter', 'AccountController@twitter');
//Route::any('project/json-reminder', array('uses' => 'ProjectController@postJsonReminder'));