lakmalp

Experience

100

0 Best Reply Awards

  • Member Since 1 Week Ago
  • 0 Lessons Completed
  • 0 Favorites

14th March, 2017

lakmalp left a reply on Variable Access Issue From Blade Template • 1 week ago

@Snapey Thanks for the explanation. But it does limit its flexibility it seems. I couldn't use Eloquent since I need to have more than one columns for the PRIMARY KEY of this table.

lakmalp left a reply on Variable Access Issue From Blade Template • 1 week ago

@SaeedPrez My goodness! It worked! Thanks a zillion (Y)

lakmalp left a reply on Variable Access Issue From Blade Template • 1 week ago

@Abi Tried and it didn't work either

lakmalp left a reply on Variable Access Issue From Blade Template • 1 week ago

@SaeedPrez My model is not Eloquent. Will

$companies = Company::pluck('description', 'company_id');

work?

lakmalp left a reply on Variable Access Issue From Blade Template • 1 week ago

Yeah the error says the same... But I need to know how to fix it... Thanks for your reply.

lakmalp started a new conversation Variable Access Issue From Blade Template • 1 week ago

I get htmlentities() expects parameter 1 to be string, object given error when I use $companies variable in VIEW. I want description to be shown in the combo whereas company_id as the names of each option.

CONTROLLER:

$companies = Company::getAllCompanies();
return view('appuser.create', compact('companies'));

MODEL (Company):

public static function getAllCompanies()
{
        
    $result = DB::table(Company::_TABLE_)->select(['company_id', 'description'])->get();
        
    return $result;
}

VIEW:

{!! Form::select('sCompanyId', $companies, null, ['class' => 'col-md-4 form-control', 'style' => 'width:100%;']) !!}
Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.