Checkbox value to database in laravel
<p>On page skilledHandyman, I have a handyman_id stored from a previous page and a form with checkboxes with list of jobs available, what I want to do is to update foreign key job_id in "handymen" table using whatever checkbox has been selected by taking job_id from table "jobs". Value of job_id is in the checkbox as it can be seen in the code, it just has to be taken and update a job_id foreign key within handyman. I have set up relationships hasMany with jobs table and belongsTo from job to handyman. This is what I have at the moment but it obviously doesn't work as intended.</p>

<pre><code>@extends('layouts.master')

@section('skilledHandyman', 'Add Job')
        @section('header2')
            &lt;ul&gt;
                &lt;li&gt;&lt;a href="{{url('assignjob')}}"&gt;Assign job&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
        @show
@section('content')
    &lt;h1&gt;Handyman details&lt;/h1&gt;
&lt;ul&gt;
    &lt;li&gt;First Name:{{$skilledHandyman-&gt;first_name}}&lt;/li&gt;
    &lt;li&gt;Last Name:{{$skilledHandyman-&gt;last_name}}&lt;/li&gt;
    &lt;li&gt;Street:{{$skilledHandyman-&gt;street}}&lt;/li&gt;
    &lt;li&gt;Postcode:{{$skilledHandyman-&gt;postcode}}&lt;/li&gt;
    &lt;li&gt;Town:{{$skilledHandyman-&gt;town}}&lt;/li&gt;
    &lt;li&gt;Skills:{{$skilledHandyman-&gt;skills}}&lt;/li&gt;
&lt;/ul&gt;

    &lt;form action="{{url('skilledHandyman')}}" method="POST"&gt;
    {{ csrf_field() }}
     @foreach ($jobs as $job)
        &lt;div&gt;
            &lt;label&gt;{{$job-&gt;name}}&lt;/label&gt;
            &lt;input type='checkbox' value='{{$job-&gt;id}}' name='jobs[]'/&gt;
        &lt;/div&gt;
    @endforeach
    &lt;input type="submit" name="submitBtn" value="Assign Job"&gt;
&lt;/form&gt;
@endsection
</code></pre>

<hr>

<pre><code>function jobassign(Request $request, $id)
{
    $job = Handyman::where('handyman_id', $handymanId)-&gt;update(['job_id', $request-&gt;job_id]);
    return redirect()-&gt;back()-&gt;with('status', trans('Handyman has been successfully assigned to this job.'));
}
function skilledHandyman($handymanId)
{
    $skilledHandyman = Handyman::find($handymanId);
    $jobs = Job::all();
    return view('layouts/skilledHandyman', ['jobs' =&gt; $jobs, 'skilledHandyman' =&gt; $skilledHandyman]);
</code></pre>

<h2>        }</h2>

<pre><code>Route::group(['middleware' =&gt; ['web']], function () {

Route::get('home', 'HandymanController@home');

Route::get('search', 'HandymanController@search');

Route::get('details/{skill}', 'HandymanController@details');

Route::get('skilledHandyman/{handymanId}', 'HandymanController@skilledHandyman');

Route::post('jobassign', 'HandymanController@jobassign');

//Route::get('assignjob/{handymanId}', 'HandymanController@assignJob');

Route::get('addjob', 'HandymanController@addJob');

Route::post('addjform', 'HandymanController@addjForm');

Route::get('jobs', 'HandymanController@jobs');

Route::get('jobsdetails/{jobId}', 'HandymanController@jobsdetails');

Route::get('deletejob', 'HandymanController@deleteJob');

Route::post('deletejform', 'HandymanController@deletejForm');
</code></pre>

<h2>    });</h2>

<pre><code>public function up()
{
    Schema::create('handymen', function (Blueprint $table) {
        $table-&gt;increments('id');
        $table-&gt;string('first_name');
        $table-&gt;string('last_name');
        $table-&gt;string('street');
        $table-&gt;string('postcode');
        $table-&gt;string('town');
        $table-&gt;string('skills');


        $table-&gt;integer('job_id')-&gt;unsigned();
        $table-&gt;foreign('job_id')-&gt;references('id')-&gt;on('jobs')-&gt;onDelete('cascade');


        $table-&gt;timestamps();
        });
    }
----

/**
 * Reverse the migrations.
 *
 * @return void
 */
public function down()
{
    Schema::table('handymen', function (Blueprint $table) {
        $table-&gt;dropForeign('handymen_job_id_foreign');
        $table-&gt;dropColumn('job_id');
    });
}
</code></pre>

<p>}
If any other files are needed I will update the page when requested, please help me here</p>