MySql Relationship Table

2

I have a view called 'clients.blade' where the administrator will choose which clients a particular developer can see, however, I do not know how to save those changes in the database.

Model

public function Clientes ()
{
    return $this->hasMany("Clients"); //conectando as tabelas 'users' e 'clients' do banco de dados
}

Controller

public function updateClient()
    {
        var_dump(Input::get("clientes"));
        $user = \App\User::find(Input::get("id"));
    }

Customers.blade

<form method="POST" action="/user/update/client">

    <input type="hidden" name="id" value="{{$id}}" />

    <h1>BEM VINDO ADMINISTRADOR!</h1>

    <div><input type="button" value="Início" id="inicio" name="Início" onclick="window.location.href='/inicioadm';"></div> <br>

     @foreach ($clients as $client)

    <table style="width:100%">
    <tr>
    <th width="30%"><p>Nome: {{$client->Nome}} <input name="clientes[]" type="checkbox" value="{{$client->ID}}"> </p></th>       
    </tr>
    </table>

    @endforeach

    <br><div><input type="submit" value="Salvar" id="salvar" name="Salvar" onclick="window.location.href='/desenvolvedores"/div>


</form>

    
asked by anonymous 29.03.2017 / 19:11

0 answers