public function claim_license()
{
$licenseKey = Input::get('license_key');
$productId = Input::get('product_id', PRODUCT_ONE_CLICK_INSTALL);
$license = License::where('license_key', '=', $licenseKey)->where('is_claimed', '<', 10)->where('product_id', '=', $productId)->first();
if ($license) {
if ($license->transaction_reference != 'TEST_MODE') {
$license->is_claimed = $license->is_claimed + 1;
$license->save();
}
if ($productId == PRODUCT_INVOICE_DESIGNS) {
return file_get_contents(storage_path() . '/invoice_designs.txt');
} else {
// temporary fix to enable previous version to work
if (Input::get('get_date')) {
return $license->created_at->format('Y-m-d');
} else {
return 'valid';
}
}
} else {
return RESULT_FAILURE;
}
}