public function update(Request $request, $id)
    {
        $job = Job::findOrFail($id);
        /** @noinspection PhpUndefinedMethodInspection */
        $request->validate([
            'locationId' => 'exists:' . config('combine-core.tablePrefix', 'combine') . '_locations,id',
            'memberIds.*' => 'required|exists:' . config('combine-core.tablePrefix', 'combine') . '_members,id',
            'memberTagIds.*' => 'required|exists:' . config('combine-core.tablePrefix', 'combine') . '_member_tags,id',
            'start' => 'required|date',
        ]);
        $job->start = Carbon::parse($request->start);
        $job->location_id = $request->locationId;
        $this->authorize('manage', $job);
        $job->save();
        /** @noinspection PhpUndefinedMethodInspection */
        $job->members()->sync($request->memberIds);
        /** @noinspection PhpUndefinedMethodInspection */
        $job->member_tags()->sync($request->memberTagIds);
        return fractal($job, new JobTransformer())
            ->withResourceName('job')
            ->respond();
    }
public function update(Request $request, $id)
    {
        $job = Job::findOrFail($id);
        /** @noinspection PhpUndefinedMethodInspection */
        $request->validate([
            'locationId' => 'exists:' . config('combine-core.tablePrefix', 'combine') . '_locations,id',
            'memberIds.*' => 'required|exists:' . config('combine-core.tablePrefix', 'combine') . '_members,id',
            'memberTagIds.*' => 'required|exists:' . config('combine-core.tablePrefix', 'combine') . '_member_tags,id',
            'start' => 'required|date',
        ]);
        $job->start = Carbon::parse($request->start);
        $job->location_id = $request->locationId;
        $this->authorize('manage', $job);
        $job->save();
        /** @noinspection PhpUndefinedMethodInspection */
        $job->members()->sync($request->memberIds);
        /** @noinspection PhpUndefinedMethodInspection */
        $job->member_tags()->sync($request->memberTagIds);
        return fractal($job, new JobTransformer())
            ->withResourceName('job')
            ->respond();
    }
public function update ( Request $ request , $ id ) { $ job = Job :: findOrFail ( $ id ) ; /** @noinspection PhpUndefinedMethodInspection */ $ request -> validate ( [ 'locationId' => 'exists:' . config ( 'combine-core.tablePrefix' , 'combine' ) . '_locations,id' , 'memberIds.*' => 'required|exists:' . config ( 'combine-core.tablePrefix' , 'combine' ) . '_members,id' , 'memberTagIds.*' => 'required|exists:' . config ( 'combine-core.tablePrefix' , 'combine' ) . '_member_tags,id' , 'start' => 'required|date' , ] ) ; $ job -> start = Carbon :: parse ( $ request -> start ) ; $ job -> location_id = $ request -> locationId ; $ this -> authorize ( 'manage' , $ job ) ; $ job -> save ( ) ; /** @noinspection PhpUndefinedMethodInspection */ $ job -> members ( ) -> sync ( $ request -> memberIds ) ; /** @noinspection PhpUndefinedMethodInspection */ $ job -> member_tags ( ) -> sync ( $ request -> memberTagIds ) ; return fractal ( $ job , new JobTransformer ( ) ) -> withResourceName ( 'job' ) -> respond ( ) ; }
Store an updated Job

@param  \Illuminate\Http\Request $request current Request object
@param string $id UUID of Job to update
@return \Illuminate\Http\Response JSON object of updated Job, with relations
Store an updated Job