Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
palaniapp_demo
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hussain Mohamed
palaniapp_demo
Commits
d448e525
Commit
d448e525
authored
Dec 26, 2025
by
Hussain Mohamed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes
parent
18303e5d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
39 deletions
+51
-39
ProductController.php
app/Http/Controllers/Backend/ProductController.php
+27
-21
menu.blade.php
resources/views/backend/base/menu.blade.php
+4
-7
edit.blade.php
resources/views/backend/products/edit.blade.php
+20
-11
No files found.
app/Http/Controllers/Backend/ProductController.php
View file @
d448e525
...
...
@@ -37,7 +37,12 @@ public function addProduct($id = '')
if
(
$id
>
0
)
{
$record
=
ProductModel
::
Where
(
'id'
,
$id
)
->
first
();
$productItems
=
ProductAttributeModel
::
Where
(
'product_id'
,
$id
)
->
get
();
return
view
(
'backend.products.edit'
,
compact
(
'record'
,
'productItems'
,
'categoryData'
,
'sizeData'
,
'brandData'
,
'typeData'
,
'industryData'
));
$sizeAr
=
SizeProduct
::
Where
(
'product_id'
,
$id
)
->
pluck
(
'size_id'
)
->
toArray
();
$brandAr
=
BrandProduct
::
Where
(
'product_id'
,
$id
)
->
pluck
(
'brand_id'
)
->
toArray
();
$indusAr
=
IndustryProduct
::
Where
(
'product_id'
,
$id
)
->
pluck
(
'industry_id'
)
->
toArray
();
$categoryAr
=
CategoryProduct
::
Where
(
'product_id'
,
$id
)
->
pluck
(
'category_id'
)
->
toArray
();
return
view
(
'backend.products.edit'
,
compact
(
'brandAr'
,
'indusAr'
,
'categoryAr'
,
'sizeAr'
,
'record'
,
'productItems'
,
'categoryData'
,
'sizeData'
,
'brandData'
,
'typeData'
,
'industryData'
));
}
else
{
return
view
(
'backend.products.add'
,
compact
(
'categoryData'
,
'sizeData'
,
'typeData'
,
'brandData'
,
'industryData'
));
}
...
...
@@ -72,47 +77,47 @@ public function storeUpdateproducts(Request $request)
'product_description'
=>
$product_description
,
);
if
(
(
$request
->
hasFile
(
'broucher'
)
))
{
if
(
$request
->
hasFile
(
'broucher'
))
{
$broucher
=
$request
->
file
(
'broucher'
);
$broucherName
=
'broucher'
.
time
()
.
'_'
.
str_replace
(
' '
,
'_'
,
$broucher
->
getClientOriginalName
());
$broucher
->
move
(
public_path
(
'/uploads/broucher/'
),
$broucherName
);
$broucherUrl
=
URL
::
to
(
'/'
)
.
'/uploads/broucher/'
.
$broucherName
;
$insertAr
[
'broucher'
]
=
$broucherUrl
;
$insertAr
r
[
'broucher'
]
=
$broucherUrl
;
}
$insert
=
ProductModel
::
create
(
$insertArr
);
if
(
$insert
[
'id'
]
>
0
)
{
foreach
(
$category_id
as
$val
)
{
$
insert
Ar
=
array
(
$
cate
Ar
=
array
(
'product_id'
=>
$insert
[
'id'
],
'category_id'
=>
$val
);
CategoryProduct
::
create
(
$
insert
Ar
);
CategoryProduct
::
create
(
$
cate
Ar
);
}
foreach
(
$industry_id
as
$val
)
{
$in
sertA
r
=
array
(
$in
dusar
r
=
array
(
'product_id'
=>
$insert
[
'id'
],
'industry_id'
=>
$val
);
IndustryProduct
::
create
(
$in
sertA
r
);
IndustryProduct
::
create
(
$in
dusar
r
);
}
foreach
(
$brand_id
as
$val
)
{
$
insertA
r
=
array
(
$
brandar
r
=
array
(
'product_id'
=>
$insert
[
'id'
],
'brand_id'
=>
$val
);
BrandProduct
::
create
(
$
insertA
r
);
BrandProduct
::
create
(
$
brandar
r
);
}
foreach
(
$product_size
as
$val
)
{
$
insertA
r
=
array
(
$
sizear
r
=
array
(
'product_id'
=>
$insert
[
'id'
],
'size_id'
=>
$val
);
SizeProduct
::
create
(
$
insertA
r
);
SizeProduct
::
create
(
$
sizear
r
);
}
foreach
(
$request
->
file
(
'product_image'
)
as
$k
=>
$image
)
{
...
...
@@ -137,12 +142,13 @@ public function storeUpdateproducts(Request $request)
'size_type'
=>
$size_type
,
'product_description'
=>
$product_description
,
);
if
(
(
$request
->
hasFile
(
'broucher'
))
)
{
if
(
$request
->
hasFile
(
'broucher'
)
!=
''
)
{
$broucher
=
$request
->
file
(
'broucher'
);
$broucherName
=
'broucher'
.
time
()
.
'_'
.
str_replace
(
' '
,
'_'
,
$broucher
->
getClientOriginalName
());
$broucher
->
move
(
public_path
(
'/uploads/broucher/'
),
$broucherName
);
$broucherUrl
=
URL
::
to
(
'/'
)
.
'/uploads/broucher/'
.
$broucherName
;
$insertAr
[
'broucher'
]
=
$broucherUrl
;
$insertArr
[
'broucher'
]
=
$broucherUrl
;
}
$update
=
ProductModel
::
Where
(
'id'
,
$id
)
->
update
(
$insertArr
);
...
...
@@ -152,35 +158,35 @@ public function storeUpdateproducts(Request $request)
SizeProduct
::
Where
(
'product_id'
,
$id
)
->
delete
();
foreach
(
$category_id
as
$val
)
{
$insert
Ar
=
array
(
$cate
Ar
=
array
(
'product_id'
=>
$id
,
'category_id'
=>
$val
);
CategoryProduct
::
create
(
$insert
Ar
);
CategoryProduct
::
create
(
$cate
Ar
);
}
foreach
(
$industry_id
as
$val
)
{
$insertA
r
=
array
(
$indusar
r
=
array
(
'product_id'
=>
$id
,
'industry_id'
=>
$val
);
IndustryProduct
::
create
(
$insertA
r
);
IndustryProduct
::
create
(
$indusar
r
);
}
foreach
(
$brand_id
as
$val
)
{
$insertA
r
=
array
(
$brandar
r
=
array
(
'product_id'
=>
$id
,
'brand_id'
=>
$val
);
BrandProduct
::
create
(
$insertA
r
);
BrandProduct
::
create
(
$brandar
r
);
}
foreach
(
$product_size
as
$val
)
{
$insertA
r
=
array
(
$sizear
r
=
array
(
'product_id'
=>
$id
,
'size_id'
=>
$val
);
SizeProduct
::
create
(
$insertA
r
);
SizeProduct
::
create
(
$sizear
r
);
}
foreach
(
$item_id
as
$k
=>
$val
)
{
...
...
resources/views/backend/base/menu.blade.php
View file @
d448e525
...
...
@@ -317,9 +317,6 @@
<a
href=
"javascript:void(0)"
>
Pages
</a>
</li>
<li
class=
"pe-slide-item"
>
<a
href=
"
<?=
route
(
'pages'
)
?>
"
class=
"pe-nav-link"
>
Pages
</a>
<a
href=
"
<?=
url
(
'backend/addPage/1'
)
?>
"
class=
"pe-nav-link"
>
Terms
&
Condition
</a>
...
...
@@ -334,7 +331,7 @@
<li
class=
"pe-slide pe-has-sub"
>
<
!-- <
li class="pe-slide pe-has-sub">
<a href="#collapseLogistics4" class="pe-nav-link" data-bs-toggle="collapse" aria-expanded="false" aria-controls="collapseLogistics">
<i class="bi bi-files pe-nav-icon"></i>
<span class="pe-nav-content">SEO Settings</span>
...
...
@@ -350,15 +347,15 @@
</a>
</li>
</ul>
</li>
</li>
-->
<li
class=
"pe-slide pe-has-sub"
>
<
!-- <
li class="pe-slide pe-has-sub">
<a href="
<?=
route
(
'settings'
)
?>
" class="pe-nav-link">
<i class="bi bi bi-gear-fill pe-nav-icon"></i>
<span class="pe-nav-setting">Settings</span>
</a>
</li>
</li>
-->
...
...
resources/views/backend/products/edit.blade.php
View file @
d448e525
...
...
@@ -3,9 +3,8 @@
@section('content')
<?php
$id
=
isset
(
$record
->
id
)
?
$record
->
id
:
''
;
$category_id
=
isset
(
$record
->
category_id
)
?
$record
->
category_id
:
''
;
$brand_id
=
isset
(
$record
->
brand_id
)
?
$record
->
brand_id
:
''
;
$industry_id
=
isset
(
$record
->
industry_id
)
?
$record
->
industry_id
:
''
;
$size_type
=
isset
(
$record
->
size_type
)
?
$record
->
size_type
:
''
;
$broucher
=
isset
(
$record
->
broucher
)
?
$record
->
broucher
:
''
;
$type_id
=
isset
(
$record
->
type_id
)
?
$record
->
type_id
:
''
;
$product_name
=
isset
(
$record
->
product_name
)
?
$record
->
product_name
:
''
;
$product_description
=
isset
(
$record
->
product_description
)
?
$record
->
product_description
:
''
;
...
...
@@ -55,7 +54,7 @@
<?php
if
(
isset
(
$categoryData
))
{
foreach
(
$categoryData
as
$val
)
{
?>
<option
value=
"
<?php
echo
$val
->
id
?>
"
<?=
(
$category_id
==
$val
->
id
)
?
'selected'
:
''
?>
>
<?php
echo
ucwords
(
$val
->
category_name
)
?>
</option>
<option
value=
"
<?php
echo
$val
->
id
?>
"
<?=
in_array
(
$val
->
id
,
$categoryAr
)
?
'selected'
:
''
?>
>
<?php
echo
ucwords
(
$val
->
category_name
)
?>
</option>
<?php
}
}
?>
</select>
...
...
@@ -69,7 +68,7 @@
<?php
if
(
isset
(
$industryData
))
{
foreach
(
$industryData
as
$val
)
{
?>
<option
<?=
in_array
(
$val
->
id
,
explode
(
","
,
$industry_id
)
)
?
'selected'
:
''
?>
value=
"
<?php
echo
$val
->
id
?>
"
>
<?php
echo
ucwords
(
$val
->
industry
)
?>
</option>
<option
<?=
in_array
(
$val
->
id
,
$indusAr
)
?
'selected'
:
''
?>
value=
"
<?php
echo
$val
->
id
?>
"
>
<?php
echo
ucwords
(
$val
->
industry
)
?>
</option>
<?php
}
}
?>
</select>
...
...
@@ -84,7 +83,7 @@
<?php
if
(
isset
(
$brandData
))
{
foreach
(
$brandData
as
$val
)
{
?>
<option
<?=
in_array
(
$val
->
id
,
explode
(
","
,
$brand_id
)
)
?
'selected'
:
''
?>
value=
"
<?php
echo
$val
->
id
?>
"
>
<?php
echo
ucwords
(
$val
->
brand
)
?>
</option>
<option
<?=
in_array
(
$val
->
id
,
$brandAr
)
?
'selected'
:
''
?>
value=
"
<?php
echo
$val
->
id
?>
"
>
<?php
echo
ucwords
(
$val
->
brand
)
?>
</option>
<?php
}
}
?>
</select>
...
...
@@ -110,9 +109,9 @@
<label
for=
"type_id"
class=
"form-label"
>
Size Type
<span
class=
"text-danger"
>
*
</span></label>
<select
class=
"form-control select2"
id=
"size_type"
name=
"size_type"
>
<option
value=
""
>
--select--
</option>
<option
value=
"1"
>
Size
</option>
<option
value=
"2"
>
Range
</option>
<option
value=
"3"
>
Capacity
</option>
<option
<?=
(
$size_type
==
1
)
?
'selected'
:
''
?>
value=
"1"
>
Size
</option>
<option
<?=
(
$size_type
==
2
)
?
'selected'
:
''
?>
value=
"2"
>
Range
</option>
<option
<?=
(
$size_type
==
3
)
?
'selected'
:
''
?>
value=
"3"
>
Capacity
</option>
</select>
</div>
...
...
@@ -123,7 +122,7 @@
<?php
if
(
isset
(
$sizeData
))
{
foreach
(
$sizeData
as
$val
)
{
?>
<option
value=
"
<?php
echo
$val
->
id
?>
"
>
<?php
echo
ucwords
(
$val
->
size
)
?>
</option>
<option
<?=
in_array
(
$val
->
id
,
$sizeAr
)
?
'selected'
:
''
?>
value=
"
<?php
echo
$val
->
id
?>
"
>
<?php
echo
ucwords
(
$val
->
size
)
?>
</option>
<?php
}
}
?>
</select>
...
...
@@ -133,6 +132,12 @@
<label
for=
"type_id"
class=
"form-label"
>
Product Catalogue
<span
class=
"text-danger"
>
*
</span></label>
<input
type=
"file"
name=
"broucher"
id=
"broucher"
class=
"form-control"
>
</div>
<?php
if
(
$broucher
!=
''
){
?>
<div
class=
"col-xl-4"
>
<label
for=
"type_id"
class=
"form-label"
>
Product Catalogue
</label>
<iframe
src=
"
<?=
$broucher
?>
"
></iframe>
</div>
<?php
}
?>
<div
class=
"col-xl-12"
>
<label
for=
"type_id"
class=
"form-label"
>
Product Description
</label>
...
...
@@ -142,6 +147,7 @@
<table
style=
"width:100%"
class=
"table"
>
<tr>
<th>
Image
</th>
<th>
Exist Image
</th>
<!--<th>Catalogue</th>
<th>Product Type</th>
<th>Product Size</th> -->
...
...
@@ -155,6 +161,9 @@
<td
style=
"width:20%"
>
<input
data-row=
"
<?=
$key
?>
"
data-name=
"product_image"
id=
"product_image
<?=
$key
?>
"
type=
"file"
name=
"product_image[]"
id=
"product_image"
class=
"form-control"
>
</td>
<td
style=
"width:20%"
>
<img
src=
"
<?=
$row
->
product_image
?>
"
width=
"100"
height=
"100"
/>
</td>
<!--<td style="width:20%">
<input data-row="
<?=
$key
?>
" data-name="broucher" id="broucher
<?=
$key
?>
" type="file" name="broucher[]" id="broucher" class="form-control">
</td>
...
...
@@ -214,7 +223,7 @@ function addRow(content_id, label_checkbox = '') {
row
.
find
(
"select"
).
each
(
function
(
index
)
{
$
(
this
).
select2
(
'destroy'
);
});
row
.
clone
().
find
(
"input, textarea, select, button, checkbox, radio, label"
).
each
(
function
(
j
,
obj
)
{
row
.
clone
().
find
(
"i
mg"
).
remove
().
end
().
find
(
"i
nput, textarea, select, button, checkbox, radio, label"
).
each
(
function
(
j
,
obj
)
{
i
=
$
(
this
).
data
(
'row'
)
+
1
;
id
=
$
(
this
).
data
(
'name'
)
+
i
;
$
(
this
).
val
(
''
).
attr
({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment