@@ -123,6 +123,11 @@ public function fire()
123123 $ user_asset_notes = '' ;
124124 }
125125
126+ if (array_key_exists ('9 ' ,$ row )) {
127+ $ user_asset_purchase_date = date ("Y-m-d 00:00:01 " , strtotime ($ row [10 ]));
128+ } else {
129+ $ user_asset_purchase_date = '' ;
130+ }
126131
127132 // A number was given instead of a name
128133 if (is_numeric ($ user_name )) {
@@ -131,6 +136,8 @@ public function fire()
131136
132137 } elseif ($ user_name =='' ) {
133138 $ this ->comment ('No user data provided - skipping user creation, just adding asset ' );
139+ $ first_name = '' ;
140+ $ last_name = '' ;
134141 } else {
135142
136143 $ name = explode (" " , $ user_name );
@@ -169,24 +176,27 @@ public function fire()
169176 $ user_email = str_replace ("' " ,'' ,$ email );
170177 }
171178
172- $ this ->comment ('Full Name: ' .$ user_name );
173- $ this ->comment ('First Name: ' .$ first_name );
174- $ this ->comment ('Last Name: ' .$ last_name );
175- $ this ->comment ('Email: ' .$ user_email );
176- $ this ->comment ('Category Name: ' .$ user_asset_category );
177- $ this ->comment ('Item: ' .$ user_asset_name );
178- $ this ->comment ('Manufacturer ID: ' .$ user_asset_mfgr );
179- $ this ->comment ('Model No: ' .$ user_asset_modelno );
180- $ this ->comment ('Serial No: ' .$ user_asset_serial );
181- $ this ->comment ('Asset Tag: ' .$ user_asset_tag );
182- $ this ->comment ('Location: ' .$ user_asset_location );
183- $ this ->comment ('Notes: ' .$ user_asset_notes );
179+
184180
185181 }
186182
183+ $ this ->comment ('Full Name: ' .$ user_name );
184+ $ this ->comment ('First Name: ' .$ first_name );
185+ $ this ->comment ('Last Name: ' .$ last_name );
186+ $ this ->comment ('Email: ' .$ user_email );
187+ $ this ->comment ('Category Name: ' .$ user_asset_category );
188+ $ this ->comment ('Item: ' .$ user_asset_name );
189+ $ this ->comment ('Manufacturer ID: ' .$ user_asset_mfgr );
190+ $ this ->comment ('Model No: ' .$ user_asset_modelno );
191+ $ this ->comment ('Serial No: ' .$ user_asset_serial );
192+ $ this ->comment ('Asset Tag: ' .$ user_asset_tag );
193+ $ this ->comment ('Location: ' .$ user_asset_location );
194+ $ this ->comment ('Purchase Date: ' .$ user_asset_purchase_date );
195+ $ this ->comment ('Notes: ' .$ user_asset_notes );
196+
187197 $ this ->comment ('------------- Action Summary ---------------- ' );
188198
189- if (isset ( $ user_email) ) {
199+ if ($ user_email!= '' ) {
190200 if ($ user = User::where ('email ' , $ user_email )->first ()) {
191201 $ this ->comment ('User ' .$ user_email .' already exists ' );
192202 } else {
@@ -304,6 +314,7 @@ public function fire()
304314 $ asset ->rtd_location_id = $ location ->id ;
305315 $ asset ->user_id = 1 ;
306316 $ asset ->status_id = $ status_id ;
317+ $ asset ->purchase_date = $ user_asset_purchase_date ;
307318 $ asset ->notes = e ($ user_asset_notes );
308319
309320 if ($ asset ->save ()) {
0 commit comments