<?php
namespace App\Services;

use App\User;
use Carbon\Carbon;

class UserHelper
{

    public static $user_country;
    public static $shipping_country;
    public static $shipping_free = false;
    public static $user_tax_free = false;
    public static $user_reverse_charge = false;


    public static function isActive(User $user){
        return ($user->active == 1 && $user->blocked == 0) ? true : false;
    }


    public static function isActiveAccount(User $user){
   
        if(self::isActive($user) && $user->payment_account){
            return Carbon::parse($user->payment_account)->gt(Carbon::now());
        }
        return false;
    }

    public static function isActiveAccountByID($user_id){
        $user = User::find($user_id);
        return self::isActiveAccount($user);
    }

    public static function isActiveByID($user_id){
        $user = User::find($user_id);
        return self::isActive($user);
    }

}