andrewber icon indicating copy to clipboard operation
andrewber copied to clipboard

`driver_id` should be `$request->user()->driver->id` in `TripController` `accept` method

Open mscalessio opened this issue 1 year ago • 2 comments

Hi there, I think that this line https://github.com/aschmelyun/andrewber/blob/8b78fb0de628fa82254daa772989e0fd1c1fbad1/src/backend/app/Http/Controllers/TripController.php#L58

should be 'driver_id' => $request->user()->driver->id, to reference the relation with the Driver model in Trip model.

Now when a driver accept the ride is saved the User model id and the $trip->load('driver.user'); can't be triggered.

Am I missing something?

Thank you in advance

mscalessio avatar Apr 24 '23 23:04 mscalessio

Yes, I just came to post this issue and found there is already one.

In the accept method, it should be $request->user()->driver->id not the user id.

gmp419 avatar May 05 '23 01:05 gmp419

absolutely right, I've paused the video and came here for the same reason.

Ghassan-Aljaafri avatar Jun 28 '23 22:06 Ghassan-Aljaafri