Let's denote the amount of money Travis had at the beginning of the day as \( x \).
According to the problem:
- Travis spent $4 for lunch.
- He then spent $26 on groceries for dinner.
- At the end of the day, he had $8 left.
We can create an equation based on this:
\[ x - 4 - 26 = 8 \]
Now, simplify the left side:
\[ x - 30 = 8 \]
Next, add 30 to both sides to solve for \( x \):
\[ x = 8 + 30 \] \[ x = 38 \]
So, Travis had $38 at the beginning of the day.