Guest User

Untitled

a guest
Nov 18th, 2017
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. <?php
  2. namespace appHttpControllers;
  3. use AppUser;
  4. use IlluminateHttpRequest;
  5.  
  6.  
  7.  
  8.  
  9. class UserController extends Controller {
  10.  
  11. public function postSignUp(Request $request)
  12. {
  13. $email = $request['email'];
  14. $first_name = $request['first_name'];
  15. $password = bcrypt($request['password']);
  16. $user = new User();
  17. $user->email =$email;
  18. $user->first_name=$first_name;
  19. $user->password = $password;
  20. $user->save();
  21.  
  22. return redirect()->back();
  23.  
  24. }
  25.  
  26. public function postSignIn(Request $request)
  27. {
  28.  
  29. }
  30. }
  31.  
  32. /**
  33. * Define your route model bindings, pattern filters, etc.
  34. *
  35. * @return void
  36. */
  37. public function boot()
  38. {
  39. //
  40.  
  41. parent::boot();
  42. }
  43.  
  44. /**
  45. * Define the routes for the application.
  46. *
  47. * @return void
  48. */
  49. public function map()
  50. {
  51. $this->mapApiRoutes();
  52.  
  53. $this->mapWebRoutes();
  54.  
  55. //
  56. }
  57.  
  58. /**
  59. * Define the "web" routes for the application.
  60. *
  61. * These routes all receive session state, CSRF protection, etc.
  62. *
  63. * @return void
  64. */
  65. protected function mapWebRoutes()
  66. {
  67. Route::middleware('web')
  68. ->namespace($this->namespace)
  69. ->group(base_path('routes/web.php'));
  70.  
  71.  
  72. Route::post('/signup',[
  73. 'uses'=>'UserController@postSignUp',
  74. 'as'=>'signup'
  75. ]);
  76.  
  77.  
  78.  
  79. }
  80.  
  81. /**
  82. * Define the "api" routes for the application.
  83. *
  84. * These routes are typically stateless.
  85. *
  86. * @return void
  87. */
  88. protected function mapApiRoutes()
  89. {
  90. Route::prefix('api')
  91. ->middleware('api')
  92. ->namespace($this->namespace)
  93. ->group(base_path('routes/api.php'));
  94. }
Add Comment
Please, Sign In to add comment