/** * Run the database seeds. * * @return void */ public function run() { /** * Users */ // ID 2 \VisualAppeal\Connect\User::create(['first_name' => 'Arno', 'last_name' => 'Nym', 'email' => '*****@*****.**', 'password' => password_hash('Test', PASSWORD_DEFAULT), 'activated' => 1, 'activated_at' => \Carbon\Carbon::now()->subDays(5), 'last_login' => \Carbon\Carbon::now()->subDays(1)]); // ID 3 - NOT ACTIVATED \VisualAppeal\Connect\User::create(['first_name' => 'Tom', 'last_name' => 'Test', 'email' => '*****@*****.**', 'password' => password_hash('123456', PASSWORD_DEFAULT), 'activated' => 0, 'comment' => 'IBM']); // ID 4 \VisualAppeal\Connect\User::create(['first_name' => 'Max', 'last_name' => 'Test', 'email' => '*****@*****.**', 'password' => password_hash('654321', PASSWORD_DEFAULT), 'activated' => 1, 'activated_at' => \Carbon\Carbon::now()->subDays(614), 'last_login' => \Carbon\Carbon::now()->subDays(12)]); // ID 1 \VisualAppeal\Connect\ClientProfile::create(['client_id' => 4, 'title' => 'phone-private', 'value' => '+49 202 74617821']); // ID 2 \VisualAppeal\Connect\ClientProfile::create(['client_id' => 4, 'title' => 'phone-business', 'value' => '+49 202 74617822']); // ID 5 \VisualAppeal\Connect\User::create(['first_name' => 'Jack', 'last_name' => 'Bauer', 'email' => '*****@*****.**', 'password' => password_hash('24', PASSWORD_DEFAULT), 'activated' => 1, 'activated_at' => \Carbon\Carbon::now()->subDays(214), 'last_login' => \Carbon\Carbon::now()->subDays(4)]); // ID 6 \VisualAppeal\Connect\User::create(['first_name' => 'Katy', 'last_name' => 'Holmes', 'email' => '*****@*****.**', 'password' => password_hash('tom', PASSWORD_DEFAULT), 'activated' => 1, 'activated_at' => \Carbon\Carbon::now()->subDays(872), 'last_login' => \Carbon\Carbon::now()->subDays(3)]); /** * Clients */ // ID 1 \VisualAppeal\Connect\Client::create(['first_name' => 'Max', 'last_name' => 'Black', 'form_of_address' => 'Prof. Dr.', 'email' => '*****@*****.**', 'website' => 'http://example.com', 'sex' => 'female', 'birthday' => '1980-04-12']); }
/** * Validate the input and store the profile field in the database. * * @param \Illuminate\Http\Request $request * @param int $clientId * * @return Response */ public function store(Request $request, $clientId) { $client = Client::findOrFail($clientId); $this->validate($request, $this->createProfileRules); $profile = ClientProfile::create(['client_id' => $client->id, 'title' => $request->input('title'), 'value' => $request->input('value'), 'translatable' => $request->input('translatable', false)]); if (!isset($profile)) { abort(503); } return redirect()->route('client.show', ['client' => $client->id]); }
/** * Create a random ClientProfile field. * * @param VisualAppeal\Connect\Client $client (Default: null, newly created) * * @return VisualAppeal\Connect\ClientProfile */ protected function createClientProfile($client = null) { $client = $client ?: $this->createClient(); return \VisualAppeal\Connect\ClientProfile::create(['client_id' => $client->id, 'title' => strtolower($this->faker->word), 'value' => $this->faker->sentence($this->faker->numberBetween(1, 2)), 'translatable' => false]); }