-1

I want to hide program_code column in excel file when importing. What should I do? I'm using ToModel for Class Import.

enter image description here

ProgramImport.php

public function __construct(string $program_code)
{
    $this->program_code = $program_code;
}

public function model(array $row)
{
    $row['program_code'] = $this->program_code;

    return new ProgramDetail([
        'program_detail_no' => $row['number'],
        'program_detail_code' => $row['program_code'],
        'program_detail_subject' => $row['subject_code'],
        'program_detail_semester' => $row['semester'],
        'program_detail_note' => $row['note'],
    ]);
}
TrJoke
  • 69
  • 7
  • what do you mean by hide it? hide it from what? – lagbox Dec 04 '21 at 19:45
  • I just updated the post. I want to not need to enter data for `program_code` column and how to hide `'program_detail_code'=>$row['program_code']`? – TrJoke Dec 04 '21 at 19:59
  • remove that line then .... not sure what the issue is here – lagbox Dec 04 '21 at 19:59
  • so how can i assign default value to `program_code`...? – TrJoke Dec 04 '21 at 20:04
  • you mean to `program_detail_code`? ... you are the one doing the assignment in the code, assign what ever value you want, or do it at the database level ... still not sure what the problem is here – lagbox Dec 04 '21 at 20:05
  • awesome, you should answer your question with your solution then – lagbox Dec 04 '21 at 21:51

1 Answers1

0

you can for send a sub query to excel class. you are using which version of excel package?

Amir Khaledian
  • 109
  • 1
  • 4