TP framework data association problem, stuck for several days to ask for help!

/**
 * 
 */

public function categories()
{
    return $this->belongsToMany("AudioCategoryModel", "portal_category_post", "category_id", "post_id");
}

id=27, is 27 records of the content table

    $id = $this->request->param("id", 0, "intval");

    $AudioPostModel = new AudioPostModel();
    $post            = $AudioPostModel->where("id", $id)->find();
    $postCategories  = $post->categories()->alias("a")->column("a.name", "a.id");
    $postCategoryIds = implode(",", array_keys($postCategories));
    dump($postCategoryIds);         
    dump($postCategories);

data from dump

string(5) "10,11"
array(2) {
  [10] => string(12) ""
  [11] => string(12) ""
}

Classification Table

clipboard.png

27id

clipboard.png

clipboard.png

originally the intermediate table post_id is associated with the id, of the content table. Now I want to modify the post_id of the post_id, content table of the post_id associated content table to be a timestamp.

the whole execution logic should first take the data whose post_id is equal to id filtered out by the id of the content table in the intermediate table, and then look up the resulting category_id to the classification table to get the corresponding name.

however, I can"t find the first step in the above code, that is, to find the intermediate table data with the content table id, so there is no way to find the data through post_id.

Jan.26,2022
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e8afb7-1021.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e8afb7-1021.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?