Hi cuemur,
To test your code I create one table like:
CREATE TABLE `inventory` (
`ID` INT NOT NULL,
`pName` VARCHAR(45) NULL);
INSERT INTO inventory VALUES(1,'test');
To match with your example:
@if($prop) You own {{ $prop->pName }} @else
You have to get only one element, to display the pName. To do that use first
:
$prop = DB::table('Inventory')->where('ID', 1)->first();
And after you can check it with your code
@if($prop) You own {{ $prop->pName }} @else You do not own any properties @endif
If you want check more than one result you have to change your template
$prop = DB::table('Inventory')->where('ID', 1)->get();
@if($prop)
You owns:
@foreach($prop as $p)
{{ $p->pName }}
@endforeach
@else
You do not own any properties
@endif
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community