Skip to content

Instantly share code, notes, and snippets.

@brandonsueur
Created September 14, 2019 23:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brandonsueur/907b7899f9d29a9b439eb831865e8275 to your computer and use it in GitHub Desktop.
Save brandonsueur/907b7899f9d29a9b439eb831865e8275 to your computer and use it in GitHub Desktop.
php
<?php
protected function create(array $data)
{
$user = User::create([
'first_name' => $data['first_name'],
'last_name' => $data['last_name'],
'username' => strtolower($data['first_name'] . $data['last_name']),
'phone' => $data['phone'],
'email' => $data['email'],
'verified' => false,
'role' => 'admin',
'user_type' => 'carrier',
'password' => Hash::make($data['password']),
]);
\LogActivity::addToLog('user(carrier):created');
Company::create([
'boss_id' => $user->id,
'name' => $data['name'],
'siret' => $data['siret'],
'address' => $data['address'],
'legal_redress' => $data['legal_redress'],
'customer_reference' => $data['customer_reference'],
'judicial_liquidation' => $data['judicial_liquidation'],
'turnover' => $data['turnover'],
'net_profit' => $data['net_profit'],
'employees_count' => $data['employees_count'],
'insurance_document' => "toto",
]);
return redirect()
->action('UsersController@show')
->with('success', "Votre compte a bien été créé")
->with('warning', "Le compte vous sera validé sous 24 heures ouvrées");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment