public function show() { $id = Request::get('user_id'); try { $user = User::findOrFail($id); } catch (ModelNotFoundException $exc) { return response(['ret' => 404, 'msg' => 'user not found.']); } return response(['ret' => 200, 'data' => $user->toArray()]); }
/** * Run the database seeds. * * @return void */ public function run() { \XinGroup\Model\User::create(['name' => 'admin', 'email' => '*****@*****.**', 'password' => Hash::make('admin'), 'created_at' => Carbon\Carbon::now(), 'updated_at' => Carbon\Carbon::now()]); }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]); }