Support the ongoing development of Laravel.io →
Authentication Database Views

Hi everyone :)

I'm having a problem with determining a owner of a model. The application is supposed to show an asterix * next to appartments created by the user, and allow him to edit them. But it does not :D Please check views/apartments/index and views/apartments/edit code.

I have uploaded files to : http://klenovica.eu/sztf/app_project.rar . Simply run ''php artisan serve'' and check with usernames/passwords: admin/admin or user/user. The problem comes up with user.

Sorry for not using github for upload, and thanks for help in advance .

Last updated 3 years ago.
0

Solved, user.php had an error, should have been:

public function owns(Apartment $apartment){ return $this->id == $apartment->user_id;

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.