74 lines
1.4 KiB
PHP
Executable File
74 lines
1.4 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use Response;
|
|
use Schema;
|
|
use Hash;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use App\Contracts\MpinCodesResourceInterface;
|
|
use App\MpinCodes;
|
|
|
|
class MpinCodesService implements MpinCodesResourceInterface
|
|
{
|
|
|
|
public $mpin;
|
|
|
|
public function __construct(Request $request)
|
|
{
|
|
|
|
}
|
|
|
|
public function getCodes($field,$value)
|
|
{
|
|
$details = MpinCodes::whereIn($field,$value)->get();
|
|
return $details;
|
|
}
|
|
|
|
public function getMpin($customerNumber)
|
|
{
|
|
$this->mpin = MpinCodes::where([
|
|
'customer_number' => $customerNumber
|
|
])->first();
|
|
return $this->mpin;
|
|
}
|
|
|
|
public function updateMpin($customerNumber,$data){
|
|
$this->mpin = MpinCodes::where([
|
|
'customer_number' => $customerNumber
|
|
])->first();
|
|
|
|
$this->mpin->mpin_code = $data['mpin_code'];
|
|
|
|
if ($this->mpin->save())
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public function store($data)
|
|
{
|
|
$this->mpin = new MpinCodes;
|
|
|
|
$this->mpin->customer_number = $data['customer_number'];
|
|
$this->mpin->mpin_code = $data['mpin_code'];
|
|
|
|
if ($this->mpin->save())
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
}
|
|
|