public static function getTitleById($table, $id) {

        //return "table = ".$table." and id = ".$id;

        // Special handling for users
        if ($table == "users") {
            return self::getUserForIndexListing($id);
        }

        // Special handling for posts (for post updates listing)
        if ($table == "posts") {
            return self::getPostForIndexListing($id);
        }

        $title = DB::table($table)->where('id', '=', $id)->pluck('title');

        if ($title == "") {
            return '<span class="text-danger">n/a</span>';
        }

        // ASSIGN COLOURS TO lookup_todo_priority_types
        if ($table == "lookup_todo_priority_types") {

            if (strtolower($title) == "green") {
                return '<button type="button" class="btn btn-success btn-sm">'.$title.'</button>';
            }

            if (strtolower($title) == "yellow") {
                return '<button type="button" class="btn btn-warning btn-sm">'.$title.'</button>';
            }

            if (strtolower($title) == "red") {
                return '<button type="button" class="btn btn-danger btn-sm">'.$title.'</button>';
            }

        }

        return $title;
    }
public static function getTitleById($table, $id) {

        //return "table = ".$table." and id = ".$id;

        // Special handling for users
        if ($table == "users") {
            return self::getUserForIndexListing($id);
        }

        // Special handling for posts (for post updates listing)
        if ($table == "posts") {
            return self::getPostForIndexListing($id);
        }

        $title = DB::table($table)->where('id', '=', $id)->pluck('title');

        if ($title == "") {
            return '<span class="text-danger">n/a</span>';
        }

        // ASSIGN COLOURS TO lookup_todo_priority_types
        if ($table == "lookup_todo_priority_types") {

            if (strtolower($title) == "green") {
                return '<button type="button" class="btn btn-success btn-sm">'.$title.'</button>';
            }

            if (strtolower($title) == "yellow") {
                return '<button type="button" class="btn btn-warning btn-sm">'.$title.'</button>';
            }

            if (strtolower($title) == "red") {
                return '<button type="button" class="btn btn-danger btn-sm">'.$title.'</button>';
            }

        }

        return $title;
    }
public static function getTitleById ( $ table , $ id ) { //return "table = ".$table." and id = ".$id; // Special handling for users if ( $ table == "users" ) { return self :: getUserForIndexListing ( $ id ) ; } // Special handling for posts (for post updates listing) if ( $ table == "posts" ) { return self :: getPostForIndexListing ( $ id ) ; } $ title = DB :: table ( $ table ) -> where ( 'id' , '=' , $ id ) -> pluck ( 'title' ) ; if ( $ title == "" ) { return '<span class="text-danger">n/a</span>' ; } // ASSIGN COLOURS TO lookup_todo_priority_types if ( $ table == "lookup_todo_priority_types" ) { if ( strtolower ( $ title ) == "green" ) { return '<button type="button" class="btn btn-success btn-sm">' . $ title . '</button>' ; } if ( strtolower ( $ title ) == "yellow" ) { return '<button type="button" class="btn btn-warning btn-sm">' . $ title . '</button>' ; } if ( strtolower ( $ title ) == "red" ) { return '<button type="button" class="btn btn-danger btn-sm">' . $ title . '</button>' ; } } return $ title ; }
Grab the title by ID


@param    string     $table
@param    int        $id
@return   string
Grab the title by ID