Beispiel #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Admin::truncate();
     if (env('APP_ENV') == 'development') {
         Admin::create(['email' => '*****@*****.**', 'name' => 'admin', 'password' => bcrypt('1234')]);
     }
 }
 public function run()
 {
     if (App::environment() == 'local') {
         //Delete all records from the admins table
         DB::table('admins')->delete();
         //Create a demo admin user
         Admin::create(array('email' => '*****@*****.**', 'password' => Hash::make('admin'), 'firstname' => 'Admin', 'lastname' => 'Demo', 'status' => 1));
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     DB::table('admins')->delete();
     $admins = [['firstname' => 'tiffany', 'lastname' => 'khan', 'email' => '*****@*****.**', 'job' => 'web developer', 'password' => Hash::make('secret')], ['firstname' => 'Chris', 'lastname' => 'morris', 'email' => '*****@*****.**', 'job' => 'ceo', 'password' => Hash::make('secret')], ['firstname' => 'Saint', 'lastname' => 'Cena', 'email' => '*****@*****.**', 'job' => 'manager', 'password' => Hash::make('secret')], ['firstname' => 'Chris', 'lastname' => 'jerico', 'email' => '*****@*****.**', 'job' => 'engineer', 'password' => Hash::make('secret')]];
     // Loop through each user above and create the record for them in the database
     foreach ($admins as $admin) {
         Admin::create($admin);
     }
     Model::reguard();
 }
 public function doRegister(RegistrationRequest $request)
 {
     $input = $request->all();
     $password = bcrypt($request->input('password'));
     $input['password'] = $password;
     $input['activation_code'] = str_random(60) . $request->input('email');
     $register = Admin::create($input);
     $data = ['noi' => $input['noi'], 'name' => $input['name'], 'other' => $input['other'], 'code' => $input['activation_code']];
     $this->sendEmail($data, $input);
     return redirect()->route('registrasiadmin');
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     //
     Schema::create('admins', function (Blueprint $table) {
         $table->increments('id');
         $table->string('name');
         $table->string('email')->unique();
         $table->string('password', 60);
         $table->string('avatar');
         $table->string('role_id');
         $table->boolean('is_banned');
         $table->rememberToken();
         $table->timestamps();
     });
     \App\Admin::create(['name' => 'admin', 'email' => '*****@*****.**', 'password' => Hash::make('secret')]);
 }
Beispiel #6
0
 public function postAdminRegister(NewUserRequest $request, User $users, Admin $admin)
 {
     $this->validate($request, ['nama_admin' => 'required', 'nik' => 'required|max:16|min:16', 'jenis_kelamin' => 'required', 'tanggal_lahir' => 'required', 'alamat' => 'required', 'telepon' => 'required', 'email' => 'required', 'password' => 'required']);
     $format_tgl_info_old = Input::get('tanggal_lahir');
     $new_users = Admin::create(['nama_admin' => $request->input('nama_admin'), 'jenis_kelamin' => $request->input('jenis_kelamin'), 'nik' => $request->input('nik'), 'alamat' => $request->input('alamat'), 'telepon' => $request->input('telepon'), 'tanggal_lahir' => date("Y-m-d", strtotime($format_tgl_info_old)), 'email' => Str::lower($request->input('email'))]);
     $new_users = User::create(['email' => Str::lower($request->input('email')), 'password' => bcrypt($request->input('password'))]);
     $lastInsertedId = $new_users->email;
     $userID = DB::table('users')->where('email', $lastInsertedId)->value('id');
     if ($new_users) {
         $new_user = User::find($userID);
         $role = Role::find('RL001');
         $new_user->attachRole($role);
         Session::flash('message', 'Admin berhasil ditambahkan!');
         return redirect('admin');
     } else {
         return redirect('admin/tambah');
     }
 }
Beispiel #7
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // $this->call(UserTableSeeder::class);
     Model::unguard();
     DB::table('users')->delete();
     DB::table('admins')->delete();
     DB::table('employees')->delete();
     DB::table('entries')->delete();
     $users = array(['name' => 'Ryan Chenkie', 'email' => '*****@*****.**', 'password' => bcrypt('secret'), 'type' => 1], ['name' => 'Chris Sevilleja', 'email' => '*****@*****.**', 'password' => bcrypt('secret'), 'type' => 3], ['name' => 'Holly Lloyd', 'email' => '*****@*****.**', 'password' => bcrypt('secret'), 'type' => 2], ['name' => 'Adnan Kukic', 'email' => '*****@*****.**', 'password' => bcrypt('secret'), 'type' => 2]);
     // Loop through each user above and create the record for them in the database
     foreach ($users as $user) {
         User::create($user);
     }
     Employee::create(['type' => 1, 'user_id' => 3]);
     Employee::create(['type' => 2, 'user_id' => 4]);
     Admin::create(['type' => 1, 'user_id' => 1]);
     Entry::create(['timeIn' => Carbon::now(), 'user_id' => 2]);
     Model::reguard();
 }
 /**
  * Run the database seeds.
  */
 public function run()
 {
     Model::unguard();
     $if = ProgramStudi::create(['nama' => 'S1 Teknik Informatika', 'deskripsi' => 'Informatika adalah.....']);
     $ik = ProgramStudi::create(['nama' => 'S1 Ilmu Komputasi', 'deskripsi' => 'IK adalah.....']);
     $admin = Admin::create();
     $user = User::create(['nama' => 'feber', 'username' => 'feber', 'password' => bcrypt('feber'), 'userable_id' => $admin->id, 'userable_type' => User::TYPE_ADMIN]);
     $dosen = Dosen::create(['nip' => '053', 'prodi_id' => $if->id]);
     $user = User::create(['nama' => 'mahar', 'username' => 'mahar', 'password' => bcrypt('mahar'), 'userable_id' => $dosen->id, 'userable_type' => User::TYPE_DOSEN]);
     $dosen = Dosen::create(['nip' => '054', 'prodi_id' => $ik->id]);
     $user = User::create(['nama' => 'sendy', 'username' => 'sendy', 'password' => bcrypt('sendy'), 'userable_id' => $dosen->id, 'userable_type' => User::TYPE_DOSEN]);
     $mahasiswa = Mahasiswa::create(['nim' => '1103', 'prodi_id' => $if->id]);
     $user = User::create(['nama' => 'dimas', 'username' => 'dimas', 'password' => bcrypt('dimas'), 'userable_id' => $mahasiswa->id, 'userable_type' => User::TYPE_MAHASISWA]);
     $mahasiswa = Mahasiswa::create(['nim' => '1107', 'prodi_id' => $ik->id]);
     $user = User::create(['nama' => 'ali', 'username' => 'ali', 'password' => bcrypt('ali'), 'userable_id' => $mahasiswa->id, 'userable_type' => User::TYPE_MAHASISWA]);
     MataKuliah::create(['nama' => 'Desain Analisis Algoritma', 'kode' => 'CSG1xx', 'deskripsi' => 'Main algoritma...', 'prodi_id' => $if->id]);
     MataKuliah::create(['nama' => 'Algoritma Struktur Data', 'kode' => 'CSG2xx', 'deskripsi' => 'ASD...', 'prodi_id' => $if->id]);
     MataKuliah::create(['nama' => 'Data Mining', 'kode' => 'CSH1xx', 'deskripsi' => 'Main data...', 'prodi_id' => $ik->id]);
     Model::reguard();
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param \Illuminate\Http\Request $request
  *
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     DB::transaction(function () use($request) {
         $account = null;
         if ($request->role === User::TYPE_MAHASISWA) {
             $account = Mahasiswa::create(['nim' => $request->nim]);
             $account->prodi_id = $request->prodi_id;
         } elseif ($request->role === User::TYPE_DOSEN) {
             $account = Dosen::create(['nip' => $request->nip]);
             $account->prodi_id = $request->prodi_id;
         } else {
             $account = Admin::create();
         }
         $user = new User();
         $user->nama = $request->nama;
         $user->username = $request->username;
         $user->password = bcrypt($request->password);
         $user->userable_id = $account->id;
         $user->userable_type = get_class($account);
         $user->save();
     });
     return redirect('user');
 }
Beispiel #10
0
 public function administrator_edit(Request $request)
 {
     $roles = array_filter(explode(',', $request->input('roles')));
     if (!$request->input('id')) {
         //check if the username has already exists
         if (Admin::where('username', $request->input('username'))->first()) {
             return redirect()->back()->withErrors('The username has already existed!');
         }
         $lastInsert = Admin::create(array('username' => $request->input('username'), 'password' => md5($request->input('password'))));
         $insertAdminId = $lastInsert->id;
     } else {
         $insertAdminId = $request->input('id');
         if ($request->input('password')) {
             Admin::where('id', $insertAdminId)->update(['password' => md5($request->input('password'))]);
         }
         AdminRole::where('admin_id', $insertAdminId)->delete();
     }
     foreach ($roles as $one) {
         AdminRole::create(array('admin_id' => $insertAdminId, 'role_id' => $one));
     }
     return redirect()->back();
 }
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     return Admin::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
 }
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     $admin = Admin::create(['username' => $data['username'], 'password' => bcrypt($data['password']), 'firstname' => $data['firstname'], 'lastname' => $data['lastname']]);
     Auth::admin()->login($admin);
     return $admin;
 }
 public function run()
 {
     DB::table('admins')->delete();
     Admin::create(['email' => '*****@*****.**', 'first_name' => 'Kalyan', 'last_name' => 'Dey', 'password' => '123456']);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('admins')->truncate();
     Admin::create(['username' => 'mucyomiller', 'password' => Hash::make('1234'), 'firstname' => 'mucyo', 'lastname' => 'fred', 'job_title' => 'Full stack developer', 'education' => 'Bsc in Computer And Software Engineering', 'location' => 'Kigali,Rwanda', 'skills' => 'UI Design,Coding,Java,Python,PHP,JavaScript', 'email' => '*****@*****.**']);
 }
Beispiel #15
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(AdminRequest $request)
 {
     Admin::create(Request::all());
     return redirect('admin');
 }
Beispiel #16
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 public function create(array $data)
 {
     return Admin::create(['username' => $data['username'], 'password' => bcrypt($data['password'])]);
 }
Beispiel #17
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $succesReturn[] = 'Liste d\'utilisateurs ajouté en administrateurs :';
     if (isset($request->adm)) {
         foreach ($request->adm as $user) {
             /**
              * Ajouter la vérification que l'admin existe bien dans la table user
              */
             $userExist = User::where(['email' => $user, 'delete' => 0])->first();
             if ($userExist->count() === 0) {
                 $erreur = 'L\'utilisateur ' . $user . ' n\'existe pas';
             }
             if (isset($erreur)) {
                 $listeUser = $this->loadListUserNonAdmin();
                 return view('admin/adminAdministratorCreate', ['erreur' => $erreur, 'listeUser' => $listeUser]);
             } else {
                 $adminAlreadyExist = Admin::where(['id_facebook' => $userExist->id_facebook, 'delete' => 1]);
                 // Génération d'un mot de passe conforme aux normes
                 $char = 'abcdefghijklmnopqrstuvwxyz';
                 $pass = str_shuffle($char);
                 $pass = substr($pass, 1, 7);
                 $rand = rand(10, 99);
                 $password = $pass . $rand;
                 if ($adminAlreadyExist->count() !== 0) {
                     $adminAlreadyExist->update(['delete' => 0]);
                 } else {
                     // Enregistrement du nouvel administrateur
                     Admin::create(['id_facebook' => $userExist->id_facebook, 'email' => $userExist->email, 'password' => Hash::make($password)]);
                 }
                 $succesReturn[] = ' - ' . $userExist->email;
             }
         }
         $listeUser = $this->loadListUserNonAdmin();
         return view('admin/adminAdministratorCreate', ['success' => $succesReturn, 'listeUser' => $listeUser]);
     }
     return redirect(route('admin.create'))->with('success', 'L\'administrateur a bien été modifié');
 }
 /**
  * Create a new admin level user.
  *
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function createNewAdmin(Request $request)
 {
     $data = $request->all();
     $adminUser = User::where('role', 'admin')->first();
     $admin = Admin::where('email', $adminUser->email)->first();
     // Edit the admin account details
     $admin->email = $data['email'];
     $ts = $admin->last_login_ts;
     $admin->delete();
     // Edit admin details in the login table
     $adminUser->email = $data['email'];
     $adminUser->save();
     // Create new Admin entry for the above user
     Admin::create(['email' => $data['email'], 'last_login_ts' => $ts]);
     /*// Create new User
       User::create([
           'email' => $data['email'],
           'password' => bcrypt($data['password']),
           'role' => "admin"
       ]);*/
     // Send notification mail to the newly created Admin.
     Mail::send('emails.newAdmin', [], function ($message) use($data) {
         $message->from(env('MAIL_FROM'), env('MAIL_NAME'));
         $message->to($data['email'])->subject('Welcome to the team!');
     });
     return redirect('admin_users')->with('status', 'Email Account changed.');
 }
Beispiel #19
0
 public function run()
 {
     DB::table('admins')->delete();
     Admin::create(array('name' => 'Giovanni', 'email' => '*****@*****.**', 'password' => Hash::make('password')));
 }
 public function run()
 {
     DB::table('ppl_koperasi_admins')->delete();
     Admin::create(array('username' => 'admin', 'password' => Hash::make('admin')));
 }