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
Oct 11, 2020
by
Aan Choesni Herlingga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix categories file
parent
4102d324
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
10 deletions
+17
-10
app/Repositories/Webprofile/FileRepository.php
+17
-10
No files found.
app/Repositories/Webprofile/FileRepository.php
View file @
a749365a
...
@@ -22,7 +22,7 @@ class FileRepository extends StorageRepository
...
@@ -22,7 +22,7 @@ class FileRepository extends StorageRepository
return
$query
->
with
(
$with
);
return
$query
->
with
(
$with
);
})
})
->
when
(
$title
,
function
(
$query
)
use
(
$title
)
{
->
when
(
$title
,
function
(
$query
)
use
(
$title
)
{
return
$query
->
where
(
'title'
,
'ilike'
,
'%'
.
$title
.
'%'
);
return
$query
->
where
(
'title'
,
'ilike'
,
'%'
.
$title
.
'%'
);
})
})
->
when
(
$orderBy
,
function
(
$query
)
use
(
$orderBy
)
{
->
when
(
$orderBy
,
function
(
$query
)
use
(
$orderBy
)
{
return
$query
->
orderBy
(
$orderBy
[
0
],
$orderBy
[
1
]);
return
$query
->
orderBy
(
$orderBy
[
0
],
$orderBy
[
1
]);
...
@@ -37,28 +37,32 @@ class FileRepository extends StorageRepository
...
@@ -37,28 +37,32 @@ class FileRepository extends StorageRepository
return
DataTables
::
of
(
$data
)
return
DataTables
::
of
(
$data
)
->
addIndexColumn
()
->
addIndexColumn
()
->
addColumn
(
'action'
,
function
(
$row
)
{
->
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
;
return
$btn
;
})
})
->
addColumn
(
'category'
,
function
(
$row
)
{
->
addColumn
(
'category'
,
function
(
$row
)
{
if
(
$row
->
rCategoryFile
)
{
return
ucfirst
(
$row
->
rCategoryFile
->
name
);
return
ucfirst
(
$row
->
rCategoryFile
->
name
);
}
else
{
return
''
;
}
})
})
->
addColumn
(
'file'
,
function
(
$row
)
use
(
$setting
)
{
->
addColumn
(
'file'
,
function
(
$row
)
use
(
$setting
)
{
if
(
$setting
[
'external_storage'
]
==
1
)
{
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
=
'<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
.=
'<label id="furl_'
.
$row
->
id
.
'" hidden>'
.
$setting
[
'url_static'
]
.
'/'
.
$setting
[
'directory'
]
.
'/file/'
.
$row
->
file
.
'</label>'
;
}
else
{
}
else
{
$str
=
'<a href="'
.
url
(
'/storage/file/'
.
$row
->
file
)
.
'" style="font-size: 12pt;">'
.
ucfirst
(
$row
->
title
)
.
'</a>'
;
$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
.=
'<label id="furl_'
.
$row
->
id
.
'" hidden>'
.
url
(
'/storage/file/'
.
$row
->
file
)
.
'</label>'
;
}
}
$str
.=
'<br>'
;
$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
;
return
$str
;
})
})
...
@@ -71,6 +75,7 @@ class FileRepository extends StorageRepository
...
@@ -71,6 +75,7 @@ class FileRepository extends StorageRepository
}
else
{
}
else
{
$str
=
'<div style="color: red;"><i class="fa fa-times"></i></div>'
;
$str
=
'<div style="color: red;"><i class="fa fa-times"></i></div>'
;
}
}
return
$str
;
return
$str
;
})
})
->
rawColumns
([
'action'
,
'status'
,
'category'
,
'file'
,
'downloaded'
])
->
rawColumns
([
'action'
,
'status'
,
'category'
,
'file'
,
'downloaded'
])
...
@@ -87,12 +92,14 @@ class FileRepository extends StorageRepository
...
@@ -87,12 +92,14 @@ class FileRepository extends StorageRepository
]);
]);
$headers
=
get_headers
(
$url
);
$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
)
public
function
countDownload
(
File
$file
)
{
{
$file
->
downloaded
=
$file
->
downloaded
+
1
;
$file
->
downloaded
=
$file
->
downloaded
+
1
;
return
$file
->
save
();
return
$file
->
save
();
}
}
}
}
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