Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Eagar loading,parent child relationship,Sub relationship in laravel

return $this->_planet->with(['alphabets' => function ($alphabets) {
            $alphabets->with(['tasks' => function ($task) {
                $task->with(['game' => function ($game) {
                    $game->with(['questions' => function ($questions) {
                        $questions->with(['choices' => fn ($choices) => $choices->select(["id", "answer_text", "is_correct", "audio_file", "question_id"])])->addSelect(["id", "question_text", "audio_name", "max_answer_selection", "game_id"]);
                    }])->addSelect(['id', 'name', "type", "identifier"]);
                }])->addSelect(['id', 'title', "type", "video_link", "alphabets_id", "game_id"]);
            }])->addSelect(['id', 'name', "identifier", "value", "planet_id"]);
        }])->addSelect(['id', 'name', "identifier", "image"])->where("id", 1)->get();
Source by api.jquery.com #
 
PREVIOUS NEXT
Tagged: #Eagar #child #relationship #laravel
ADD COMMENT
Topic
Name
7+5 =