public function alertIndex($petId) { $pet = Pet::find($petId); $alerts = Alert::getAlertsByPetId($petId)->paginate(10); return view('alert.index', compact('pet', 'alerts')); }
@foreach($products as $product) <div><label>Nombre: </label> {{$product->name}}</div> <div><label>Cantidad: </label> {{$product->quantity}}</div> <hr> @endforeach </div> <div class="modal-footer"> <button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-close"></i> Cerrar</button> </div> </div> </div> </div> @foreach($alerts as $alert) <?php $now = new DateTime(); $alertsFound = \Veterinaria\Alert::where('alerts_type_id', '=', $alert->id)->where('date', '>', $now)->get(); ?> <div class="col-lg-3 col-md-6"> <div class="panel panel-{{$alert->color}}"> <div class="panel-heading"> <div class="row"> <div class="col-xs-3"> <i class="fa {{\Veterinaria\FontAwesome::find($alert->font_awesome_id)->font}} fa-5x"></i> </div> <div class="col-xs-9 text-right"> <div class="huge" id="number{{$alert->id}}"> {{$alertsFound->count()}} </div> <div>{{$alert->title}}</div> </div> </div>
public static function getAlertsByPetId($petId) { return Alert::where('pets_id', '=', $petId); }