/** * @todo find out why post payload is empty * @test */ public function it_registers_new_user() { $payload = ['email' => $this->fake->email, 'password' => $this->fake->word, 'first_name' => $this->fake->firstName, 'last_name' => $this->fake->lastName]; $this->assertEquals(0, App\User::count()); $response = $this->call('post', '/register', $payload); $this->assertEquals(200, $response->getStatusCode()); $this->assertEquals(1, App\User::count()); }
return view('pages/over'); }); Route::post('over', function () { return redirect('over')->with('message', 'Het is helaas nog niet mogelijk om in te loggen.'); }); /* * Login and logout routes */ Route::get('login', 'Auth\\AuthController@getLogin'); Route::post('login', 'Auth\\AuthController@postLogin'); Route::get('logout', 'Auth\\AuthController@getLogout'); /* * First run (setup) */ Route::get('setup', function () { $users = App\User::count(); if ($users == 0) { $demo = new App\User(); $user->name = "Demo Account"; $user->email = "*****@*****.**"; $user->password = Hash::make("@welkom_demo_01"); $user->save(); } return redirect('/'); }); /* * Project route group */ Route::group(['middleware' => 'auth', 'prefix' => 'project'], function () { /* * HTTP GET request for project index
<?php /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ Route::get('/', ['middleware' => 'auth', function () { $user = App\User::count(); $inventario = App\Inventario::count(); $centro = App\CentroCosto::count(); $sector = App\Sector::count(); return view('main')->with("sector", $sector)->with("centro", $centro)->with("inventario", $inventario)->with("user", $user); }]); Route::controller('productos', 'ProductoController'); Route::controller('inventario', 'InventarioController'); Route::controller('bien-activo', 'BienActivoController'); Route::controller('bien-registro', 'BienRegistroController'); Route::controller('bien-licencia', 'BienLicenciaController'); Route::controller('bien-raiz', 'BienRaizController'); Route::controller('usuarios', 'UsuariosController'); Route::controller('categorias', 'CategoriasController'); Route::controller('centrocosto', 'CentroCostoController'); Route::controller('sector', 'SectorController'); Route::controller('login', 'LoginController');
<?php /** * @var Illuminate\Database\Eloquent\Factory $factory */ $factory->define(App\User::class, function (Faker\Generator $faker) { return ['name' => $faker->name, 'email' => $faker->email, 'phone' => $faker->phoneNumber, 'password' => bcrypt('password'), 'remember_token' => str_random(10)]; }); $userCount = App\User::count(); $factory->define(App\Task::class, function (Faker\Generator $faker) use($userCount) { return ['user_id' => mt_rand(1, $userCount), 'status_id' => mt_rand(1, 2), 'text' => $faker->paragraph(1), 'answer' => $faker->word]; });
/** * Run the database seeds. * * @return void */ public function run() { if (App\User::count() === 0) { App\User::create(['name' => 'Joe', 'email' => '*****@*****.**', 'password' => Hash::make('bbc')]); } }