I am having troubles with retrieving an integer value from Query builder of Laravel. It gives me this error as the title of the question:
Object of class Illuminate\Support\Collection could not be converted to int
i tried to use also the pluck() method but with the same error.
Here is the code portion of code:
Scegli Corso: <select name="tipo" id="selezionaCorsoIscrizione">
{{ $corsi_scii = DB::table('corsoscii')->select('idCorso','nome')->get() }}
{{ $post_corso = DB::table('corsoscii')->select('membriMax')->pluck('membriMax') }}
<option value="" selected="selected"> Seleziona Corso
</option>
@foreach($corsi_scii as $corso_scii)
<option value="">
@if($post_corso == 0)
{{ "Il corso ha raggiunto la capienza massima" }}
@else
{{ $corso_scii->idCorso." - ".$corso_scii->nome }}
@endif
</option>
@endforeach