Reputation: 8385
I am having an issue with siteSocialSettingsData
in my blade view I am getting
Use of undefined constant facebook - assumed 'facebook'
However I am confused as to why its happening as the GeneralSettings
area/section is working how it should and they are both the same sections of code
In my function I have done var_dump($siteSocialSettingsData->facebook);
and it works as I want it
Function:
$siteSettingsDB = GeneralSettings::get();
$siteSettingsData = $siteSettingsDB[0];
$siteSocialSettingsDB = SocialSettings::get();
$siteSocialSettingsData = $siteSocialSettingsDB[0];
return view('admin.pages.settings.general.general', compact('pageTitle','siteName', 'pageName', 'fullName','cpuUsage','memoryUsage', 'siteSettingsData', 'siteSocialSettingsData'));
Blade:
<input class="form-control updateField" data-id="facebook" data-url="{{ route('socialDataSubmit', facebook )}}" data-title="Facebook" name="facebook" placeholder="Facebook" type="input" value="{{ old('facebook', $siteSocialSettingsData->facebook)}}"> <span class="input-group-btn"><button class="btn btn-default edit" type="button"><span class="glyphicon glyphicon glyphicon-pencil"></span></button></span>
Upvotes: 0
Views: 7584
Reputation: 14980
You are just entering facebook
without telling PHP if that's a variable or a string and that's why you're getting the error. The error is in your blade view, at the data-url
attribute, when you're calling the route function (check the second parameter).
You need to change your view to:
<input class="form-control updateField" data-id="facebook"
data-url="{{ route('socialDataSubmit', $siteSocialSettingsData->facebook )}}"
data-title="Facebook" name="facebook" placeholder="Facebook" type="input"
value="{{ old('facebook', $siteSocialSettingsData->facebook)}}">
<span class="input-group-btn">
<button class="btn btn-default edit" type="button">
<span class="glyphicon glyphicon glyphicon-pencil"></span>
</button>
</span>
Upvotes: 2