// route
Route::get('/caripromotor/{nama_promotor}', '[email protected]');

// Promotor Controller
public function caripromotor($nama_promotor) {
    $nama_promotor = Promotor::select('nama_promotor')->where('nama_promotor', 'LIKE', "$nama_promotor%")->get();
    return response()->json($nama_promotor);
}

// the typeahead

var nama_promotor = new Bloodhound({
    datumTokenizer: Bloodhound.tokenizers.whitespace('nama_promotor'),
    queryTokenizer: Bloodhound.tokenizers.whitespace,
    remote: {
        url: 'caripromotor/%nama_promotor',
        wildcard: '%nama_promotor'
    }
});

nama_promotor.initialize();

$("#typeaheadpromotor").typeahead({
    hint: true,
    highlight: true,
    minLength: 3
}, {
    source: nama_promotor.ttAdapter(),
    // This will be appended to "tt-dataset-" to form the class name of the suggestion menu.
    name: 'nama_promotor',
    // the key from the array we want to display (name,id,email,etc...)
    displayKey: 'nama_promotor',
    templates: {
        empty: [
            '<div class="empty-message"><span class="notfoundata">tidak dapat menemukan data</span></div>'
        ].join('\n'),
        suggestion: function(data) {
            return '<div class="kdbarangpostest"><span class="typeaheadfonting">' + data.nama_promotor + '<span></div>'
        }
    }
});