@rushikesh93 Please keep in mind that one of the main reasons for using MVC is not using business logic and HTML in the same place.
In your code, merge them together, unfortunately!
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello. i got error in code, i have debug but don't understand to exactly which line has error in if condition, Error is :
"syntax error, unexpected 'endif' (T_ENDIF) (View: /var/www/html/xyz/resources/views/front/dashboard.blade.php)"
Below is my code
$keys = "";
$organisers=array();
if (!empty(session('user_name')) && session('login_type') != 'interviewee') {
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$keys = substr(str_shuffle(str_repeat($pool, 10)), 0, 10);
$organisers = DB::table('debate_organisers')->where('user_id',$user_id)->where('archived', 1)->get();
}
@endphp
<?php
if($isSubscriptionActivated == true){
?>
<?php if ($login_type != 'interviewee') { ?>
<input type="hidden" name="hidden_user_id" id="hidden_user_id" value=" {{ $user_id }}">
<input type="hidden" name="my_login_type" id="my_login_type" value=" {{ $login_type }}">
<a class="new-interview-a interviewBtn" href="{{ url('debate/'.$keys) }}"><span class="new-interview"><b>New Debate</b></span></a>
<a class="new-debate-a debateBtn" href="{{ url('interview/'.$keys) }}"><span class="new-interview"><b>New Interview</b></span></a>
<?php } ?>
<?php
}
?>
</div>
<div class="row">
<div class="col-12">
<?php
if($isSubscriptionActivated == true){
?>
@if (count($organisers) > 0 && $debate_top)
<h2 style="text-align: center;">Debates</h2>
<div class="item cleardiv tableDiv">
<table class="table table-striped table-bordered" id="example2">
<thead>
<tr>
<th scope="col" style="width: 250px;">Title Debate</th>
<th scope="col">Debaters</th>
<th scope="col" style="width: 25px;">Date Creation</th>
<th scope="col">Date or Deadline Debate</th>
<th scope="col">Validated</th>
<th scope="col">Keywords</th>
<th scope="col">Action</th>
</tr>
</thead>
<tbody>
@php
foreach ($organisers as $key => $value) {
$keywords = DB::table('interview_url')
->select('*')
->where('int_id', $value->debate_id)
->where('flag', 2)
->get();
$keys = "";
foreach ($keywords as $k => $v) {
$keys .= ",#" . $v->urlname;
}
$keys = trim($keys, ",");
$debate = DB::table('debates')
->where('debate_id', $value->debate_id)
->first();
$speakers = DB::table('debate_speakers')
->where('debate_id', $value->debate_id)
->get();
@endphp
<tr class="odd gradeX">
<td>
<a href="{{ url('debate/'.$value->debate_id) }}" style="color:#57bf6f !important; display: flex; justify-content: center; align-items: center;"><?php echo isset($debate->debate_article) ? $debate->debate_article : ''; ?>
@if(isset($value->mode_of_int) && $value->mode_of_int == 1)
@if(isset($value->online_mode) && $value->online_mode == 4)
<img height="10px" width="20px" src="{{ asset('logo/podcast.png') }}">
@endif
@if(isset($value->online_mode) && $value->online_mode == 2)
📹
@endif
@endif
@if(isset($value->mode_of_int) && $value->mode_of_int == 3)
@if(isset($value->online_mode) && $value->online_mode == 6)
<img height="10px" width="20px" src="{{ asset('logo/podcast.png') }}">
@endif
@if(isset($value->online_mode) && $value->online_mode == 5)
📹
@endif
@endif
</a>
</td>
<td>
@if(isset($speakers) && count($speakers) > 0)
@php
$debater1 = DB::table('interviewees')
->where('email', $speakers[0]->email)
->first();
$debater2 = DB::table('interviewees')
->where('email', $speakers[1]->email)
->first();
@endphp
<a href="{{ url('viewinterweedetail/'.$debater1->id) }}"
style='color:#57bf6f !important;'><?php echo $speakers[0]->first_name . ' ' . $speakers[0]->last_name; ?></a>
<a href="{{ url('viewinterweedetail/'.$debater2->id) }}"
style='color:#57bf6f !important;'><?php echo $speakers[1]->first_name . ' ' . $speakers[1]->last_name; ?></a>
@if(isset($value->gifts) && $value->gifts != "")
🎁
@endif
@endif
</td>
<td>{{ date('Y/m/d', strtotime($value->created_at)) }}</td>
@php
$current_date = date("Y/m/d H:i");
$deadline = date('Y/m/d H:i', strtotime($value->deadline));
@endphp
@if ($value->deadline == 'none' || is_null($value->deadline))
<td>None</td>
@elseif ($current_date < $deadline)
<td style="color:#58c07a;">{{ date('Y/m/d H:i', strtotime($value->deadline)) }} @if(!is_null($value->end_at)) - {{ $value->end_at }} @endif
</td>
@elseif ($current_date > $deadline)
<td style="color:#505050;">{{ date('Y/m/d H:i', strtotime($value->deadline)) }} @if(!is_null($value->end_at)) - {{ $value->end_at }} @endif</td>
@else
<td>{{ date('Y/m/d H:i', strtotime($value->deadline)) }} @if(!is_null($value->end_at)) - {{ $value->end_at }} @endif</td>
@endif
<td>
@php
$login_type = session('login_type');
$validate = array();
if (isset($debate)) {
if ($login_type == 'frontuser') {
if ($debate->organiser_validate) {
echo '<span style="color:#00bf6f">V</span>';
}
} elseif ($login_type == 'interviewee') {
if ($debate->debater_validate) {
echo '<span style="color:#00bf6f">V</span>';
}
} else {
if ($debate->organiser_validate) {
echo '<span style="color:#00bf6f">V</span>';
}
}
}
@endphp
</td>
<td style="overflow-wrap: anywhere;">{{ $keys }}</td>
<td>
<a href="{{ url('debate/'.$value->debate_id) }}"><i class="icon-pencil"></i>Edit</a>
@if ($login_type != 'interviewee')
<a href="{{ url('delete_debate/' . $value->debate_id) }}" onclick="return confirm('Are you sure you want to delete ?')">
<i class="icon-trash"></i> | Delete |</a>
@endif
<a href="{{ url('debate/export-pdf/'.$value->debate_id) }}"><i class="fa fa-file-pdf-o" aria-hidden="true"></i></a>
<a href="{{ url('debate/export-doc/'.$value->debate_id) }}"> | <i class="fa fa-file-word-o"
aria-hidden="true"></i></a>
</td>
</tr>
@php
}
@endphp
</tbody>
</table>
</div>
@endif
<?php
}
?>
<!-- Add new Advance column (plan) -->
<?php
$login_type=session('login_type');
if($login_type == 'interviwer'){
$user_id=session('user_id');
$user_billedPlan=DB::table('users')->where('id',$user_id)->first();
$Subscription_Plan_Detail=DB::table('subscription_plan')->where('user_id',$user_id)->orderBy('id', 'desc')->first();
$isEndTrialDate=false;
$dt=date('Y-m-d');
if(isset($Subscription_Plan_Detail)){
$Trial_Ending_Date=$Subscription_Plan_Detail->end_trial_at;
if($Trial_Ending_Date >= $dt){
$isEndTrialDate=true;
}
}
if(!isset($Subscription_Plan_Detail) || $isEndTrialDate == false){
?>
<?php
if($user_billedPlan->plan_name == 'Free Plan')
{
?>
<?php
}else{
?>
<div class="row" style="padding-top: 50px;">
<div class="col-12 col-sm-12">
<div class="shadow-a" style="text-align: center;">
<h3 style="color: #989898;text-align: center;font-size:20px;padding-top: 10px;">No active subscription<br/><br/>
<a class="btn btn-green" href="{{url('/pricing')}}" >
<b>Subscribe Plan</b></a>
</h3>
</div>
</div>
</div>
<?php
}
?>
<?php
}elseif($Subscription_Plan_Detail->plan_name == '14 Day Free Plan'){
if($user_billedPlan->plan_name == 'Free Plan')
{}else{
?>
<div class="row" style="padding-top: 50px;">
<div class="col-12 col-sm-12">
<div class="shadow-effect">
<div style=" display: flex; align-items: center; text-align:left; border-bottom: solid 1px #ccc;padding: 0 0 15px 0;">
<div class="shadow-effect-left" style="width: 90%;">
<h2 style="color: #696969; font-weight: 500;font-size: 30px;">CURRENT PLAN
<!-- Add Date:-23/06/2022 -->
<!-- After Subscription PLan -->
</h2>
<!-- <h4 style=" border-bottom: solid 1px #ccc;padding: 0 0 15px 0; margin-top: 15px;">
14 Days Free Trial Subscription </h4> -->
<h4 style="margin-top: 15px;" ><?php
$future = strtotime($Trial_Ending_Date);
$now = strtotime($dt);
$timeleft = $future-$now;
$daysleft = round((($timeleft/24)/60)/60);
echo $daysleft.' '.'days remaining to complete your free plan!';
?>
</h4>
</div>
<div class="shadow-effect-right" style="width: 10%;">
<img src="{{asset('/assets/pages/img/free-badge-xxl.png')}}"
style="width: 130px; height: 100px;">
</div>
</div>
<div class="current-main" style="display: flex; align-items: flex-start; justify-content: space-between; padding-top: 10px;">
<div class="current-left" style="text-align: left;">
<h3 style="color: #989898;font-size: 15px;">Free plan</h3>
<h4 style="color: black;padding: 2px; margin: 0;font-size: 15px;">
<!-- Annually -->
Subscription start date : <?php echo $Subscription_Plan_Detail->start_trial_at;?> </h4>
<h4 style="color: black;padding: 2px; margin: 0;padding-top: 9px;font-size: 15px;">
Next billing :<?php echo $Subscription_Plan_Detail->end_trial_at; ?> </h4>
</div>
<div style="text-align:right; ">
<h3 style="color: black;font-size: 22px; font-weight: 500;">Free</h3>
<h3 style="color: #989898;font-size: 15px; margin-bottom: 0;">Per Company</h3>
<!-- Add Date:-20/6/2022 -->
<!-- Add Date:-22/6/2022 -->
<h3 style="color: #989898;text-align: center;font-size:20px;padding-top: 10px;">
<a class="btn btn-green" href="{{url('/pricing')}}">
<b>Subscibe </b>
</a>
</h3>
</div>
</div>
</div>
</div>
</div>
<?php
}
}
?>
<?php
}
?>
<?php
if($isSubscriptionActivated == true){
?>
@if (!empty($interviewdata) && count($interviewdata) > 0)
$keys = trim($keys, ",");
$validates = DB::table('interviewees')
->select('*')
->where('email', $value->email_wee)
->first();
$weeid = (isset($validates->id)) ? $validates->id : '';
$interview_data = DB::table('questions_3')->where('iid', '=', $value->iid)->first();
$interview_title=DB::table('interview_title')->select('title')->where('iid','=',$value->iid)->where('rank','=',1)->first();
@endphp
<tr class="odd gradeX">
<td>
<a href="{{ url($link.'/'.$value->key) }}" style="color:#57bf6f !important; display: flex; justify-content: center; align-items: center;"> <?php
//$title_col_txt=isset($interview_data->interview_article) ? $interview_data->interview_article : '';
//if($title_col_txt == '')
//{
//$title_col_txt= '<span>Interview with '.$value->name_wee . ' ' . $value->surname_wee.'</span>';
//}
// echo isset($title_col_txt )? $title_col_txt : '';
if(isset($interview_title->title) && !empty($interview_title->title)){
echo $interview_title->title;
} else {
echo $title_col_txt= '<span>Interview with '.$value->name_wee . ' ' . $value->surname_wee.'</span>';
}
?>
@if(isset($value->mode_of_int) && $value->mode_of_int == 1)
@if(isset($value->online_mode) && $value->online_mode == 4)
<img height="10px" width="20px" src="{{ asset('logo/podcast.png') }}">
@endif
@if(isset($value->online_mode) && $value->online_mode == 2)
📹
@endif
@endif
@if(isset($value->mode_of_int) && $value->mode_of_int == 3)
@if(isset($value->online_mode) && $value->online_mode == 6)
<img height="10px" width="20px" src="{{ asset('logo/podcast.png') }}">
@endif
@if(isset($value->online_mode) && $value->online_mode == 5)
📹
@endif
@endif
</a>
<?php
if(!empty($value->iid))
{
$media_outlet1 = DB::table('interview_media')->select('*')->where('interview_id',$value->iid)->get();
foreach ($media_outlet1 as $outlet1)
{
echo "<div class='outlet_span'>
<div class='outlet_name'><span style='background : $outlet1->color_code;padding: 5px; border-radius: 8px;'>".$outlet1->media_outlet."</span></div>
</div>";
}
}
?>
</td>
<?php if ($login_type == 'interviewee') { ?>
<td>
<a href="{{ url('interviewerprofile/'.$value->user_id) }}" style='color:#57bf6f !important;'>
<?php echo $value->name . ' ' . $value->lname; ?>
</a>
</td>
<?php } else { ?>
<td><a href="{{ url('viewinterweedetail/'.$weeid) }}"
style='color:#57bf6f !important;'><?php echo $value->name_wee . ' ' . $value->surname_wee; ?></a>
@if(isset($value->gifts) && $value->gifts != "")
🎁
@endif
</td>
<?php } ?>
<td>{{ date('Y/m/d', strtotime($value->created_date)) }}</td>
@php
$current_date = date("Y/m/d H:i");
$deadline = date('Y/m/d H:i', strtotime($value->deadline));
@endphp
@if ($current_date < $deadline && $value->deadline != 'None' && $value->deadline != null)
<td style="color:#58c07a;"><?php echo date('Y/m/d H:i', strtotime($value->deadline)); ?>
@if(!is_null($value->end_at)) - {{ $value->end_at }} @endif</td>
@elseif ($current_date > $deadline && $value->deadline != 'None' && $value->deadline != null)
<td style="color:#505050;"><?php echo date('Y/m/d H:i', strtotime($value->deadline)); ?>
@if(!is_null($value->end_at)) - {{ $value->end_at }} @endif</td>
@else
<td><?php echo $value->deadline; ?></td>
@endif
<td>
<?php
$login_type = session('login_type');
$validate = array();
if ($login_type == 'frontuser') {
$validate = DB::table('questions_3')
->select('*')
->where('iid', $value->key)
->where('interviewer_validate', 'yes')
->get();
} elseif ($login_type == 'interviewee') {
$validate = DB::table('questions_3')
->select('*')
->where('iid', $value->key)
->where('interviewee_validate', 'yes')
->get();
} else {
$validate = DB::table('questions_3')
->select('*')
->where('iid', $value->key)
/* ->orWhere('interviewee_validate', 'yes')
->orWhere('interviewee_validate', 'yes')*/
->where('interviewer_validate', 'yes')
->get();
}
if (count($validate) > 0) {
/*echo '<span style="color:#00bf6f">V</span>';*/?>
<img style="margin-left: 30%;" height="10px" width="20px" src="{{ asset('assets/images/check.jpeg') }}">
<?php }
?>
</td>
<?php if ($login_type != 'interviewee') { ?>
<td style="overflow-wrap: anywhere;"><?php echo $keys ?></td>
<?php } ?>
<td class="update_td">
<?php $url = $link . '/' . $value->key; ?>
<?php if ($login_type != 'interviewee') { ?>
<a href="{{ url('copy/'.$value->key) }}"><i class="icon-pencil"></i>Duplicate | </a>
<?php } ?>
<a href="{{ url($url) }}"><i class="icon-pencil"></i> Edit</a>
<?php if ($login_type != 'interviewee') { ?>
<input type="hidden" id="interview_id{{$m}}" value="{{$value->key}}">
<a href="javascript:void(0);" onclick="do_interview_archive({{$m}})">| Archive</a>
<?php $url = 'delete_interview/' . $value->key; ?>
<a href="{{ url($url) }}" onclick="return confirm('Are you sure you want to delete ?')">
<i class="icon-trash"></i> | Delete |</a>
<?php } ?>
<?php $url = $value->key; ?>
<a href="{{ url('export-pdf/'.$url) }}"><i class="fa fa-file-pdf-o" aria-hidden="true"></i></a>
<a href="{{ url('export-doc/'.$url) }}"> | <i class="fa fa-file-word-o"
aria-hidden="true"></i></a>
</td>
</tr>
@php
$m++;
$i++;
}
@endphp
</tbody>
</table>
</div>
<?php if ($login_type != 'interviewee') { ?>
<div class="archived_div"> <input type="checkbox" id="archived_interviews_checkbox" name="archived"> Display also the archived interviews</div>
<div class="archived_div"> <input type="checkbox" id="only_archived_interviews_checkbox" name="only_archived">Only display archived interview</div>
<?php $rank_per_media = DB::table('interview_media')->where('user_id',$user_id)->where('interview_id', null)->groupBy('media_outlet')->get(); ?>
<div class="archived_div">
<select name="rank_per_media_interviews" id="rank_per_media_interviews">
<option value="all_interviews">Rank per media</option>
<?php
foreach ($rank_per_media as $key => $value) { ?>
<option value="{{$value->media_outlet}}">{{$value->media_outlet}}</option>
<?php } ?>
</select>
</div>
<?php } ?>
Please or to participate in this conversation.