fix: Fix check on salarie and customer relation
This commit is contained in:
parent
2da57afa29
commit
0366644c4f
2 changed files with 2 additions and 2 deletions
|
|
@ -152,7 +152,7 @@ class CustomerController extends Controller
|
||||||
/** @var Customers|null */
|
/** @var Customers|null */
|
||||||
$customer = Customers::where('email', $request->email)->first();
|
$customer = Customers::where('email', $request->email)->first();
|
||||||
|
|
||||||
if ($customer && $customer->isNoLongerEmployed()) {
|
if ($customer and $customer->isNoLongerEmployed()) {
|
||||||
$customer->remember_token = null;
|
$customer->remember_token = null;
|
||||||
$customer->saveOrFail();
|
$customer->saveOrFail();
|
||||||
return back()->withErrors(
|
return back()->withErrors(
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ class Customers extends Authenticatable
|
||||||
*/
|
*/
|
||||||
public function isNoLongerEmployed()
|
public function isNoLongerEmployed()
|
||||||
{
|
{
|
||||||
if (!$this->salarie->end_date) {
|
if (!$this->salarie or !$this->salarie->end_date) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return Carbon::parse($this->salarie->end_date)->lessThanOrEqualTo(Carbon::now());
|
return Carbon::parse($this->salarie->end_date)->lessThanOrEqualTo(Carbon::now());
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue