Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Analyst task
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
suvorova-ma
Analyst task
Commits
96f47077
Commit
96f47077
authored
2 years ago
by
Shizuco
Browse files
Options
Downloads
Patches
Plain Diff
feat: change access to lens, for now it is through action
parent
873a68a1
No related branches found
Branches containing commit
No related tags found
1 merge request
!4
Dctn 494/fix
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/Nova/Actions/CompareAction.php
+43
-0
43 additions, 0 deletions
app/Nova/Actions/CompareAction.php
app/Nova/Product.php
+3
-1
3 additions, 1 deletion
app/Nova/Product.php
with
46 additions
and
1 deletion
app/Nova/Actions/CompareAction.php
0 → 100644
+
43
−
0
View file @
96f47077
<?php
namespace
App\Nova\Actions
;
use
App\Models\Retailer
;
use
Illuminate\Bus\Queueable
;
use
Illuminate\Queue\InteractsWithQueue
;
use
Illuminate\Support\Collection
;
use
Laravel\Nova\Actions\Action
;
use
Laravel\Nova\Fields\ActionFields
;
use
Laravel\Nova\Fields\Select
;
use
Laravel\Nova\Http\Requests\NovaRequest
;
class
CompareAction
extends
Action
{
use
InteractsWithQueue
,
Queueable
;
public
function
handle
(
ActionFields
$fields
,
Collection
$models
)
{
if
(
!
$fields
->
changeField
||
!
$fields
->
changeModel
)
{
return
Action
::
danger
(
'All fields are required!'
);
}
return
Action
::
redirect
(
'products/lens/compare-product?field='
.
$fields
->
changeField
.
'&retailer='
.
$fields
->
changeModel
);
}
public
function
fields
(
NovaRequest
$request
)
{
return
[
Select
::
make
(
'Model to change'
,
'changeModel'
)
->
options
(
Retailer
::
pluck
(
'name'
,
'id'
)
->
all
()
)
->
rules
(
'required'
),
Select
::
make
(
'Field to change'
,
'changeField'
)
->
options
([
'price'
=>
'price'
,
'description'
=>
'description'
,
'name'
=>
'name'
,
])
->
rules
(
'required'
),
];
}
}
This diff is collapsed.
Click to expand it.
app/Nova/Product.php
+
3
−
1
View file @
96f47077
...
...
@@ -130,6 +130,8 @@ public function lenses(NovaRequest $request)
public
function
actions
(
NovaRequest
$request
)
{
return
[];
return
[
Actions\CompareAction
::
make
()
->
standalone
()
];
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment