Hello, thanks for checking out here!
Here is the quick and short answer with the examples:
<img src="@if($category->image) {{ ($category->image) }} @else {{'https://via.placeholder.com/50'}} @endif" alt="{{ $category->name}}" width="50" height="50" />
This is what I was looking for my part of development laravel! same you can achieve for the html blocks: here is the example:
@if ($message = Session::get('success'))
<script>
if(window.toastr)
toastr["success"]("{{ session()->get('success') }}");
</script>
@endif
@if ($message = Session::get('success'))
<div class="alert alert-success">
session()->get('success')
</div>
@endif
To use elseif just use following syntax @elseif(condition) along your code or between.
Thanks & Happy learning Laravel!
Break! I didn’t plan it. One day I just didn’t feel like opening Instagram—and then…
AI tools Let’s be real—AI sounds like either a robot apocalypse or something only tech…
Summer vacation is a great time for kids to explore, have fun, and learn new…
Goal: Understand transformers, large language models, and the architecture behind ChatGPT. Tutorial Suggestions: ✅ “Transformers…
Goal: Build apps or tools with ChatGPT or GPT-4 API. Tutorial Suggestions: ✅ OpenAI API…
Goal: Learn how to prompt better, write content, brainstorm, code, etc. Tutorial Suggestions: ✅ OpenAI's…