@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">{{ __('Dashboard') }}</div>

                <div class="card-body">
                    @if (session('status'))
                        <div class="alert alert-success" role="alert">
                            {{ session('status') }}
                        </div>
                    @endif

                    <div class="row">
                    @if(count($homes) > 0)
                    @foreach($homes as $home)
                        <div class="col-sm-6">
                            <div class="card">
                                <img class="card-img-top" src="{{ $home->pictures[0] }}">
                                <div class="card-body">
                                    <h5 class="card-title">{{ $home->title }}</h5>
                                    <p class="card-text">{{ $home->excerpt() }}</p>
                                    <a href="{{ route('home.show', ['id' => $home->id]) }}" class="btn btn-primary">Voir la maison</a>
                                </div>
                            </div>
                        </div>
                    @endforeach
                    @else
                        Aucune maison enregistrée :(
                    @endif
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection