'Laravel | Update two tables
I have a doubt here regarding changing data in two tables in
 public function editar_perfil(Request $request, funcionario $item){
     
    $item->nome = $request->nome;
    $item->email = $request->email;
    $item->telefone = $request->telefone;
    //$item->foto = $request->foto;
    $item->data_nasc = $request->data_nasc;
    $item->nacionalidade = $request->nacionalidade;
    $item->n_cartao_cc = $request->n_cartao_cc;
    $item->nif = $request->nif;
    $item->morada = $request->morada;
    $item->n_porta = $request->n_porta;
    $item->localidade = $request->localidade;
    $item->concelho = $request->concelho;
    $item->distrito = $request->distrito;
    $item->cp = $request->cp;
    $item->data_entrada = $request->data_entrada;
    $item->funcao = $request->funcao;
    $item->estado = $request->estado;
    //$item->n_ferias_disponiveis = $request->n_ferias_disponiveis;
    //$item->data_registo = $now;
    $item->save();
What I want to do now is that the line
 $item->n_ferias_disponiveis = $request->n_ferias_disponiveis;
Be changed in another 'Ferias' table
Is there a way to do it directly? Thank you!
EDIT:
I store the data as follows:
    $tabela->nome = $request->nome;
    $tabela->email = $request->email;
    $tabela->telefone = $request->telefone;
    (...)
    $result = $tabela->save();
 
    $tabela4 = new feria(); 
    $tabela4->id_funcionario = $tabela->id;
    $tabela4->n_ferias_disponiveis = $request->n_ferias_disponiveis;
    $tabela4->save();
And now I want to edit these same tables.
Solution 1:[1]
I think if there is relationship between the two tables it will change automatically
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|---|
| Solution 1 | Alya Al Siyabi | 
