42 lines
817 B
PHP
Executable File
42 lines
817 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();
|
|
// var_dump($i);
|
|
return $i;
|
|
}
|
|
}
|