jeetdholakia
3 years ago
488
33
Laravel

Display data in view according to if condition

Posted 3 years ago by jeetdholakia

Hello, I am fetching one column from database where values can be "monthly or quarterly". I am passing that to view and in view I am running if condition to check whether the value is "monthly" or "quarterly" but its not working. Controller:

$main= User::select('column_name')->get();

View:

@if($main == "monthly")
<option value="">Select Month*</option>
@elseif($main == "quarterly")
<option value="">Select Quarter*</option>
@endif

Thanks in advance.

Please sign in or create an account to participate in this conversation.