I actually struggling with passing data into GET request page where I trying to pass data from database to Dashboard.vue component (Using Laravel 8 + Inertia.js stack)
But nothing happened, why?
Controller component:
public function index(Request $request)
{
return Inertia::render('Dashboard', [
'percentages' => $percentages = DB::table('profits')->where('user_id', $request->user()->id)->sum('percentage'),
'profits' => $profits = DB::table('profits')->where('user_id', $request->user()->id)->sum('total_profit'),
]);
}
Front-end:
<div class="container">
<div class="row">
<div class="col-sm-5 text-center fund-profits">
{{profits}}
</div>
<div class="col-sm-2 text-center nomad-separator">
|
</div>
<div class="col-sm-5 text-center fund-profits">
{{percentages}}
</div>
</div>
</div>
<script>
import JetApplicationLogo from './../Jetstream/ApplicationLogo'
export default {
props: ['percentages', 'profits'],
components: {
JetApplicationLogo,
},
}
</script>