unioil-loyalty-app/app/Services/SignUpAPICallsService.php

59 lines
1.2 KiB
PHP

<?php
namespace App\Services;
use Response;
use Schema;
use Hash;
use Illuminate\Http\Request;
use App\Libraries\ListHelper;
use App\Contracts\SignUpAPICallsInterface;
use App\SignUpAPICalls;
use App\Helpers\HttpStatusCode;
class SignUpAPICallsService implements SignUpAPICallsInterface
{
public $otp_attempts;
public $otpatt_id;
public function log($user_id)
{
$this->call = new SignUpAPICalls;
$this->call->user_id = $user_id;
$this->call->created_at = date('Y-m-d H:i:s');
if($this->call->save())
return $this->call->signup_api_id;
else
return false;
}
public function success($signup_api_id,$lcard_id)
{
$this->call = SignUpAPICalls::where('signup_api_id',$signup_api_id)->first();
$this->call->lcard_id = $lcard_id;
if($this->call->save())
return true;
else
return false;
}
public function count($date = '')
{
if($date == '')
$date = date('Y-m-d');
$data = SignUpAPICalls::where('created_at','>=',$date.' 00:00:00')
->where('created_at','<=',$date.' 23:59:59')
->count();
return $data;
}
}