how-to-send-email-in-multiple-client-in-laravel
pay_users = addcart::where('admin_id', $param3)->get();
$influencer_adminids = $pay_users->pluck('influencer_admin_id')->toArray();
===============or============
$influencer_adminids = addcart::where('admin_id', $param3)->pluck('influencer_admin_id')->toArray();
foreach ($influencer_email as $email) { }===> on array
$json_encoded = json_encode($influencer_adminids->toArray());
$decoded_array = json_decode($json_encoded, true);
$json_encoded = json_encode($influencer_adminids);
foreach ($influencer_adminids as $index => $adminId) {}
@foreach(json_decode($user->json_data, true) as $key => $value)
<li>{{ $key }}: {{ $value }}</li>
@endforeach
$InfluencerMailsend = [];
$InfluencerMailsend = [
'name' => $influencername,
'email' => $email,
'token' => $validToken,
];
$InfluencerMailsend = array(
'name' => $influencername,
'email' => $email,
'token' => $validToken,
);
$InfluencerMailsend = [];
$InfluencerMailsend['name'] = $influencername;
$InfluencerMailsend['email'] = $email;
$InfluencerMailsend['token'] = $validToken;
$pay_users = collect([
['id' => 1, 'influencer_admin_id' => 101],
['id' => 2, 'influencer_admin_id' => 102],
['id' => 3, 'influencer_admin_id' => 103],
]);
$influencer_adminids = $pay_users->pluck('influencer_admin_id')->toArray();
@if ($user->json_data)
<tr>
<th colspan="2">JSON Data</th>
</tr>
@foreach(json_decode($user->json_data, true) as $key => $value)
<tr>
<td>{{ $key }}</td>
<td>{{ $value }}</td>
</tr>
@endforeach
@endif
<h1>{{ $user->name }}</h1>
<p>Email: {{ $user->email }}</p>
@if ($user->json_data)
<h2>JSON Data:</h2>
<ul>
@foreach(json_decode($user->json_data, true) as $key => $value)
<li>{{ $key }}: {{ $value }}</li>
@endforeach
</ul>
@endif
$currentURL = url()->current();
$id = Auth::user()->id;
$users = Paytm::where('admin_id', $id)->with('otherTableData')->get();
<td>{{ \Illuminate\Support\Str::limit($user->created_at, 10) }}</td>
<td>
how-to-store-array-of-value-in-database-records-in-laravel
$Paytm->influencer_admin_id = implode(',', $influencer_adminids);
YourModel::create([
'socialsite' => $jsonData,
]);
how-to-get-two-table-data-using-eloquent-relationship-in-laravel
@php
$customIndex = 1; // Initialize the custom index variable
@endphp
@foreach($users as $user)
@foreach(json_decode($user->influencer_name) as $influencer)
@foreach ($user->otherTableData as $data)
/// all renders data in table
@php
$customIndex++; // Increment the custom index
@endphp
@endforeach
@endforeach
foreach ($users as $user) {
//render nested data
if ($user->otherTableData->isNotEmpty()) {
foreach ($user->otherTableData as $data) {
// render nested field is in array
}
} else {
echo "No data found in 'other_table' for this user.<br>";
}
@php
$customIndex = 1; // Initialize the custom index variable
@endphp
@foreach($users as $user)
@for ($i = 0; $i < count(json_decode($user->influencer_name)); $i++)
// display nested data is
@php
$customIndex++; // Increment the custom index
@endphp
@endfor
@endforeach
get data from multiple table
public function otherTableData()
{
return $this->hasMany(addcart::class, 'admin_id', 'admin_id');
}
public function table2Data()
{
return $this->hasMany(Table2::class, 'admin_id', 'admin_id');
}
public function table3Data()
{
return $this->hasMany(Table3::class, 'admin_id', 'admin_id');
}
Taking alias
$users = Paytm::where('admin_id', $id)
->with('otherTableData', 'table2Data', 'table3Data')
->select(
'payment_paytm.*',
'addcart.column_name as other_table_column',
'table2.column_name as table2_column',
'table3.column_name as table3_column'
)
->get();
how-to-display-array-of-element-in-different-row-in-laravel-blade-file
how to give route in array decoded from the JSON string stored in db
@foreach($users as $user)
@for ($i = 0; $i < count(json_decode($user->influencer_name)); $i++)
<a href="{{ route('view-order', [
'user_id' => $user->id,
'influencer_name' => json_decode($user->influencer_name)[$i]
]) }}">{{ json_decode($user->influencer_name)[$i] }}</a>
inside td and inside foreach
{{ json_decode($user->cart_id)[$i] }}
how-the-nested-foreach-loop-is-used-to-fetch-and-display-dynamic-data
food_type = AddFoodType.objects.all()
category = AddFoodType.objects.filter(useraddfoodgi__isnull=False).distinct()
context = {
'food_type': food_type,
'category': category,
}
@foreach($food_type as $food)
// data here
@foreach($category as $categoryItem)
@if($categoryItem->food_type === $food->food_type)
// renders nested data
@endif
@endforeach
@endforeach
Top comments (0)