If a function has a slant asymptote, it means that it is asymptotically equivalent to a certain line #y=mx+q#.

This means that

#lim_{x\to\infty} f(x)-(mx+q)=0#.

Divide by #x#:

#lim_{x\to\infty} f(x)/x-(m+q/x)=0#.

Since #q/x\to 0#, we have that

#lim_{x\to\infty} f(x)/x-m=0#.

And so #m=lim_{x\to\infty} f(x)/x#

Once #m# is known, we can find #q# by calculating

#lim_{x\to\infty} f(x)-mx=q#.

Now, let's do the calulations: in your case,

#lim_{x\to\pm\infty} f(x)/x = 3#, since we have

#f(x)/x=\frac{3x^3-28x^2+54x-24}{x^3-8x^2+7x}#

And the limits at #\pm\infty# are given by the ratio of the coefficients of the leading terms (i.e. #x^3#), which in this case are #3# and #1#.

So, #m=3#. Now let's compute #q#:

#\lim_{x\to\pm\infty} f(x)-mx = \frac{3x^3-28x^2+54x-24}{x^2-8x+7} - 3x#

And since

#\frac{3x^3-28x^2+54x-24}{x^2-8x+7} - 3x = \frac{3x^3-28x^2+54x-24-(3x^3-24x^2+21x)}{x^2-8x+7}#

#=\frac{-4x^2+33x-24}{x^2-8x+7}#

And this function tends to #-4# as #x\to\pm\infty#