get forch id in contruller code example
Example: lightning component get current record id
<aura:component implements="force:lightningQuickAction,force:hasRecordId">
<aura:attribute name="recordId" type="String" />
</aura:component>
<aura:component implements="force:lightningQuickAction,force:hasRecordId">
<aura:attribute name="recordId" type="String" />
</aura:component>