Using Laplace transform in $t$, or otherwise, solve the equation for $u$:
$$\frac{\partial u}{\partial t}+\frac{\partial u}{\partial x}=x$$
in the region: $x$ > 0, $t$ > 0, subject to the boundary condition $u$(0,t) = 0 and to the initial condition $u$(x,0)=$f$(x)
Method of characteristics
On any line $\mathrm{d}x=\mathrm{d}t$ (that is, $x=x_0+t$), we get $$ \mathrm{d}u=\frac{\partial u}{\partial t}\mathrm{d}t+\frac{\partial u}{\partial x}\mathrm{d}x=x\,\mathrm{d}x\tag{1} $$ Integrating, we get $$ u(x,x-x_0)=\frac12x^2+v(x_0)\tag{2} $$ or $$ u(x,t)=\frac12x^2+v(x-t)\tag{3} $$ for any differentiable function $v$.
Initial Conditions
The two conditions meet at $(0,0)$. The characteristic that passes through this point is $x=t$.
For $x\le t$, we use the initial condition $u(0,t)=0$, which means $$ \begin{align} v(0-t) &=u(0,t)-\frac12\cdot0^2\\ &=0\tag{4} \end{align} $$ For $t\gt x$, we use the initial condition $u(x,0)=f(x)$, which means $$ \begin{align} v(x-0) &=u(x,0)-\frac12x^2\\ &=f(x)-\frac12x^2\tag{5} \end{align} $$ Therefore, $$ v(x)=\left\{\begin{array}{} 0&\text{if }x\le0\\ f(x)-\frac12x^2&\text{if }x\gt0 \end{array}\right.\tag{6} $$ and we plug $(6)$ into $(3)$.