1

Trying to return 1 row and get only couple column values of it:

public static function getLastUpdate(){
    return Settings::where('item', 'lastUpdate')->first()->value('item', 'created_at');
}

gives only value for 'item'.

pluck() not working here (gives new query on all table)

$hidden not good, since i'm using couple methods in same model.

didnt find in laravel docs. Thanks

1 Answer 1

2
public static function getLastUpdate(){
    return Settings::where('item', 'lastUpdate')->first(['item', 'created_at']);
}

$setting = getLastUpdate();
echo $setting->item;
echo $setting->created_at;
Sign up to request clarification or add additional context in comments.

1 Comment

tried, but for some reason not worked for me. may be made some mistake. thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.