1
I have a simple question, I am setting up some registrations for the purpose of studying the framework Aravel, with People, Accounts and etc..
I am using Laravel’s default authentication, and now I have come across the following situation, the registrations of people, and all releases of accounts to pay and receive that I have registered by a respective user is visible to others as well.. I believe it’s because I’m using the method Suppliers::all(); etc.. What should I do to return only the Suppliers that has been registered by this respective user so that it is not visible by all
Inside the tables has a field intended to record the id of the user who recorded that record?
– novic
@Virgilionovic I was checking it out right now! I just need to have the user ID in the register of people, that the other tables are already related, but in Personcontroller@store I am using request->all(), as I do for only the id_user field to be filled automatically with the id of the respective logged in user?
– Gabriel Alves
Auto::user()->id would be that
– novic
@Virgilionovic would look like this $person = Person::create($request->all(Auto::user()->id));
– Gabriel Alves
Inside the person table has the user id field or equivalent?
– novic
Yes, I just modified it, I inserted a user_id column as a foreign key to the user table id, and I already set up hasMany and Belongsto
– Gabriel Alves
Vendors::Where('user_id', Auth::user()->id)
– novic