laravel-api-generator
laravel-api-generator copied to clipboard
specify table key different from id
Is there a way to generate the scaffold on a table that does not have ID as the key? It seems that it assumes that it must be there and does not recognize the real key.
@kirchaj you can use Generator From Existing Tables to generate views which will create CRUD, but then you need to do changes based on your primary keys in your repository and controller.
@kirchaj I have made a simple adjustment when you use "--fromTable" option, the generator will get the first field the table and use it like primary key, putting the (public $primaryKey = "first_field_id";) on the Eloquent Model. Also will use the primary key in the Views (before this change was hard coded with "id").