Passed
Push — master ( 5a03f9...8e29e6 )
by Stephen
03:56 queued 01:10
created

BaseUpdateModelPublicStatusAction::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 8
rs 10
1
<?php
2
3
4
namespace Sfneal\CrudModelActions;
5
6
7
use App\Http\Controllers\Traits\StatusUpdateResponse;
0 ignored issues
show
Bug introduced by
The type App\Http\Controllers\Traits\StatusUpdateResponse was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Illuminate\Database\Eloquent\Model;
9
use Sfneal\Models\AbstractModelWithPublicStatus;
10
11
abstract class BaseUpdateModelPublicStatusAction extends CrudModelAction
12
{
13
    use StatusUpdateResponse;
14
15
    /**
16
     * The Eloquent Model class
17
     *
18
     * @var AbstractModelWithPublicStatus
19
     */
20
    protected $modelClass;
21
22
    /**
23
     * @var AbstractModelWithPublicStatus
24
     */
25
    protected $model;
26
27
    /**
28
     * Update a Model's 'public_status' attribute
29
     *
30
     * @return Model
31
     */
32
    protected function handle(): Model
33
    {
34
        $this->successActionVerb('updated');
35
36
        // Update public_status
37
        $this->model->updatePublicStatus();
38
39
        return $this->model;
40
    }
41
42
    /**
43
     * Return the default success response
44
     *
45
     * @param string|null $response
46
     * @return string
47
     */
48
    protected function successResponse(string $response = null): string {
49
        return self::statusUpdateResponse($this->model);
50
    }
51
}
52