1

I read this Populating a dropdown menu with database results in Laravel 4

and was able to populate a select grabbing values from the MySQL database in Laravel However, this is not being restricted to the data belonging to the logged-in user. Any hits appreciated `Route::get('applications', array('before' => 'auth', function() { //return View::make('applications'); //commented out 10/31/15

      // 10/31/15 create the array to hold companies from companies table - $company_lists

      //return view applications plus the array

      $company_lists = Company::lists('company', 'id');  /// 10/31/
       $resume_lists = Resume::lists('name', 'user_id');  /// 11/1/15


      return View::make('applications', array('company_lists' => $company_lists), array('resume_lists' => $resume_lists));  ///10/31/15
    }
)

);`

1 Answer 1

0

It looks like you're missing where clauses. I don't quite get your table structure, so not entirely which bits require the where clauses, but I imagine something along these lines would work better:

$user = Auth::user();
$resume_lists = Resume::where('user_id', '=', $user->id)->lists('name', 'user_id');
Sign up to request clarification or add additional context in comments.

2 Comments

are you sure you can use the where clause in there?
Pretty sure, this is in the docs: $model = User::where('votes', '>', 100)->get(); Still laravel has some funny interactions, maybe it doesn't like 'lists'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.