mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
transform datetimes to timestamps
This commit is contained in:
parent
187fb67275
commit
1f1ffd3240
@ -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 = '';
|
||||
|
@ -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, [
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com)
|
||||
|
@ -20,6 +20,7 @@ use App\Transformers\CompanyTokenTransformer;
|
||||
use App\Transformers\CompanyTransformer;
|
||||
use App\Transformers\CompanyUserTransformer;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class UserTransformer extends EntityTransformer
|
||||
{
|
||||
@ -44,16 +45,17 @@ class UserTransformer extends EntityTransformer
|
||||
|
||||
public function transform(User $user)
|
||||
{
|
||||
|
||||
return [
|
||||
'id' => $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 ?: '',
|
||||
];
|
||||
}
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user