error:
**ErrorException in 01435a1ca655c807f986de8fa43485d4 line 22:
Undefined variable: user (View: C:\xampp\htdocs\tienda-master\resources\views\auth\perfil.blade.php)**
esta es la consulta que esta dentro de una vista html.
<form method="POST" action="perfil">
{!! csrf_field() !!}
<div class="form-group">
<label class="control-label" for='user_id'>Usuario</label>
** {!! Form::select('user_id', $user, null, ['class' => 'form-control']) !!}**
</div>
<div class="form-group">
<label class="control-label" for='empresa_id'>Empresas</label>
{!! Form::select('empresa_id', $empresas, null, ['class' => 'form-control']) !!}
este es mi controlador
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Perfil;
use App\Empresas;
use App\User;
class PerfilController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$user = User::orderBy('id', 'desc')->lists('name', 'id');
$empresas = Empresas::orderBy('id', 'desc')->lists('name', 'id');
$perfil = Perfil::orderBy('id', 'desc')->paginate(5);
return view('auth.perfil',compact('perfil','user', 'empresas'));
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
return view( 'auth.perfil');
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$data = [
'alta_p_s' => $request->get('alta_p_s'),
'alta_kits' => $request->get('alta_kits'),
'alta_garantia' => $request->get('alta_garantia'),
'traspasos' => $request->get('traspasos'),
'kardex' => $request->get('kardex'),
'user_id' => $request->get('user_id'),
'empresa_id' => $request->get('empresa_id')
];
$perfil = Perfil::create($data);
$message = $perfil? 'Perfil agregado correctamente!' : 'El perfil NO pudo agregarse!';
return redirect()->route('perfil.create.index')->with('message', $message);
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
return $perfils;
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
y esta es la tabal donde quiero que se muestren esos datos
y aqui el error
ErrorException in 01435a1ca655c807f986de8fa43485d4 line 22:
Undefined variable: user (View: C:\xampp\htdocs\tienda-master\resources\views\auth\perfil.blade.php)
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>Usuario</th>
<th>Empresa</th>
<th>Alta Producto o servicio</th>
<th>Alta de kits</th>
<th>Alta de garantias</th>
<th>Traspasos</th>
<th>Kardex</th>
</tr>
</thead>
<tbody>
@foreach($perfil as $perfils)
<tr>
<td>{{ $perfils->user_id }}</td>
<td>{{ $perfils->empresa_id }}</td>
<td>{{ $perfils->alta_p_s }}</td>
<td>{{ $perfils->alta_kits }}</td>
<td>{{ $perfils->alta_garantia }}</td>
<td>{{ $perfils->traspasos }}</td>
<td>{{ $perfils->cardex }}</td>
<td>
<a class="btn btn-primary">
<i class="fa fa-pencil-square-o"></i>
</a>
</td>
</tr>
@endforeach
prodrian ayudarme porfavor de antemano muchas gracias