aaronmorley Posted July 27, 2016 Share Posted July 27, 2016 Hi all, I am hoping someone can help me In my hook, I can do the following to get client details and display the name of the client. $client = Menu::context('client'), $Message = <p> Hello {$client->firstName} </p>; However, I want to get one of the custom client fields I have made instead. (for example VAT Number). How can I do this? Thanks in advance if anyone can answer this. 0 Quote Link to comment Share on other sites More sharing options...
twhiting9275 Posted July 27, 2016 Share Posted July 27, 2016 Use Capsule to grab it. Something like this $fieldid = Capsule::table('tblcustomfields')->where('fieldname', '=', 'VAT')->where('type', '=', 'client') ->pluck('id'); $vatnum = Capsule::table('tblcustomfieldsvalues')->where('fieldid', '=', "$fieldid")->where('relid', '=', "$clientid") ->pluck('value'); 0 Quote Link to comment Share on other sites More sharing options...
aaronmorley Posted August 2, 2016 Author Share Posted August 2, 2016 Hi Twhiting, I tried the following: $fieldid = Capsule::table('tblcustomfields')->where('fieldname', '=', 'Dashboard')->where('type', '=', 'client') ->pluck('id'); $dashboardText = Capsule::table('tblcustomfieldsvalues')->where('fieldid', '=', "$fieldid")->where('relid', '=', "$clientid") ->pluck('value'); I seem to get a 500 error with this code. Not sure why. I checked the DB and a field with that name does exist. Any ideas? 0 Quote Link to comment Share on other sites More sharing options...
aaronmorley Posted August 2, 2016 Author Share Posted August 2, 2016 Ah I forgot to add: use Illuminate\Database\Capsule\Manager as Capsule; It works now. Thank you very much for your help. 0 Quote Link to comment Share on other sites More sharing options...
twhiting9275 Posted August 3, 2016 Share Posted August 3, 2016 So sorry that I missed this response. Glad to see you got it all sorted out though that 'capsule' statement is kind of an important thing 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.