Take target as input parameter

I am trying to set up the dbt model so that it will work both in our staging environment and production enviorment. Is there any way for me to take target (= staging or dev) as a parameter and change the reference table name in my SQL model file?

Never mind! I found a solution from another thread.
{% if target.name == ‘staging’ %}
public.staging_events_all p
{% else %}
public.production_events_all p
{% endif %}