I have no idea how to do this. I have a view with two tables, where one shows me the status of a team and the other the maintenance that is done to them, what I want to do is change the status of "pending" made when maintenance is done and every 3 months change only for slope and send an alert saying that maintenance has to be done. I hope you can help me.
<div class="container">
<div class="row">
<div class="panel-heading" align="center"><h2 class="page-header" align="center">MANTENIMIENTO</h2></div>
<div class="panel-body">
<a href="{{route('mantenimiento_imp.create') }}" class="btn btn-info btn-block" >Nuevo Mantenimiento</a>
</div>
<table width="100%" class="table table-striped table-bordered table-hover" id="dataTables-example">
<thead>
<tr>
<th>ID PC</th>
<th>Motivo</th>
<th>Diagnostico</th>
<th>Ver</th>
<th>Editar</th>
<th>Eliminar</th>
</tr>
</thead>
<tbody>
@if($mantenimientos_imp->count())
@foreach($mantenimientos_imp as $mantenimiento_imp)
<tr>
<td>{{$mantenimiento_imp->impresora_id}}</td>
<td>{{$mantenimiento_imp->motivo}}</td>
<td>{{$mantenimiento_imp->diagnostico}}</td>
<td><a class="btn btn-success btn-xs" href="{{route ('mantenimiento_imp.show', $mantenimiento_imp->id)}}"><span class="glyphicon glyphicon-eye-open"></span></a></td>
<td><a class="btn btn-primary btn-xs" href="{{action('Mantenimiento_impController@edit', $mantenimiento_imp->id)}}" ><span class="glyphicon glyphicon-pencil"></span></a></td>
<td>
<form action="{{action('Mantenimiento_impController@destroy', $mantenimiento_imp->id)}}" method="post">
{{csrf_field()}}
<input name="_method" type="hidden" value="DELETE">
<button class="btn btn-danger btn-xs" type="submit" onclick="return confirm('Esta seguro de Eliminar el Registro?')"><span class="glyphicon glyphicon-trash"></span></button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<?php
$mes = substr($mantenimientos_imp->fecha_mant, 3, 1);
$dia = substr($mantenimientos_imp->fecha_mant, 1, 1);
$f = date("d-m-Y");
$mes_act = substr($f, 2, 2);
$ret = DB::table('mantenimientos_imp')->select('fecha_mant')
->where($mes, '<', (int) $mes + 3);
if ($ret != NULL) {
echo "Hagale mantenimiento";
} else {
echo "estamos bien";
}
?>
<div class="panel-heading" align="center"><h2 class="page-header" align="center">Impresoras pendiente de Mantenimiento</h2></div>
<table width="100%" class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>Nombre</th>
<th>Marca</th>
<th>Estado</th>
</tr>
</thead>
<tbody>
@foreach($impresora as $impresoras)
<tr>
@if($impresoras->estado == 'Pendiente')
<td>{{$impresoras->nombre_imp}}</td>
<td>{{$impresoras->marca_imp}}</td>
<td class="label-danger">{{ $impresoras->estado}}</td>
@endif
</tr>
@endforeach
</tbody>
</table>