-2

How I set or create that admin user can see only record which he created, or in which he is owner, like in this record this user is selected like owner.

Nikola
  • 207
  • 1
  • 4
  • 17

1 Answers1

1

you can do this by modifying your query like you can add one field for record which store user id and query can be as followings:

$record=DB::table('records')->where('user_id','=',auth()->user()->id)->get();

The above query only gives records which belongs to the logged in user.

Vhndaree
  • 594
  • 1
  • 6
  • 20
  • and you can give input for user_id field while storing records in the records table write these code in RecordController $record->user_id=auth()->user()->id; – Vhndaree Oct 24 '18 at 13:50