skip to Main Content

How to load a relationship in Laravel without foreign key?

I have this model: AppControllersImageController.php ..... $image = new Image; $image->id = "pre_" . (string) Str::ulid()->toBase58(); $image->filename = $filename $image->post_id= $post_id; $image->save(); return $image->load("post:id,status,subject,body"); it is working fine, it returns the following: { "id": "pre_1BzVrTK8dviqA9FGxSoSnU", "type": "document", "filename": "v1BzVc3jJPp64e7bQo1drmL.jpeg", "post_id":…

VIEW QUESTION
Back To Top
Search