Associations when accessing another controller

Good afternoon!
lpu = this-> findByHospital_id ( id, [ 'hospitals.lpu' => intval ( uid_lpu),
The first table “Hospitals” contains: ID, lpu and description.
The second Blood table contains Hospital_id
Please tell me how in the second controller I want to determine the id of the first (intval(uid_lpu)) - this is the value obtained by the post method)
The bottom line is that I need to find the id of the second table (via the condition)

Well first get some authentication and authorization setup. Next setup relations:

Or use a query similar to:

Not cake example but you should get the idea:

    public function ownerWithPets()
        $ownerid = $request->input('ownerid');  // passed from search
        $owner = Powner::find($ownerid);     // find owner (hospital)
        $pets = DB::table('pets')                    // child table
                        ->where('ownerid', '=', $ownerid)
                        ->orderBy('petname', 'asc')->get();
        return view('owner/ownerpet')->with(compact('owner', 'pets'));


<!DOCTYPE html>

        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <div><?php echo $owner->oname; ?>  // the petowner (hospital)
            <?php echo "<br>"; ?>
            <?php echo "======================"; ?>
            <?php foreach ($pets as $pet) { ?>
            <?php echo $pet->petname; ?> // Child table data
                <?php echo "<br>"; ?>
            <?php } ?>

Just a very simplified example here. Use whatever layout, template, etc as needed.
Don’t forget to validate, sanitize the data.