Ejemplo de Codigo

VISTA: resources/views/vercuentas.blade.php

@extends('master')

@section('titulo','Listado de Cuentas')
@section('contenido')

<h1> CUENTAS </h1>

<? //{{ $resultado }} ?>

   <ul>
      @foreach($resultado as $item)
         <li> {{ $item->id }} - {{ $item->descripcion }}  </li>
      @endforeach
   </ul>

@endsection

MODELO: /app/T_cuentas_persona.php

namespace App;
use App\T_cuentas_persona;
use Illuminate\Database\Eloquent\Model;

class T_cuentas_persona extends Model
{
    public static function buscarcuentapersona($id)
    {
        return t_cuentas_persona::where('idpersona', $id)->join('t_cuentas as tc','idcuenta','=','tc.id')->get();
    }

}

LAYOUT PERSONALIZADO : /resources/views/master.blade.php

<!DOCTIPE html>
<html>

<head>
    <title>App - @yield('titulo')</title>
</head>
<body>
    <h1>Logo</h1>
    @yield('contenido')
</body>
</html>

ROUTING: routes/web.php

    /**
     * Cuentas Personas
     */

    Route::resource('t_cuentas_personas', 'T_cuentas_personasController');
        Route::get('t_cuentas_personas/vercuentas/{id}','T_cuentas_personasController@obtenercuentas');
        Route::get('vercuentas/{id}','cuentaspersonasController@vercuentas');
Redmine Appliance - Powered by TurnKey Linux