protected function assignUsersToAssignment()
    {
        $assignment = fp_env('ACACHA_FORGE_ASSIGNMENT');
        foreach ( $this->users as $user) {
            $uri = str_replace('{assignment}', $assignment, config('forge-publish.assign_user_to_assignment_uri'));
            $uri = str_replace('{user}', $user, $uri);
            $url = config('forge-publish.url') . $uri;
            try {
                $response = $this->http->post($url, [
                    'headers' => [
                        'X-Requested-With' => 'XMLHttpRequest',
                        'Authorization' => 'Bearer ' . fp_env('ACACHA_FORGE_ACCESS_TOKEN')
                    ]
                ]);
            } catch (\Exception $e) {
                if ($e->getResponse()->getStatusCode() == 422) {
                    $this->error('The user is already assigned');
                    return;
                }
                $this->error('And error occurs connecting to the api url: ' . $url);
                $this->error('Status code: ' . $e->getResponse()->getStatusCode() . ' | Reason : ' . $e->getResponse()->getReasonPhrase());
                return;
            }
        }
    }
protected function assignUsersToAssignment()
    {
        $assignment = fp_env('ACACHA_FORGE_ASSIGNMENT');
        foreach ( $this->users as $user) {
            $uri = str_replace('{assignment}', $assignment, config('forge-publish.assign_user_to_assignment_uri'));
            $uri = str_replace('{user}', $user, $uri);
            $url = config('forge-publish.url') . $uri;
            try {
                $response = $this->http->post($url, [
                    'headers' => [
                        'X-Requested-With' => 'XMLHttpRequest',
                        'Authorization' => 'Bearer ' . fp_env('ACACHA_FORGE_ACCESS_TOKEN')
                    ]
                ]);
            } catch (\Exception $e) {
                if ($e->getResponse()->getStatusCode() == 422) {
                    $this->error('The user is already assigned');
                    return;
                }
                $this->error('And error occurs connecting to the api url: ' . $url);
                $this->error('Status code: ' . $e->getResponse()->getStatusCode() . ' | Reason : ' . $e->getResponse()->getReasonPhrase());
                return;
            }
        }
    }
protected function assignUsersToAssignment ( ) { $ assignment = fp_env ( 'ACACHA_FORGE_ASSIGNMENT' ) ; foreach ( $ this -> users as $ user ) { $ uri = str_replace ( '{assignment}' , $ assignment , config ( 'forge-publish.assign_user_to_assignment_uri' ) ) ; $ uri = str_replace ( '{user}' , $ user , $ uri ) ; $ url = config ( 'forge-publish.url' ) . $ uri ; try { $ response = $ this -> http -> post ( $ url , [ 'headers' => [ 'X-Requested-With' => 'XMLHttpRequest' , 'Authorization' => 'Bearer ' . fp_env ( 'ACACHA_FORGE_ACCESS_TOKEN' ) ] ] ) ; } catch ( \ Exception $ e ) { if ( $ e -> getResponse ( ) -> getStatusCode ( ) == 422 ) { $ this -> error ( 'The user is already assigned' ) ; return ; } $ this -> error ( 'And error occurs connecting to the api url: ' . $ url ) ; $ this -> error ( 'Status code: ' . $ e -> getResponse ( ) -> getStatusCode ( ) . ' | Reason : ' . $ e -> getResponse ( ) -> getReasonPhrase ( ) ) ; return ; } } }
Assign users to assignment

@return array|mixed
Assign users to assignment