'I wrote an if condition in blade file and it's not working
Here is my blade file foreach loop works perfectly but when i want to check the value exist or not then it always show not
@foreach ($value as $names)
<h3>{{$names}}</h3>
@endforeach
@if($names =="abc")
<h2>Found</h2>
@else
<h3>Not</h3>
@endif
and here is my controller
public function load_name()
{
$values = ['abc','xyz','yyy'];
return view('name',['value' => $values]);
}
and route
Route::get("names",[UserController::class,'load_name']);
Solution 1:[1]
@foreach ($value as $names)
<h3>{{$names}}</h3>
@if($names =="abc")
<h2>Found</h2>
@else
<h3>Not</h3>
@endif
@endforeach
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Gev99 |
