Skip to content

Instantly share code, notes, and snippets.

@seedprod
Created September 13, 2017 12:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seedprod/c92df1c64e9950d56ddede2d38200e04 to your computer and use it in GitHub Desktop.
Save seedprod/c92df1c64e9950d56ddede2d38200e04 to your computer and use it in GitHub Desktop.
<?php
// Record Source
try {
$seedprod_source = $_COOKIE['seedprod_source'];
$source = '';
if(!empty($seedprod_source)){
$source = explode("|",$seedprod_source)[0];
$dt = date("Y-m-d H:i:s",explode("|",$seedprod_source)[1]);
$order = Order::find($data['order']->id);
$order->source = $source;
$order->source_datetime = $dt;
$order->save();
\Cookie::queue(\Cookie::forget('seedprod_source'));
}
$data['source'] = $source;
}catch(\Exception $e){
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment