laravel - I could not read a property in php. getting non-object exception -
i have defined variable $alarm
in php page. returns like; in page try access gradename , calling like; (i want extract details returned alarm details)
<div class=... $alarm[0]['gradename'] </div>
but im getting
trying property of non-object (view: /app/resources/views/alarms/ack.blade.php) in c593810096345df8c818851d1e61ae4bc523a3d4.php (line 43) @ compilerengine->handleviewexception(object(errorexception), 0) in phpengine.php (line 44) @ phpengine->evaluatepath('/app/storage/framework/views/c593810096345df8c818851d1e61ae4bc523a3d4.php', array('__env' => object(factory), 'app' => object(application), 'errors' => object(viewerrorbag), 'alarm' => object(alarm), 'yfsessionid' => '2oxcaqwmegxuiyzjm2ox7wmih2bp6hfrwdmxilmcdrjvsmizswbeha==')) in compilerengine.php (line 59)
what i'm doing wrong here?
{"alarmid":173358,"messagenotificationid":"105933", "companyid":"33", "companycode":"euro", "alerttypeid":"23", "alertid":"4314893", "sitecode":"20167822", "sitename":"trafford centre service station", "tanknumber":null, "dispensernumbedr":null, "hosenumber":null, "gradeid":null, "gradename":null}
if in php class;
public function(){ **echo "<font color='red'><b>$alarm->companycode</font></b><br>";** //---------->i see return view('alarms.ack', ['alarm' => $alarm, 'yfsessionid' => $yfsessionid]); }
in view if access non-object issue;
<div class="form-group"> <label class="col-md-4 control-label">volume</label> <div class="col-md-6 control-label-text-left"> {{ $alarm->alarmvolume }} </div> </div>
in errors says 'alarm' => object(alarm)
please try access, gradename
property : $alarm->gradename
Comments
Post a Comment