Code Duplication    Length = 14-14 lines in 3 locations

src/Http/Controllers/StateController.php 2 locations

@@ 132-145 (lines=14) @@
129
                'workflow_id'   => 'required'
130
            ]);
131
132
            if($validator->fails()){
133
                if($check > 0){
134
                    $response['message']    = 'failed state allready exist !';
135
                    $response['status']     = false;
136
                }else{
137
                    $response['message']    = 'success add new state';
138
                    $response['status']     = true;
139
                    $this->stateModel->create($request);
140
                }                
141
            }else{
142
                $response['message']    = 'success add new state';
143
                $response['status']     = true;
144
                $this->stateModel->create($request);
145
            }
146
147
            
148
@@ 196-209 (lines=14) @@
193
            }
194
            
195
196
            if($validator->fails()){
197
                if($check > 0){
198
                    $response['message']    = 'failed state allready exist !';
199
                    $response['status']     = false;
200
                }else{
201
                    $response['message']    = 'success add new state';
202
                    $response['status']     = true;
203
                    $this->stateModel->findOrFail($id)->update($request);
204
                }                
205
            }else{
206
                $response['message']    = 'success add new state';
207
                $response['status']     = true;
208
                $this->stateModel->findOrFail($id)->update($request);
209
            }
210
211
            
212

src/Http/Controllers/TransitionController.php 1 location

@@ 219-232 (lines=14) @@
216
        }
217
        
218
219
        if($validator->fails()){
220
            if($check > 0){
221
                $response['message']    = 'failed state allready exist !';
222
                $response['status']     = false;
223
            }else{
224
                $response['message']    = 'success add new state';
225
                $response['status']     = true;
226
                $this->transitionModel->findOrFail($id)->update($request);
227
            }                
228
        }else{
229
            $response['message']    = 'success add new state';
230
            $response['status']     = true;
231
            $this->transitionModel->findOrFail($id)->update($request);
232
        }
233
234
        
235