예제 #1
0
 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function show($id)
 {
     try {
         $transaction = Transaction_log::find($id);
         if (!$transaction) {
             return response()->json(['message' => 'This transaction does not exist', 'code' => 404], 404);
         }
         return response()->json(['data' => $transaction], 200);
     } catch (Exception $e) {
         return response()->json(['message' => 'Error in finding transaction', 'code' => 404], 404);
     }
 }
예제 #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     for ($i = 0; $i < 50; $i++) {
         $transaction_id = $faker->uuid;
         $transaction_amt = $faker->randomFloat(4);
         $address = $faker->address;
         $kudos = $faker->randomNumber(5);
         $consumer_address = $faker->address;
         $buyer = $faker->numberBetween(1, 23);
         $seller = $faker->numberBetween(1, 23);
         $activity = Transaction_log::create(['transaction_code' => 4, 'transaction_id' => $transaction_id, 'user_id' => $buyer, 'merchant_code' => $seller, 'bank_account_id' => $faker->numberBetween(1, 40), 'txn_currencyid' => $faker->numberBetween(1, 4), 'amount_in_txn_currency' => $transaction_amt, 'acc_currencyid' => $faker->numberBetween(1, 4), 'amount_in_acc_currency' => $faker->randomFloat(8, 2), 'amount_in_kudos' => $kudos, 'transaction_address' => $address, 'billing_address' => $consumer_address]);
         $activity = Transaction_log::create(['transaction_code' => 3, 'transaction_id' => $transaction_id, 'user_id' => $buyer, 'bank_account_id' => $faker->numberBetween(1, 40), 'merchant_code' => $seller, 'txn_currencyid' => $faker->numberBetween(1, 4), 'amount_in_txn_currency' => $transaction_amt, 'acc_currencyid' => $faker->numberBetween(1, 4), 'amount_in_acc_currency' => $faker->randomFloat(8, 2), 'amount_in_kudos' => $kudos, 'transaction_address' => $address, 'billing_address' => $consumer_address]);
         $activity = Transaction_log::create(['transaction_code' => 6, 'transaction_id' => $transaction_id, 'user_id' => $buyer, 'bank_account_id' => $faker->numberBetween(1, 40), 'merchant_code' => $seller, 'txn_currencyid' => $faker->numberBetween(1, 4), 'amount_in_txn_currency' => $transaction_amt, 'acc_currencyid' => $faker->numberBetween(1, 4), 'amount_in_acc_currency' => $faker->randomFloat(8, 2), 'amount_in_kudos' => $kudos, 'transaction_address' => $address, 'billing_address' => $consumer_address]);
         $activity = Transaction_log::create(['transaction_code' => 5, 'transaction_id' => $transaction_id, 'user_id' => $buyer, 'bank_account_id' => $faker->numberBetween(1, 40), 'merchant_code' => $seller, 'txn_currencyid' => $faker->numberBetween(1, 4), 'amount_in_txn_currency' => $transaction_amt, 'acc_currencyid' => $faker->numberBetween(1, 4), 'amount_in_acc_currency' => $faker->randomFloat(8, 2), 'amount_in_kudos' => $kudos, 'transaction_address' => $address, 'billing_address' => $consumer_address]);
         $activity = Transaction_log::create(['transaction_code' => 6, 'transaction_id' => $transaction_id, 'user_id' => $seller, 'bank_account_id' => $faker->numberBetween(1, 40), 'merchant_code' => $seller, 'txn_currencyid' => $faker->numberBetween(1, 4), 'amount_in_txn_currency' => $transaction_amt, 'acc_currencyid' => $faker->numberBetween(1, 4), 'amount_in_acc_currency' => $faker->randomFloat(8, 2), 'amount_in_kudos' => $kudos, 'transaction_address' => $address, 'billing_address' => $consumer_address]);
     }
 }