jeudi 26 septembre 2019

How to get maximum amount and all other amounts separately in laravel?

Hello I am building an auction system. where for now i will consider two tables. Auction table and Bidding table. I want to build eloquent query so that I can get maximum amount and all other amounts separately because I will transfer maximum amount to seller and other amount to refund their users.

I don't know from where I should start.

Auction table migration

   public function up()
    {
        Schema::create('auctions', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->Integer('productID');
            $table->Integer('price');
            $table->Integer('quantity');
            $table->dateTime('endTimeDate');
            $table->dateTime('startTimeDate');
            $table->timestamps();
        });
    }

Bidding table migration

  public function up()
    {
        Schema::create('biddings', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->Integer('userID');
            $table->integer('auctionID');
            $table->bigInteger('amount');
            $table->timestamps();
        });
    }

I want to get maximum amount and other amounts separately.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire