mardi 27 octobre 2015

Laravel block member by checkbox

I am using Laravel 5.1

I have a client table. Client will create their own account and waiting for admin approval. Admin can activate, deactivate or even block them anytime. I have three links (I can change to button if needed) bottom of the table ACTIVE, DEACTIVATE & BLOCK. There is also checkbox in every row.

Now, I want select one or multiple clients and change the value of the status field of member table in database.

Here is code of my view:

<table border="1">
    <tr>
        <td></td>
        <td>Name</td>
        <td>Activity</td>
        <td>main Activity</td>
        <td>Legal Status</td>
        <td>SIREN Code</td>
        <td>Contact Firstname</td>
        <td>Contact Lastname</td>
        <td>Contact Email</td>
        <td>Contact Telephone</td>
        <td>Address</td>
        <td>Town</td>
        <td>Area</td>
        <td>Region</td>
        <td>Creation Date</td>
        <td>Offer Pack Name</td>
        <td>Login Password</td>
        <td>Status</td>
    </tr>
    @foreach($clients as $client)
    <tr>
        <td>{!! Form::checkbox('client[]',$client->id,null) !!}</td>
        <td>{{ $client->name }}</td>
        <td>{{ $client->activity }}</td>
        <td>{{ $client->main_activity }}</td>
        <td>{{ $client->status }}</td>
        <td>{{ $client->siren_code }}</td>
        <td>{{ $client->contact_firstname }}</td>
        <td>{{ $client->contact_lastname }}</td>
        <td>{{ $client->email }}</td>
        <td>{{ $client->contact_telephone }}</td>
        <td>{{ $client->address }}</td>
        <td>{{ $client->town }}</td>
        <td>{{ $client->area }}</td>
        <td>{{ $client->region }}</td>
        <td>{{ $client->creation_date }}</td>
        <td>{{ $client->offer_pack_name }}</td>
        <td>{{ $client->password }}</td>
        <td>{{ $client->status }}</td>
    </tr>
    @endforeach
</table>
<div class="col-md-10 text-center">
    <a href="{{ action('AdminController@blockClient') }}" class="btn btn-default">BLOCK</a>
    <a href="{{ action('AdminController@activateClient') }}" class="btn btn-default">ACTIVATE</a>
    <a href="{{ action('AdminController@deactivateClient') }}" class="btn btn-default">ACTIVATE</a>
</div>

My route is:

get('blockClient','AdminController@blockClient');
get('activateClient','AdminController@activateClient');
get('activateClient','AdminController@deactivateClient');



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire