Sep 28, 2016
9
Level 1
Level 51
Level 32
I guess you can't make it cleaner than the way you do now
Level 1
I tried but i am getting the following error
Parse error: syntax error, unexpected ''): ?>' (T_CONSTANT_ENCAPSED_STRING) (View: /home/manoj/vinfinet/stock/resources/views/pages/basictest.blade.php)
Level 32
I guess the error isn't in that part, would you show us the full code?
Level 1
Here is my full code
@section('content')
<!-- page content -->
<div class="right_col" role="main">
<div class="">
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<h2>Stock <small>Basic test</small></h2>
<div class="clearfix"></div>
</div>
<div class="x_content">
<p class="text-muted font-13 m-b-30">
</p>
<table id="datatable-responsive" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%">
<thead>
<tr>
<th>Serial No</th>
<th>OP No</th>
<th>Device</th>
<th>State</th>
<th>Basic Test</th>
</tr>
</thead>
<tbody>
<tr>
@foreach($devices as $device)
<tr>
<td>{{ $device->slno}}</td>
<td>{{ $device->opno}}</td>
<td>{{ $device->name}}</td>
<td>@if($device->state == 0)
New
@elseif ($device->state == 1)
Field-return
@endif </td>
<td>@if($device->name ==='SAMRAT'')
<a href="{{ url('samratbasic') }}"Go>
@else($device->name === 'RAKSHAK')
<a href="{{ url('rakshakbasic') }}"Go>
@endif
</td>
</tr>
@endforeach
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /page content -->
@endsection
Level 4
You have a double single quote in the end of this conditional:
<td>@if($device->name ==='SAMRAT'')
1 like
Level 51
You didnt copy correct code that i post you above
1 like
Level 8
Maybe you don't need the if statement
<a href="{{ url(strtolower($device->name) . 'basic') }}">Go</a>
Level 1
Thank You @tomi . Your code worked for me
Please or to participate in this conversation.