Skip to content

Commit 3c775c4

Browse files
committed
Add datetimepicker and do validdation datetime user.
1 parent b9fb4cd commit 3c775c4

File tree

131 files changed

+34288
-24142
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+34288
-24142
lines changed

app/User.php

+28-10
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static function boot()
3535
{
3636
parent::boot();
3737
self::saving(function ($model) {
38-
$model->created_by = \Auth::user()->id;
38+
if (!\Auth::guest()) $model->created_by = \Auth::user()->id;
3939
$model->setExtraFields();
4040
});
4141
}
@@ -64,15 +64,27 @@ public function isSubAdmin()
6464

6565
public function setExtraFields()
6666
{
67-
$this->zip_code = Input::post('zip_code');
68-
$this->city_id = Input::post('city_id');
69-
$this->address = Input::post('address');
70-
$this->neighborhood = Input::post('neighborhood');
71-
$this->is_company = Input::post('is_company') == "true";
72-
$this->cpf_cnpj = Input::post('cpf_cnpj');
73-
$this->accession = \Helper::moneyToFloat(Input::post('accession'));
74-
$this->payment_day = Input::post('payment_day');
75-
$this->payment_monthy = \Helper::moneyToFloat(Input::post('payment_monthy'));
67+
if ($zip_code = Input::post('zip_code'))
68+
$this->zip_code = $zip_code;
69+
if ($city_id = Input::post('city_id'))
70+
$this->city_id = $city_id;
71+
if ($address = Input::post('address'))
72+
$this->address = $address;
73+
if ($neighborhood = Input::post('neighborhood'))
74+
$this->neighborhood = $neighborhood;
75+
if ($is_company = Input::post('is_company'))
76+
$this->is_company =$is_company;
77+
if ($cpf_cnpj = Input::post('cpf_cnpj'))
78+
$this->cpf_cnpj = $cpf_cnpj;
79+
if ($accession = Input::post('accession'))
80+
$this->accession = \Helper::moneyToFloat($accession);
81+
if ($payment_day = Input::post('payment_day'))
82+
$this->payment_day = $payment_day;
83+
if ($payment_monthy = Input::post('payment_monthy'))
84+
$this->payment_monthy = \Helper::moneyToFloat($payment_monthy);
85+
if ($validation = Input::post('validation')) {
86+
$this->validation = \Helper::parseDate($validation);
87+
}
7688
}
7789

7890
public function city()
@@ -84,4 +96,10 @@ public function contacts()
8496
{
8597
return $this->hasMany('App\Contact', 'id', 'user_id');
8698
}
99+
100+
public function invalid()
101+
{
102+
if (!$this->validation) return false;
103+
return strtotime($this->validation) < strtotime(date("Y-m-d H:i:s"));
104+
}
87105
}

composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"require": {
1111
"php": ">=7.0",
1212
"alexusmai/laravel-file-manager": "^2.2",
13+
"doctrine/dbal": "^2.9",
1314
"farhanwazir/laravelgooglemaps": "^2.3",
1415
"jeremykenedy/laravel-roles": "^1.4",
1516
"jeremykenedy/laravel-users": "^3.1",

0 commit comments

Comments
 (0)