Completed
Push — feature/user_input_newlines ( 7c3825...9ce77c )
by Tristan
15:58 queued 09:53
created

JobPosterCrudController::update()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace App\Http\Controllers\Admin;
4
5
use Backpack\CRUD\app\Http\Controllers\CrudController;
6
7
class JobPosterCrudController extends CrudController
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class JobPosterCrudController
Loading history...
8
{
9
    /**
10
     * Prepare the admin interface by setting the associated
11
     * model, setting the route, and adding custom columns/fields.
12
     *
13
     * @return void
14
     */
15
    public function setup() : void
16
    {
17
        $this->crud->setModel("App\Models\JobPoster");
18
        $this->crud->setRoute("admin/job-poster");
19
        $this->crud->setEntityNameStrings('Job Poster', 'Job Posters');
20
21
        $this->crud->denyAccess('create');
22
        $this->crud->denyAccess('delete');
23
24
        if (!$this->request->has('order')) {
25
            $this->crud->orderBy('close_date_time', 'desc');
26
        }
27
28
        $this->crud->addColumn([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
29
            'name' => 'title',
30
            'type' => 'text',
31
            'label' => 'Title'
32
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
33
        $this->crud->addColumn([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
34
            'name' => 'open_date_time',
35
            'type' => 'datetime',
36
            'label' => 'Open Date'
37
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
38
        $this->crud->addColumn([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
39
            'name' => 'close_date_time',
40
            'type' => 'datetime',
41
            'label' => 'Close Date'
42
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
43
        $this->crud->addColumn([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
44
            'name' => "status",
45
            'label' => "Status",
46
            'type' => "model_function",
47
            'function_name' => 'status',
48
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
49
        $this->crud->addColumn([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
50
            'name' => "published",
51
            'label' => "Published",
52
            'type' => "check",
53
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
54
        $this->crud->addColumn([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
55
            'name' => 'manager.user.name',
56
            'type' => 'text',
57
            'label' => 'Manager'
58
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
59
        $this->crud->addColumn([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
60
            'name' => "submitted_applications_count",
61
            'label' => "Applications",
62
            'type' => "model_function",
63
            'function_name' => 'submitted_applications_count',
64
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
65
66
        $this->crud->addField([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
67
            'name' => 'title',
68
            'label' => "Title",
69
            'type' => 'text',
70
            'attributes' => [
71
                'readonly' => 'readonly'
72
            ]
73
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
74
        $this->crud->addField([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
75
            'name' => 'close_date_time',
76
            'label' => 'Close Date',
77
            'type' => 'datetime_picker',
78
            'datetime_picker_options' => [
79
                'format' => 'YYYY-MM-DD HH:mm:ss',
80
            ],
81
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
82
        if ($this->crud->getCurrentEntry() && !$this->crud->getCurrentEntry()->published) {
83
            $this->crud->addField([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
84
                'name' => 'published',
85
                'label' => 'Publish',
86
                'type' => 'checkbox'
87
            ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
88
        }
89
    }
90
91
    /**
0 ignored issues
show
Coding Style introduced by
Parameter $request should have a doc-comment as per coding-style.
Loading history...
92
     * Action for updating an existing Job Poster in the database.
93
     *
94
     * @return \Illuminate\Http\RedirectResponse
95
     */
96
    public function update($request) // phpcs:ignore
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

96
    public function update(/** @scrutinizer ignore-unused */ $request) // phpcs:ignore

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
97
    {
98
        return parent::updateCrud();
99
    }
100
}
101