/** * Create a new user instance after a valid registration. * * @param array $data * * @return User */ protected function create(array $data) { // Agreement is the honeypot field. Append it to the password so that bots can register but never log in. $user = new User(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'] . $data['agreement'])]); // Also mark user as spammer when agreement is filled. if (!empty($data['agreement'])) { $user->status |= USER_STATUS_SPAMMER; } $user->save(); Event::fire(new UserRegistered($user)); return $user; }
/** * Display a listing of the resource. * * @return Response */ public function index() { $filter = \DataFilter::source(User::with('faction')); $filter->add('name', 'Name', 'text'); $filter->add('faction.name', 'Faction', 'autocomplete'); $filter->add('updated_at', 'Last change', 'daterange')->format('m/d/Y', 'en'); $filter->submit('search'); $filter->reset('reset'); $filter->build(); $grid = \DataGrid::source($filter)->attributes(['class' => 'table table-hover table-striped']); $grid->add('id', 'ID', true)->cell(function ($value) { return link_to(action('Admin\\UserController@edit') . '?show=' . $value, $value); }); $grid->add('status', 'Status', true); $grid->add('name', 'Name', true); $grid->add('faction.name', 'Faction', true); $grid->add('reputation', 'Reputation', true); $grid->add('alignment', 'Alignment', true); $grid->add('affiliation', 'Affiliation', true); $grid->add('created_at', 'Created', true); $grid->add('updated_at', 'Last change', true); $grid->add('email', 'Email address'); $grid->edit(action('Admin\\UserController@edit'), 'Edit', 'modify|delete'); return view('admin.user.index', compact('filter', 'grid')); }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('users')->delete(); User::create(['name' => 'admin', 'status' => USER_STATUS_ADMIN, 'email' => '*****@*****.**', 'password' => '$2y$10$pHhnHCu.EvVEJDlYVAYnkeEb8JUTb4c1MoaKw9z7Tf18bP87Y52JC']); }