public function testDelete()
 {
     $userDelete = User::all()->last();
     $this->seeInDatabase('users', ['email' => $userDelete->email]);
     $this->visit('/user/destroy/' . $userDelete->id);
     $this->seeIsSoftDeletedInDatabase('users', ['email' => $userDelete->email]);
 }
 public function testInviteExistingUser()
 {
     $lastUserId = User::all()->last()['id'];
     $lastRememberToken = User::where('email', '*****@*****.**')->first()['remember_token'];
     $this->visit('/')->see('invite user');
     $this->visit('/invite')->type('*****@*****.**', 'email')->press('Enviar')->seePageIs('/invite')->see('reenviado com sucesso');
     $this->assertEquals($lastUserId, User::all()->last()['id']);
     $this->assertNotEquals($lastRememberToken, User::all()->last()['remember_token']);
 }
 public function testAccessDeniedCompany()
 {
     $idAccessDenied = User::all()->last()['id'];
     $user = factory(\App\Entities\User::class)->create();
     $user->setUp();
     $this->actingAs($user);
     $this->visit('/user/' . $idAccessDenied . '/edit');
     $this->see(Lang::get('general.accessdenied'));
     $this->visit('/user/destroy/' . $idAccessDenied);
     $this->see(Lang::get('general.accessdenied'));
 }
Example #4
0
 public function all()
 {
     // $data=[];
     // foreach ($this->user->all() as $e) {
     // 	$e->nama =$e->name;
     // 	$e->kode=base64_decode($e->id);
     // 	$e->slug=str_replace("",'-',strtolower($e->name));
     // 	$data[]=$e;
     // }
     // return $data;
     // return User::all();
     $data = User::all();
     $collection = $data->map(function ($item, $key) {
         $item->alamat = "busam";
         // $item->address= $this->alamat;
         return $item;
     });
     return $collection;
 }
<?php

/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
$factory->define(App\Entities\User::class, function (Faker\Generator $faker) {
    return ['name' => $faker->name, 'email' => $faker->email, 'password' => bcrypt(str_random(10)), 'remember_token' => str_random(10)];
});
$factory->define(App\Entities\Client::class, function (Faker\Generator $faker) {
    return ['name' => $faker->name, 'responsible' => $faker->name, 'email' => $faker->email, 'phone' => $faker->phoneNumber, 'address' => $faker->address, 'obs' => $faker->sentence];
});
$factory->define(App\Entities\Project::class, function (Faker\Generator $faker) {
    return ['user_id' => \App\Entities\User::all()->lists('id')->random(1), 'client_id' => \App\Entities\Client::all()->lists('id')->random(1), 'name' => $faker->word, 'description' => $faker->sentence, 'progress' => $faker->NumberBetween(0, 100), 'status' => $faker->numberBetween(1, 3), 'due_date' => $faker->date];
});
 public function all()
 {
     return User::all();
 }
 public function update($idUser)
 {
     try {
         $user = $this->userRepo->find($idUser);
         $this->helper->validateRecord($user);
         $this->userRepo->validator();
         $contact = $this->contactRepo->find($user->contact_id);
         $this->helper->validateRecord($contact);
         $this->contactRepo->validator();
         $inputs = $this->userRepo->setInputs($this->request->all(), $user);
         $this->userRepo->update($inputs, $idUser);
         User::all()->last()->assignRole($inputs['role_id']);
         $this->contactRepo->update($inputs, $user->contact_id);
         \Cache::flush();
         return $this->redirect->to('user')->with('message', Lang::get('general.succefullupdate', ['table' => Lang::get('general.User')]));
     } catch (ValidatorException $e) {
         return $this->redirect->back()->withInput()->with('errors', $e->getMessageBag());
     }
 }