/**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('admins', function ($table) {
         $table->increments('id');
         $table->string('email');
         $table->string('password');
         $table->text('permissions')->nullable();
         $table->boolean('activated')->default(0);
         $table->string('activation_code')->nullable();
         $table->timestamp('activated_at')->nullable();
         $table->timestamp('last_login')->nullable();
         $table->string('persist_code')->nullable();
         $table->string('reset_password_code')->nullable();
         $table->string('remember_token', 100)->nullable();
         $table->string('first_name')->nullable();
         $table->string('last_name')->nullable();
         $table->timestamps();
         // We'll need to ensure that MySQL uses the InnoDB engine to
         // support the indexes, other engines aren't affected.
         $table->engine = 'InnoDB';
         $table->unique('email');
         $table->index('activation_code');
         $table->index('reset_password_code');
     });
     Admin::create(array('email' => '*****@*****.**', 'password' => Hash::make('12345')));
 }
    public function postEdit() {

        $admin  = Admin::find(\Auth::user()->id);
        $inputs = \Input::all();
        $admin->update($inputs);
        $admin->save();
        return \View('panelViews::editProfile')->with(array('admin'   => $admin,
                                                            'message' => \Lang::get('panel::fields.successfullEditProfile')));
    }
Exemple #3
0
 public function postEdit()
 {
     $demo = false;
     if (\Config::get('panel.demo') == true) {
         $demo = true;
     }
     $admin = Admin::find(\Auth::user()->id);
     $inputs = \Input::all();
     $admin->update($inputs);
     $admin->save();
     return \View('panelViews::editProfile')->with(array('admin' => $admin, 'message' => \Lang::get('panel::fields.successfullEditProfile'), 'demo_status' => $demo));
 }
 public function all($entity)
 {
     parent::all($entity);
     $this->filter = \DataFilter::source(Admin::with('roles'));
     $this->filter->add('id', 'ID', 'text');
     $this->filter->add('firstname', 'First name', 'text');
     $this->filter->add('last_name', 'Last Name', 'text');
     $this->filter->add('email', 'Email', 'text');
     $this->filter->submit('search');
     $this->filter->reset('reset');
     $this->filter->build();
     $this->grid = \DataGrid::source($this->filter);
     $this->grid->add('id', 'ID', true)->style("width:100px");
     $this->grid->add('{{ $first_name }} {{ $last_name}}', 'first name');
     $this->grid->add('email', 'Email');
     $this->grid->add('{{ implode(", ", $roles->pluck("name")->all()) }}', 'Role');
     $this->addStylesToGrid();
     return $this->returnView();
 }
 public function postChangePassword()
 {
     $user = Admin::find(\Auth::guard('panel')->user()->id);
     $password = Input::only('current_password');
     $new_password = Input::only('password');
     $retype_password = Input::only('password_confirmation');
     $user_password = \Auth::guard('panel')->user()->password;
     //Check to see if user enters current password correctly
     if (\Hash::check($password['current_password'], $user_password)) {
         if ($new_password['password'] == $retype_password['password_confirmation']) {
             $user->password = \Hash::make($new_password['password']);
             $user->save();
             return \Redirect::to('/panel/changePassword')->with('message', 'Successfully Changed Your Password!!');
         } else {
             return \Redirect::to('/panel/changePassword')->with('message', 'Passwords not matched!!')->with('mesType', 'error');
         }
     } else {
         return \Redirect::to('/panel/changePassword')->with('message', 'Password is not correct!!')->with('mesType', 'error');
     }
 }