57 lines
906 B
PHP
Executable File
57 lines
906 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Models\paypal;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class PayPalModel extends Model
|
|
{
|
|
|
|
function insertToPaypalDetails($data)
|
|
{
|
|
|
|
$i = DB::table('payment_details')->insertGetId($data);
|
|
return $i;
|
|
}
|
|
|
|
|
|
function insertToOrders($ck)
|
|
{
|
|
|
|
// $i = DB::table('orders')->insert($data);
|
|
$pdo = DB::connection()->getPdo();
|
|
|
|
$query = $pdo->prepare("INSERT INTO orders SELECT * FROM cart_tmp where CartKey = '$ck'");
|
|
$i = $query->execute();
|
|
|
|
return $i;
|
|
}
|
|
|
|
function insertShippingAddress($data)
|
|
{
|
|
|
|
$i = DB::table('shipping_addresses')->insert($data);
|
|
return $i;
|
|
}
|
|
|
|
function getLastIdPaymentDetails()
|
|
{
|
|
|
|
$i = DB::table('payment_details')
|
|
->orderby('Id', 'DESC')
|
|
->take(1)
|
|
->get();
|
|
return $i;
|
|
}
|
|
|
|
function checkCartKey($ck)
|
|
{
|
|
|
|
$i = DB::table('payment_details')
|
|
->where('CartKey', $ck)
|
|
->get();
|
|
return $i;
|
|
}
|
|
}
|