UpdateEntryCommandHandler   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 10 1
1
<?php
2
3
namespace Hechoenlaravel\JarvisFoundation\Entries\Handler;
4
5
use DB;
6
use Carbon\Carbon;
7
use Hechoenlaravel\JarvisFoundation\Entries\Events\EntryWasUpdated;
8
9
/**
10
 * Class UpdateEntryCommandHandler
11
 * @package Hechoenlaravel\JarvisFoundation\Entries\Handler
12
 */
13
class UpdateEntryCommandHandler
14
{
15
    /**
16
     * @param $command
17
     * @return array
18
     */
19
    public function handle($command)
20
    {
21
        $command->input['updated_at'] = Carbon::now();
22
        DB::table($command->entity->getTableName())->where('id', $command->entry_id)->update($command->input);
23
        event(new EntryWasUpdated($command->entity, $command->entry_id, $command->input));
24
        return [
25
            'entry_id' => $command->entry_id,
26
            'input' => $command->input
27
        ];
28
    }
29
}
30