How To Display The Lookup Table Type Name In Frontend

I am using lookup table (just like in the blog example that is used for post status i.e. Draft, Publish etc) in my project. Now I want to display the lookup type (for example postStatus) value(for example Publish or Draft) in my front end view.

But I am confused that how to display that value ?

If anyone have the solution then please share it.

Thanks in advance.

I assume that you save the post status as a tiny int, or something along those lines?

If this is the case, I would

In your {Model}Search.php


public $statusName;

in the rules

set status name as safe

then in the dataProvider->setSort


'statusName' => [

	'asc' =>  ['status' => SORT_ASC],

	'desc' => ['status' => SORT_DESC],					


then in your {Model}.php

	public function getStatusName()


		switch ($this->status) {

			case 10:

				return 'Active';



       			echo "Inactive";



or whatever options your require

also don’t forget in your gridview to set a column as ‘statusName’

Hope this helps!