diff --git a/app/Factory/ProductFactory.php b/app/Factory/ProductFactory.php index a9078606408d..e3708a096af4 100644 --- a/app/Factory/ProductFactory.php +++ b/app/Factory/ProductFactory.php @@ -25,7 +25,7 @@ class ProductFactory $product->notes = ''; $product->cost = 0; $product->price = 0; - $product->quantity = 0; + $product->quantity = 1; $product->tax_name1 = ''; $product->tax_rate1 = 0; $product->tax_name2 = ''; diff --git a/app/Jobs/User/CreateUser.php b/app/Jobs/User/CreateUser.php index 79314d22aa65..1a636fa9daf5 100644 --- a/app/Jobs/User/CreateUser.php +++ b/app/Jobs/User/CreateUser.php @@ -65,6 +65,7 @@ class CreateUser $user->confirmation_code = $this->createDbHash(config('database.default')); $user->fill($this->request); $user->email = $this->request['email'];//todo need to remove this in production + $user->last_login = now(); $user->save(); $user->companies()->attach($this->company->id, [ diff --git a/app/Models/User.php b/app/Models/User.php index ee4443ebd3c3..4c266520c170 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -23,6 +23,7 @@ use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; +use Illuminate\Support\Carbon; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; use Laracasts\Presenter\PresentableTrait; @@ -89,7 +90,7 @@ class User extends Authenticatable implements MustVerifyEmail 'updated_at' => 'timestamp', 'created_at' => 'timestamp', 'deleted_at' => 'timestamp', - 'last_login' => 'timestamp', + //'last_login' => 'timestamp', ]; public function getHashedIdAttribute() @@ -97,6 +98,7 @@ class User extends Authenticatable implements MustVerifyEmail return $this->encodePrimaryKey($this->id); } + /** * Returns a account. * @@ -312,4 +314,13 @@ class User extends Authenticatable implements MustVerifyEmail { return $this->morphMany(Document::class, 'documentable'); } + + public function getEmailVerifiedAt() + { + if($this->email_verified_at) + return Carbon::parse($user->email_verified_at)->timestamp; + else + return null; + + } } diff --git a/app/Transformers/ClientTransformer.php b/app/Transformers/ClientTransformer.php index 8ffcf2669033..af4735fd2f68 100644 --- a/app/Transformers/ClientTransformer.php +++ b/app/Transformers/ClientTransformer.php @@ -1,4 +1,3 @@ - $this->encodePrimaryKey($user->id), 'first_name' => $user->first_name ?: '', 'last_name' => $user->last_name ?: '', 'email' => $user->email ?: '', - 'last_login' => $user->last_login ?: '', + 'last_login' => Carbon::parse($user->last_login)->timestamp, 'updated_at' => $user->updated_at, 'deleted_at' => $user->deleted_at, 'phone' => $user->phone ?: '', - 'email_verified_at' => $user->email_verified_at ?: '', + 'email_verified_at' => $user->getEmailVerifiedAt(), 'signature' => $user->signature ?: '', ]; } diff --git a/database/migrations/2014_10_13_000000_create_users_table.php b/database/migrations/2014_10_13_000000_create_users_table.php index edf1bae5cc30..872c794c3a5c 100644 --- a/database/migrations/2014_10_13_000000_create_users_table.php +++ b/database/migrations/2014_10_13_000000_create_users_table.php @@ -224,7 +224,7 @@ class CreateUsersTable extends Migration $table->unsignedInteger('avatar_width')->nullable(); $table->unsignedInteger('avatar_height')->nullable(); $table->unsignedInteger('avatar_size')->nullable(); - $table->timestamp('last_login')->nullable(); + $table->datetime('last_login')->nullable(); $table->text('signature')->nullable(); $table->string('password'); $table->rememberToken();