vendredi 12 octobre 2018

Laravel: Retrieve data inputted by user

I'm quite new to Laravel and I'm confused with how I have to retrieve data inputted by certain users.

In my project, there is a user profile that should display all form submissions by the user.

Here is my controller function:

public function clientAccount(BookingRequest $bookings)
{
    $client = Client::whereUserId(Auth::id())->with('user')->first();
    $bookings = BookingRequest::with(Auth::id())->with('client')->first(); //unsure about here//
    return view('client.account', compact('client','bookings'));
}

Here is my model:

    public function client()
{
    return $this->belongsTo('App\Client', 'client_id', 'user_id');
}

How do I fix this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire