dimanche 30 juillet 2017

Laravel show number of requests for each meeting

I have these tables: users, meetings, requests:

users
id
name

meetings
id
name

requests
id
user_id
meeting_id
accepted

each meeting has number of requests from users and request table has accepted column, I want to show a list of user's meetings and number of requests for each meeting user meetings:

requests    meeting name    created_at
10          dummy meeting   10/10/2010

Meeting model

public function request()
    {
        return $this->hasMany('App\Requests');
    }

Requests model

public function meeting()
    {
        return $this->belongsTo('App\Meeting');
    }

How this can be done?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2hdPAyw
via IFTTT

Aucun commentaire:

Enregistrer un commentaire