I need display some different items according to Auth user id in laravel blade file.this is first condition that I need display on my blade file
@foreach ($task->comments as $comment)
@if(auth()->user()->id == $task->user_id)
<div>
<div><i class="fa fa-check-square-o"></i>
<span> by
<span style="font-style: italic;color: #09f;">
</span>
</span></div>
<a href="/projects//comments//edit">Edit</a>
<button class="btn btn-danger delete pull-right"
data-action="/projects//comments/"
data-token="">
<i class="fa fa-trash-o"></i>Delete
</button>
</div>
<hr/>
@endif
@endforeach
<form class="form-vertical" role="form" method="post" action="">
<div class="form-group">
<textarea name="comments" class="form-control" style="width:80%;" id="comment" rows="5" cols="5"></textarea>
@if ($errors->has('comments'))
<span class="help-block"></span>
@endif
</div>
<div class="form-group">
<button type="submit" class="btn btn-info">Add Comment</button>
</div>
<input type="hidden" name="_token" value="">
</form>
</div>
and if not meet above condition I need display following conditions on My blade file.
@else
<div><i class="fa fa-check-square-o"></i>
<span> by
<span style="font-style: italic;color: #09f;">
</span>
</span></div>
<form class="form-vertical" role="form" method="post" action="">
<div class="form-group">
<textarea name="comments" class="form-control" style="width:80%;" id="comment" rows="5" cols="5"></textarea>
@if ($errors->has('comments'))
<span class="help-block"></span>
@endif
</div>
<div class="form-group">
<button type="submit" class="btn btn-info">Add Comment</button>
</div>
<input type="hidden" name="_token" value="">
</form>
how can do this?
Aucun commentaire:
Enregistrer un commentaire