app/Http/Controllers/AssignRequirementController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
        $assignmentValidator = $this->assignmentValidator($request->all());
        if ($assignmentValidator->fails()) {
            $this->throwValidationException(
                $request, $assignmentValidator
                );
        } else {
        	$analyst 		= User::find($request->input('analyst'));
        	$requirement 	= Requirement::find($request->input('requirement'));
        	$analyst->assignments()->save($requirement);
        }
        return redirect('requirement')->with('status', 'Successfully assigned analyst!');
    }
public function store ( Request $ request ) { $ assignmentValidator = $ this -> assignmentValidator ( $ request -> all ( ) ) ; if ( $ assignmentValidator -> fails ( ) ) { $ this -> throwValidationException ( $ request , $ assignmentValidator ) ; } else { $ analyst = User :: find ( $ request -> input ( 'analyst' ) ) ; $ requirement = Requirement :: find ( $ request -> input ( 'requirement' ) ) ; $ analyst -> assignments ( ) -> save ( $ requirement ) ; } return redirect ( 'requirement' ) -> with ( 'status' , 'Successfully assigned analyst!' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .