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

How to do laravel eloquent table with joins, orwhere and pagination correctly?

This is my original code where i display all data for team users. $data = Teamuser::join('teams', 'teams.id', '=', 'team_user.team_id') ->join('users', 'users.id', '=', 'team_user.user_id') ->get(['users.name as username','teams.name','users.email','team_user.role','team_user.id','team_user.user_id','team_user.team_id']); However, since im developing a search function for the table. I try adding orwhere…

VIEW QUESTION
Back To Top
Search