Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sarun Mungthanya
SpnPatch-Laravel
Commits
74507fbf
Commit
74507fbf
authored
Sep 19, 2024
by
Sarun Mungthanya
Browse files
add file
parent
72fb721a
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/MasterFileController.php
View file @
74507fbf
...
@@ -23,13 +23,13 @@ class MasterFileController extends Controller
...
@@ -23,13 +23,13 @@ class MasterFileController extends Controller
if
(
!
$request
->
hasFile
(
'data'
)
||
!
$request
->
file
(
'data'
)
->
isValid
())
{
if
(
!
$request
->
hasFile
(
'data'
)
||
!
$request
->
file
(
'data'
)
->
isValid
())
{
return
redirect
()
->
back
()
->
with
(
'error'
,
'Invalid file upload.'
);
return
redirect
()
->
back
()
->
with
(
'error'
,
'Invalid file upload.'
);
}
}
// Get file details
// Get file details
// Get file details
$file
=
$request
->
file
(
'data'
);
$file
=
$request
->
file
(
'data'
);
$filePath
=
$file
->
getRealPath
();
$filePath
=
$file
->
getRealPath
();
$fileSize
=
$file
->
getSize
();
$filename
=
$file
->
getClientOriginalName
();
$filename
=
$file
->
getClientOriginalName
();
// Get file details
$timestampEEC
=
now
()
->
format
(
'Y-m-d'
);
$timestampEEC
=
now
()
->
format
(
'Y-m-d'
);
$actDateTime
=
now
()
->
format
(
'Y-m-d H:i:s'
);
$actDateTime
=
now
()
->
format
(
'Y-m-d H:i:s'
);
...
@@ -43,9 +43,9 @@ class MasterFileController extends Controller
...
@@ -43,9 +43,9 @@ class MasterFileController extends Controller
if
(
!
$config
)
{
if
(
!
$config
)
{
return
redirect
()
->
back
()
->
with
(
'error'
,
'MasterFile Not config to EEC'
);
return
redirect
()
->
back
()
->
with
(
'error'
,
'MasterFile Not config to EEC'
);
}
}
// Get file details
$typeEEC
=
$config
->
ac
;
$typeEEC
=
$config
->
ac
;
// eval('asdasd');
// Send file to EEC if applicable
// Send file to EEC if applicable
if
(
$request
->
input
(
'sendtoeec'
)
===
'on'
&&
!
empty
(
$typeEEC
))
{
if
(
$request
->
input
(
'sendtoeec'
)
===
'on'
&&
!
empty
(
$typeEEC
))
{
$response
=
Http
::
attach
(
'file'
,
fopen
(
$filePath
,
'r'
),
$filename
)
$response
=
Http
::
attach
(
'file'
,
fopen
(
$filePath
,
'r'
),
$filename
)
...
...
app/Http/Livewire/Pages/News/NewsIndex.php
View file @
74507fbf
...
@@ -18,7 +18,9 @@ class NewsIndex extends Component
...
@@ -18,7 +18,9 @@ class NewsIndex extends Component
protected
$paginationTheme
=
'bootstrap'
;
protected
$paginationTheme
=
'bootstrap'
;
public
$perPage
=
10
;
public
$perPage
=
10
;
public
$url
;
public
$url
;
public
$searchSelected
=
'topic'
,
$searchCateSelected
,
$searchTypeSelected
;
public
$searchSelected
=
'topic'
;
public
$searchCateSelected
;
public
$searchTypeSelected
;
public
$editNewsId
;
public
$editNewsId
;
public
$deleteNewsId
;
public
$deleteNewsId
;
public
$keyword
=
''
;
public
$keyword
=
''
;
...
@@ -26,7 +28,9 @@ class NewsIndex extends Component
...
@@ -26,7 +28,9 @@ class NewsIndex extends Component
public
$searchBy
;
public
$searchBy
;
public
$action
=
'list'
;
public
$action
=
'list'
;
public
$message
;
public
$message
;
public
$selectedNews
=
[]
,
$searchCategory
=
[],
$searchType
=
[];
public
$selectedNews
=
[]
;
public
$searchCategory
=
[];
public
$searchType
=
[];
public
$showDeleteListModal
=
false
;
public
$showDeleteListModal
=
false
;
public
$showNoPermissionModal
=
false
;
public
$showNoPermissionModal
=
false
;
public
$showMessage
=
false
;
public
$showMessage
=
false
;
...
@@ -52,19 +56,11 @@ class NewsIndex extends Component
...
@@ -52,19 +56,11 @@ class NewsIndex extends Component
public
function
showNewsAddForm
()
public
function
showNewsAddForm
()
{
{
// if (!Auth::user()->hasPermissions(['add-news'])) {
// $this->showNoPermissionModal = TRUE;
// return;
// }
$this
->
action
=
'create'
;
$this
->
action
=
'create'
;
}
}
public
function
showNewsEditForm
(
$newsId
)
public
function
showNewsEditForm
(
$newsId
)
{
{
// if (!Auth::user()->hasPermissions(['edit-news'])) {
// $this->showNoPermissionModal = TRUE;
// return;
// }
$this
->
action
=
'edit'
;
$this
->
action
=
'edit'
;
$this
->
editNewsId
=
$newsId
;
$this
->
editNewsId
=
$newsId
;
}
}
...
@@ -90,11 +86,11 @@ class NewsIndex extends Component
...
@@ -90,11 +86,11 @@ class NewsIndex extends Component
public
function
deleteItem
(
$deleteNewsId
)
public
function
deleteItem
(
$deleteNewsId
)
{
{
if
(
!
Auth
::
user
()
->
hasPermissions
([
'delete-user'
]))
{
if
(
!
Auth
::
user
()
->
hasPermissions
([
'delete-user'
]))
{
$this
->
showNoPermissionModal
=
TRUE
;
$this
->
showNoPermissionModal
=
true
;
return
;
return
;
}
}
$news
=
Shippingnetnews
::
find
(
$deleteNewsId
);
$news
=
Shippingnetnews
::
find
(
$deleteNewsId
);
//test
if
(
$news
)
{
if
(
$news
)
{
$news
->
delete
();
$news
->
delete
();
$message
=
"Deleted Successfully"
;
$message
=
"Deleted Successfully"
;
...
@@ -108,8 +104,8 @@ class NewsIndex extends Component
...
@@ -108,8 +104,8 @@ class NewsIndex extends Component
public
function
render
()
public
function
render
()
{
{
// \Log::info('searchSelected:', ['searchSelected' => $this->searchSelected]);
$query
=
Shippingnetnews
::
query
();
$query
=
Shippingnetnews
::
query
();
if
(
!
empty
(
$this
->
searchCateSelected
))
{
if
(
!
empty
(
$this
->
searchCateSelected
))
{
$query
->
where
(
'groupID'
,
$this
->
searchCateSelected
);
$query
->
where
(
'groupID'
,
$this
->
searchCateSelected
);
...
@@ -130,21 +126,4 @@ class NewsIndex extends Component
...
@@ -130,21 +126,4 @@ class NewsIndex extends Component
]);
]);
}
}
// public function deleteSelected($selectedUsers)
// {
// if (!Auth::user()->hasPermissions(['delete-user'])) {
// $this->showNoPermissionModal = TRUE;
// return;
// }
// $userDeleted = User::whereIn("id", $selectedUsers)->pluck('name')->toArray();
// $userStr = implode(",", $userDeleted);
// User::destroy($selectedUsers);
// $message = "Deleted : (" . $userStr . " )Successfully";
// $this->message = $message;
// $this->selectedUsers = [];
// if ($this->message) {
// $this->dispatchBrowserEvent('show-message', ['message' => $this->message]);
// }
// }
}
}
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