Good, I have a list of students in a view in which I can place observations. My query is how to create an "if" to show me the "add observation" only if you do not have any in the database and in case you already have an observation do not show the "add observation"
These are the fields in the database:
public function up()
{
Schema::create('conductas', function (Blueprint $table) {
$table->increments('id');
$table->enum('tipo',['Positiva','Negativa']);
$table->string('descripcion');
$table->date('fecha');
$table->integer('id_alumno')->unsigned();
$table->foreign('id_alumno')->references('id')->on('alumnos');
$table->integer('id_asignatura')->unsigned();
$table->foreign('id_asignatura')->references('id')->on('asignaturas');
$table->timestamps();
});
}
And my view:
@section('content')
<strong>Asignatura : </strong> <a> {{$asignatura->nombre}}</a><br>
<strong>Curso : </strong> <a>{{$asignatura->curso->nombre." / ".$asignatura->curso->tipo}}</a><br>
<strong>Periodo : </strong> <a>{{$asignatura->periodo." - ".$asignatura->created_at->year}}</a><br>
<strong>Horario : </strong> <a>{{$asignatura->horario}}</a><br><br>
<table class="table table-bordered">
<tr>
<th>N°</th>
<th>Rut</th>
<th>Nombres</th>
<th>Apellidos</th>
<th>Correo</th>
<th>Información</th>
<th>Anotaciones</th>
</tr>
@foreach ($alumnos as $alu)
<tr>
<td>{{ ++$i }}</td>
<td>{{ $alu->rut }}</td>
<td>{{ $alu->nombre}}</td>
<td>{{ $alu->apellido_paterno." ".$alu->apellido_materno}}</td>
<td>{{ $alu->email}}</td>
<td><a href="{{route('alumnos.show', $alu->id)}}" class="btn btn-info" ><span class="fa fa-eye" aria-hidden="true"></span></a><br><br></td>
<td><a href="{{URL('datos-profesor/veranotacion', $alu->id)}}" class="btn btn-warning" ><span class="fa fa-file-text" aria-hidden="true"> </span></a>
@if({{???}})
<a href="{{URL('agregar/anotacion', array($alu->id, $asignatura->id ))}}" class="btn btn-danger" ><span class="fa fa-plus-square" aria-hidden="true"></span></a></td>
</tr>
@endforeach
</table>
@endsection
Thank you in advance.