mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 04:14:04 +00:00
get_time_limit
This commit is contained in:
@@ -29,7 +29,8 @@ class BookingController extends Controller
|
||||
// set timeout
|
||||
$date1 = new DateTime($booking->created_at);
|
||||
$date2 = new DateTime();
|
||||
$difference_in_seconds = ($date1->format('U') + 600) - ($date2->format('U'));
|
||||
$time_in_seconds = SettingCredit::orderby('updated_at','desc')->first()->time_limit;
|
||||
$difference_in_seconds = ($date1->format('U') + $time_in_seconds) - ($date2->format('U'));
|
||||
$booking->timeout = $difference_in_seconds;
|
||||
|
||||
// TODO : you can make it better
|
||||
@@ -79,7 +80,8 @@ class BookingController extends Controller
|
||||
// set timeout
|
||||
$date1 = new DateTime($booking->created_at);
|
||||
$date2 = new DateTime();
|
||||
$difference_in_seconds = ($date1->format('U') + 600) - ($date2->format('U'));
|
||||
$time_in_seconds = SettingCredit::orderby('updated_at','desc')->first()->time_limit;
|
||||
$difference_in_seconds = ($date1->format('U') + $time_in_seconds) - ($date2->format('U'));
|
||||
$booking->timeout = $difference_in_seconds;
|
||||
|
||||
// TODO : you can make it better
|
||||
|
||||
@@ -6,5 +6,5 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SettingCredit extends Model
|
||||
{
|
||||
protected $fillable = ['rmb_credit_limit','usd_credit_limit'];
|
||||
protected $fillable = ['rmb_credit_limit','usd_credit_limit','time_limit'];
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ use Faker\Generator as Faker;
|
||||
$factory->define(App\SettingCredit::class, function (Faker $faker) {
|
||||
return [
|
||||
'rmb_credit_limit' => $faker->randomDigit,
|
||||
'usd_credit_limit' => $faker->randomDigit
|
||||
'usd_credit_limit' => $faker->randomDigit,
|
||||
'time_limit' => $faker->randomDigit
|
||||
];
|
||||
});
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddTimeLimitSettingCreditTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('setting_credits', function (Blueprint $table) {
|
||||
$table->integer('time_limit');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('setting_credits', function (Blueprint $table) {
|
||||
// $table->dropColumn('time_limit');
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user