i'm trying to pass a data and use it inside Vue file but i cant get it to work here's my code
<template>
<div class="row profile-container">
<div class="col-sm-4">
<img src="/img/default.jpg" alt="" class="profile-img">
</div>
<div class="col-lg">
<h5>{{$user->name}}</h5>
<div class="card w-100">
<ul class="list-group list-group-flush">
<li class="list-group-item">Cras justo odio</li>
<li class="list-group-item">Dapibus ac facilisis in</li>
<li class="list-group-item">Vestibulum at eros</li>
</ul>
</div>
</div>
</div>
</template>
Here's the profile controller which returns to profile with data
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\User;
class ProfileController extends Controller
{
public function index($id)
{
$user = User::where('unique_id', $id)->firstOrFail();
return view('pages.profile')->with('user', $user);
}
}
Here's the app.js
require('./bootstrap');
window.Vue = require('vue');
Vue.component('welcome', require('./components/Welcome.vue').default);
Vue.component('profile', require('./components/Profile.vue').default);
const app = new Vue({
el: '#app'
});
Routes
Route::get('/', 'PagesController@index' );
Auth::routes();
Route::get('/logout', '\App\Http\Controllers\Auth\LoginController@logout');
Route::get('/profile/{id}', 'ProfileController@index');
Here's the blade file pip didly doo i dont know what to write anymore it lookslikemy post is mostly code so ill just add some details here, thatsprettycoolshaggyisgod i dont know what else to add here please send help
@extends('layouts.master')
@section('title')
<title>Profile</title>
@endsection
@section('content')
@if(Auth::user()->type==='user')
<profile></profile>
@elseif (Auth::user()->type==='admin')
<h1>Hi Admin</h1>
@endif
@endsection