Commit 11ee4daf authored by Eric Seigne's avatar Eric Seigne
Browse files

Merge branch 'master' of inligit.fr:doliscan/server

parents 9351eae4 059c9dda
......@@ -59,7 +59,15 @@ class Vehicule extends Model
*/
protected $fillable = ['number', 'name', 'energy', 'power', 'type', 'kmbefore', 'details', 'is_perso', 'user_id'];
//
protected $attributes = [
'name' => "A COMPLETER",
'energy' => "essence",
'power' => "2",
'type' => "vp",
'kmbefore' => "0",
'is_perso' => 1,
];
public function user()
{
return $this->belongsTo(User::class);
......@@ -247,13 +255,13 @@ class Vehicule extends Model
//On en créé un à partir des données du post
$v = Vehicule::create(
[
"number" => Vehicule::extractVehiculeImmatFromString($str),
"name" => Vehicule::extractVehiculeNameFromString($str),
"energy" => Vehicule::extractVehiculeCarburantFromString($str),
"power" => Vehicule::extractVehiculeCVFromString($str),
"type" => Vehicule::extractVehiculeTypeFromString($str),
"kmbefore" => Vehicule::extractVehiculeKMBeforeFromString($str),
"user_id" => Auth::user()->id,
'number' => Vehicule::extractVehiculeImmatFromString($str) ? Vehicule::extractVehiculeImmatFromString($str) : '0',
'name' => Vehicule::extractVehiculeNameFromString($str) ? Vehicule::extractVehiculeNameFromString($str) : 'A RENSEIGNER',
'energy' => Vehicule::extractVehiculeCarburantFromString($str),
'power' => Vehicule::extractVehiculeCVFromString($str),
'type' => Vehicule::extractVehiculeTypeFromString($str) ? Vehicule::extractVehiculeTypeFromString($str) : 'vp',
'kmbefore' => Vehicule::extractVehiculeKMBeforeFromString($str) ? Vehicule::extractVehiculeKMBeforeFromString($str) : 0,
'user_id' => Auth::user()->id,
]
);
return $v;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment