I'm doing a crud named FUND, where I can store many things along with a array using PHP implode method. In that array i'm storing some FUND Id. Here is array Create Code:
<div class="custom-checkbox">
<label for="receive[]">Select Receive Funds</label>
@foreach($funds as $fund)
<div class="custom-control custom-checkbox">
<input class="custom-control-input" type="checkbox" name="receive[]" id="{{$fund->id}}" value="{{$fund->id}}">
<label for="{{$fund->id}}" class="custom-control-label">{{$fund->title}}</label>
</div>
@endforeach
Here is the store code:
public function store(Request $request)
{
$request->validate([
'title'=>'required',
'image'=>'required',
'description',
'available'=>'required',
'buy'=>'required',
'account',
'receive',
]);
$image = $request->file('image');
$new_name = rand() . '.' . $image->getClientOriginalExtension();
$image->move(public_path('funds'), $new_name);
$form_data = array(
'title'=>$request->title,
'image'=>$new_name,
'description'=>$request->description,
'available'=>$request->available,
'buy'=>$request->buy,
'buyrate'=>$request->buyrate,
'sellrate'=>$request->sellrate,
'account'=>$request->account,
'receive'=>implode(',', (array)($request->receive)),
);
Fund::create($form_data);
return redirect('/admin/fund');
}
I'm showing that array on my index page using PHP explode method.
$receive=[];
foreach($funds as $fund){
$receive = explode(",",$fund->receive);
}
As I mentioned I'm storing fund id in that array. So i want to show the whole row by using the Fund ID.For that I'm using query by this:
@foreach($receive as $r)
<a href="/multi" class="list-group-item">
<p>
<img src="{{$fund=\App\Fund::where(['id'=>$r])->get('image')}}" width="32px" height="32px"> {{$fund=\App\Fund::where(['id'=>$r])->get('title')}}
<span class="pull-right text text-muted hidden-xs hidden-sm" style="font-size:11px;">
<small>Reserve: {{$fund=\App\Fund::where(['id'=>$r])->get('available')}}<br>Exchange rate: {{$fund=\App\Fund::where(['id'=>$r])->get('buyrate')}}</small>
</span>
</p>
</a>
@endforeach
But the title image is showing like this

How Can I just Get Title, Image and other staff without any bracket?