Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter to show only items created by user #34

Open
crofton77 opened this issue Sep 3, 2014 · 2 comments
Open

Filter to show only items created by user #34

crofton77 opened this issue Sep 3, 2014 · 2 comments

Comments

@crofton77
Copy link

How would I create a filter to only show items created by a user?

Also how would i set the user's id on save so it can be stored in database?

@jspekken
Copy link
Member

jspekken commented Sep 3, 2014

You could do something like this:

public function configureFilters($mapper)
{
    $users = [];
    foreach (User::groupBy('email')->get() as $user) {
        $users[$user->email] = $user->email;
    }

    $mapper->select('email')->options($users);
}

@crofton77
Copy link
Author

This allows me to a user to filter by different users.

How do I make so the user can only see items they created?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants