Closed OV-Hank closed 2 years ago
Hi @OV-Hank,
Thank you for using the Creative Tim products!
It seems like you don't generate the correct URL path for the image.
In the config > filesystems, you need to add 'url' => env('APP_URL').'/storage',
for the disks array, local.
If you have any other questions, please let us know.
Best, UPDIVISION Team
Thanks, that seemed to do the trick.
I do have another question that I haven't been able to find an answer for after googling the last couple of days.
The items table has a user_id field. I want to make the item list page only display the items that belong to the logged in user. Where/how would I add this parameter? I've searched but the way this app is setup isn't like any of the many tutorials, stackoverflow posts I have come across.
For example on the below snapshot, user with ID 4 is logged in, he should only be able to see the last item that belongs to him and not the first 3 that belong to user with ID 1.
Thanks so much for your help!
Hi @OV-Hank,
There are multiple possibilities for your request:
Please let us know if you need further assistance.
Best, UPDIVISION Team
Here is what I have in the item view policy but I still am returning all items.
`
public function view(User $user, Item $item)
{
if (auth()->user()->id === $item->user_id){
return $user->can('view items');
}
}
`
Hi @OV-Hank,
You also need a global scope on the model from which you can filter the returned items. You need to call it in the boot function, where if the user is authenticated and has view items permissions it returns $builder. If not, it returns the items filtered by the user id.
We hope this information will help you with your issue.
Best, UPDIVISION Team
Hi @OV-Hank,
We hope we managed to help you in solving this issue.
Should you need further assistance, do not hesitate to let us know.
Best, UPDIVISION Team
Prerequisites
Please answer the following questions for yourself before submitting an issue.
Expected Behavior
I expect the image upload from the profile to be saved and the file location to be updated to mysql server.
Current Behavior
The file gets moved to the storage/app/users folder but then fails.
Failure Information (for bugs)
screenshot attached
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
Context
running on mamp locally.
Failure Logs
from networking
{ "errors": [ { "status": "422", "title": "Unprocessable Entity", "detail": "The profile image format is invalid.", "source": { "pointer": "/data/attributes/profile_image" }, "meta": { "failed": { "rule": "url" } } } ] }