You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to pass information from 2 tables to the overriten read.blade.php(resources/views/vendor/voyager/pacient/read.blade.php) of my PacientsController but I can't figure out why I get Undefined variable $pacient error . Everything I put into the Controller is not passed to the view.
I have the following controller: <?php namespace App\Http\Controllers; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Redirect; use Illuminate\View\View; use App\Pacients; class PacientsController extends Controller { public function read($id) { $pacient = Pacients::with('details', 'profile')->findOrFail($id); return view('pacients.read')->with($pacient); } }
I have the following route: Route::get('/pacients/{id}', 'PacientsController@read')->name('pacients.read');
I have the following model: <?php namespace App; use Illuminate\Database\Eloquent\Model; class Pacients extends Model { protected $table = 'pacients'; public function details() { return $this->hasOne(details::class, 'pacient_code', 'id'); } public function profile() { return $this->hasOne(Profile::class, pacient_code', 'id'); } }
I have the following view: {{ dd($pacient); }}
Steps to reproduce
As described
Expected behavior
Show the informations
Screenshots
No response
Additional context
No response
The text was updated successfully, but these errors were encountered:
Laravel version
9.52.16
PHP version
8.3.3-1+0
20240216.17+debian101.gbp87e37bVoyager version
1.7
Database
MariaDB version 10.3.39
Description
I'm trying to pass information from 2 tables to the overriten read.blade.php(resources/views/vendor/voyager/pacient/read.blade.php) of my PacientsController but I can't figure out why I get Undefined variable $pacient error . Everything I put into the Controller is not passed to the view.
I have the following controller:
<?php namespace App\Http\Controllers; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Redirect; use Illuminate\View\View; use App\Pacients; class PacientsController extends Controller { public function read($id) { $pacient = Pacients::with('details', 'profile')->findOrFail($id); return view('pacients.read')->with($pacient); } }
I have the following route:
Route::get('/pacients/{id}', 'PacientsController@read')->name('pacients.read');
I have the following model:
<?php namespace App; use Illuminate\Database\Eloquent\Model; class Pacients extends Model { protected $table = 'pacients'; public function details() { return $this->hasOne(details::class, 'pacient_code', 'id'); } public function profile() { return $this->hasOne(Profile::class, pacient_code', 'id'); } }
I have the following view:
{{ dd($pacient); }}
Steps to reproduce
As described
Expected behavior
Show the informations
Screenshots
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: