Search code examples
phpphpmyadmingrocery-crud

Grocery crud to show display name instead of ID


In my application I have two tables

orders:

order_id

order_number

products:

product_id

product name

order_id(foreign key)

and in my phpmyadmin I chose order_id to display as order_number but when I render the view associated with products it displays order_id. is there any way that it can order_number instead of order_id?


Solution

  • According to your question, enough adding the following line in the products controller, before rendering of course.

    $crud->set_relation('order_id','orders','order_number');