I need to get the id and Name about Costumers to DropDown in Laravel5 , in Laravel4 I use the following code.
public function create()
{
$data = ['groups' => Cliente::lists('name', 'id')];
return view('projects.create')->with('data',$data);
}
After , In the View I show with the following
{{ Form::select('group', $groups) }}
But in the controller Client I have this
<?php namespace App\Http\Controllers;
use App\Project;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Input;
use Illuminate\Support\Facades\Validator;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redirect;
class ClienteController extends Controller {
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$projects = Cliente::all();
return $projects;
}
/**
* Show the form for creating a new resource.
*
* @return Response
*/
}
When I execute the view create , I can see the following error
Class 'App\Http\Controllers\Cliente' not found
Finally I use this but I need to show the name and id about client in the view not only the id, any solutions for this ?
public function create()
{
$data = ['Selecciona el ID del ususario' => \DB::table('clientes')->lists('id','id')];
return view('projects.create')->with('groups',$data);
Then , the view.
{!!Form::select('user_id', $groups) !!}