Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
webprofile-jwg2024
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Siti Aisah
webprofile-jwg2024
Commits
a749365a
Commit
a749365a
authored
4 years ago
by
Aan Choesni Herlingga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix categories file
parent
4102d324
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
12 deletions
+19
-12
app/Repositories/Webprofile/FileRepository.php
+19
-12
No files found.
app/Repositories/Webprofile/FileRepository.php
View file @
a749365a
...
...
@@ -22,7 +22,7 @@ class FileRepository extends StorageRepository
return
$query
->
with
(
$with
);
})
->
when
(
$title
,
function
(
$query
)
use
(
$title
)
{
return
$query
->
where
(
'title'
,
'ilike'
,
'%'
.
$title
.
'%'
);
return
$query
->
where
(
'title'
,
'ilike'
,
'%'
.
$title
.
'%'
);
})
->
when
(
$orderBy
,
function
(
$query
)
use
(
$orderBy
)
{
return
$query
->
orderBy
(
$orderBy
[
0
],
$orderBy
[
1
]);
...
...
@@ -37,28 +37,32 @@ class FileRepository extends StorageRepository
return
DataTables
::
of
(
$data
)
->
addIndexColumn
()
->
addColumn
(
'action'
,
function
(
$row
)
{
$btn
=
'<a href="'
.
url
(
'/webprofile/file/'
.
$row
->
id
.
'/edit'
)
.
'" data-toggle="tooltip" data-id="'
.
$row
->
id
.
'" data-original-title="'
.
trans
(
'label.edit'
)
.
'" class="edit btn btn-warning btn-round btn-sm edit">'
.
trans
(
'label.edit'
)
.
'</a>'
;
$btn
=
'<a href="'
.
url
(
'/webprofile/file/'
.
$row
->
id
.
'/edit'
)
.
'" data-toggle="tooltip" data-id="'
.
$row
->
id
.
'" data-original-title="'
.
trans
(
'label.edit'
)
.
'" class="edit btn btn-warning btn-round btn-sm edit">'
.
trans
(
'label.edit'
)
.
'</a>'
;
$btn
=
$btn
.
' <a href="javascript:void(0)" data-toggle="tooltip" data-id="'
.
$row
->
id
.
'" data-original-title="'
.
trans
(
'label.delete'
)
.
'" class="btn btn-danger btn-round btn-sm delete">'
.
trans
(
'label.delete'
)
.
'</a>'
;
$btn
=
$btn
.
' <a href="javascript:void(0)" data-toggle="tooltip" data-id="'
.
$row
->
id
.
'" data-original-title="'
.
trans
(
'label.delete'
)
.
'" class="btn btn-danger btn-round btn-sm delete">'
.
trans
(
'label.delete'
)
.
'</a>'
;
$btn
=
$btn
.
'<br>'
;
$btn
=
$btn
.
'<br>'
;
return
$btn
;
})
->
addColumn
(
'category'
,
function
(
$row
)
{
return
ucfirst
(
$row
->
rCategoryFile
->
name
);
if
(
$row
->
rCategoryFile
)
{
return
ucfirst
(
$row
->
rCategoryFile
->
name
);
}
else
{
return
''
;
}
})
->
addColumn
(
'file'
,
function
(
$row
)
use
(
$setting
)
{
if
(
$setting
[
'external_storage'
]
==
1
)
{
$str
=
'<a href="'
.
$setting
[
'url_static'
]
.
'/'
.
$setting
[
'directory'
]
.
'/file/'
.
$row
->
file
.
'" style="font-size: 12pt;">'
.
ucfirst
(
$row
->
title
)
.
'</a>'
;
$str
.=
'<label id="furl_'
.
$row
->
id
.
'" hidden>'
.
$setting
[
'url_static'
]
.
'/'
.
$setting
[
'directory'
]
.
'/file/'
.
$row
->
file
.
'</label>'
;
$str
=
'<a href="'
.
$setting
[
'url_static'
]
.
'/'
.
$setting
[
'directory'
]
.
'/file/'
.
$row
->
file
.
'" style="font-size: 12pt;">'
.
ucfirst
(
$row
->
title
)
.
'</a>'
;
$str
.=
'<label id="furl_'
.
$row
->
id
.
'" hidden>'
.
$setting
[
'url_static'
]
.
'/'
.
$setting
[
'directory'
]
.
'/file/'
.
$row
->
file
.
'</label>'
;
}
else
{
$str
=
'<a href="'
.
url
(
'/storage/file/'
.
$row
->
file
)
.
'" style="font-size: 12pt;">'
.
ucfirst
(
$row
->
title
)
.
'</a>'
;
$str
.=
'<label id="furl_'
.
$row
->
id
.
'" hidden>'
.
url
(
'/storage/file/'
.
$row
->
file
)
.
'</label>'
;
$str
=
'<a href="'
.
url
(
'/storage/file/'
.
$row
->
file
)
.
'" style="font-size: 12pt;">'
.
ucfirst
(
$row
->
title
)
.
'</a>'
;
$str
.=
'<label id="furl_'
.
$row
->
id
.
'" hidden>'
.
url
(
'/storage/file/'
.
$row
->
file
)
.
'</label>'
;
}
$str
.=
'<br>'
;
$str
.=
'<button onclick="copyToClipboard(\'#furl_'
.
$row
->
id
.
'\')" class="btn btn-info btn-xs">Copy URL</button>'
;
$str
.=
'<button onclick="copyToClipboard(\'#furl_'
.
$row
->
id
.
'\')" class="btn btn-info btn-xs">Copy URL</button>'
;
return
$str
;
})
...
...
@@ -71,6 +75,7 @@ class FileRepository extends StorageRepository
}
else
{
$str
=
'<div style="color: red;"><i class="fa fa-times"></i></div>'
;
}
return
$str
;
})
->
rawColumns
([
'action'
,
'status'
,
'category'
,
'file'
,
'downloaded'
])
...
...
@@ -87,12 +92,14 @@ class FileRepository extends StorageRepository
]);
$headers
=
get_headers
(
$url
);
return
stripos
(
$headers
[
0
],
"200 OK"
)
?
true
:
false
;
return
stripos
(
$headers
[
0
],
'200 OK'
)
?
true
:
false
;
}
public
function
countDownload
(
File
$file
)
{
$file
->
downloaded
=
$file
->
downloaded
+
1
;
return
$file
->
save
();
}
}
This diff is collapsed.
Click to expand it.
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