示例#1
0
 public function index()
 {
     $posts = Post::select()->orderBy('id', 'desc')->get();
     $categorias = Categoria::orderBy('titulo')->get();
     //dd($posts, $categorias);
     return view('welcome', compact('categorias', 'posts'));
 }
 public function edit($id)
 {
     $programa = Programa::find($id);
     $programa->categoria();
     $programa->productor();
     $categorias = Categoria::orderBy('nombre', 'DESC')->lists('nombre', 'id');
     $productores = Productor::orderBy('nombre', 'ASC')->where('estatus', '=', 'ACTIVO')->lists('nombre', 'id');
     $tags = Tag::orderBy('id', 'DESC')->lists('nombre', 'id');
     $mis_tags = $programa->tags->lists('id')->ToArray();
     $conductores = Conductor::orderBy('id', 'DESC')->where('estatus', '=', 'ACTIVO')->lists('nombre', 'id');
     $mis_conductores = $programa->conductores->lists('id')->ToArray();
     return view('admin.programas.edit')->with('programa', $programa)->with('productores', $productores)->with('categorias', $categorias)->with('tags', $tags)->with('mis_tags', $mis_tags)->with('conductores', $conductores)->with('mis_conductores', $mis_conductores);
 }
 public function listarCategorias()
 {
     $categorias = Categoria::orderBy('nome', 'asc')->lists('nome', 'id');
     return view('Categorias')->with('categorias', $categorias)->with('busca_url', '')->with('endereco_url', '');
 }
 public function editar()
 {
     $usuario = Auth::User();
     $empresa = Empresa::where('idUsuario', '=', $usuario->id)->first();
     $tiposEmpresas = ['-1' => 'Selecione o tipo do empreendimento'] + TipoEmpresa::orderBy('tipo', 'asc')->lists('tipo', 'id')->all();
     $categorias = ['-1' => 'Selecione a categoria'] + Categoria::orderBy('nome', 'asc')->lists('nome', 'id')->all();
     $cartoes = Cartao::orderBy('tipo', 'asc')->get();
     $vendedores = ['-1' => 'Selecione o usuário'] + Vendedor::with('Usuario')->get()->lists('Usuario.name', 'id')->all();
     $tiposCartoes = ['-1' => 'Selecione o tipo dos cartões'] + TipoCartao::orderBy('descricao', 'asc')->lists('descricao', 'id')->all();
     return view('Empresa.Edit')->with('empresa', $empresa)->with('tiposEmpresas', $tiposEmpresas)->with('cartoes', $cartoes)->with('categorias', $categorias)->with('vendedores', $vendedores)->with('tiposCartoes', $tiposCartoes);
 }