skip to Main Content

Laravel: How do you pass data to a blade.php?

I am having difficulty in understanding how to pass data to a .blade. I want to pass the users' username ($user) to a dashboard component. Here's a few things I've tried: return view('livewire.dashboard', ['user'=>'$user']); return view('livewire.dashboard', compact('$user')); return view('livewire.dashboard'->with('user',$user)); But…

VIEW QUESTION

Laravel Call to a member function delete() on null

in PegawaiController i use join to take nama_departemen from Departemen table public function index() { $data_pegawai = Pegawai::join('departemens','pegawais.id_departemen','=','departemens.id')->paginate(5); return view ('pegawai.index', compact('data_pegawai')); } public function destroy($id) { Pegawai::find($id)->delete(); return redirect()->route('pegawai.index')->with(['success'=> 'Item Berhasil Dihapus']); } in pegawai.index @forelse ($data_pegawai as $item)…

VIEW QUESTION
Back To Top
Search