It is posible a query for my data?

Posted 3 months ago by joseluisac

Hi, Good night.

I have a doubt with a query.

I have this tables

Schema::create('patients', function (Blueprint $table) {
            $table->bigIncrements('id'); // Example 12
            $table->string('name',100); //Example Jonh Con
            $table->date('birthDate');  // Example 2018-01-01 
        });
schema::create('consultations', function (Blueprint $table) {
            $table->bigIncrements('id'); // Example 2
     $table->bigInteger('patient_id'); //Example 12             
    $table->date('date');  // Example 2018-09-01 

            //More Columns
        });
    }
 Schema::create('anthropometries', function (Blueprint $table) {
            $table->bigIncrements('id'); // Example 2
            $table->bigInteger('consultation_id')->unsigned(); // Example 2
            $table->double('height'); //Example 50 
            $table->string('mHeight'); // Example kg
        //More Columns
        });

My model Consultation

public function anthropometries()
    {
        return $this->hasOne('App\Models\Anthropometries','consultation_id');
    }

Is there some query for get data of anthropometries with average for months ? Example

{
    Juanary : {
        height:50,
    }
    February:{
        height:51,
    }
    etc...
}

PD: there is a query from the date of birth?

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.