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
384b17da
Commit
384b17da
authored
4 years ago
by
Bagus Pambudi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
autopost alia
parent
e3a753ae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
27 deletions
+30
-27
app/Http/Controllers/Webprofile/Backend/PostController.php
+30
-27
No files found.
app/Http/Controllers/Webprofile/Backend/PostController.php
View file @
384b17da
...
@@ -134,24 +134,36 @@ class PostController extends Controller
...
@@ -134,24 +134,36 @@ class PostController extends Controller
public
function
share
(
$data
,
$request
)
public
function
share
(
$data
,
$request
)
{
{
$setting
=
webprofilesetting
();
$autoPost
=
$this
->
autoPostRepo
->
get
();
if
(
$request
->
hasFile
(
'thumbnail'
))
{
$img
=
$request
->
file
(
'thumbnail'
)
->
getRealPath
();
}
else
{
$img
=
null
;
}
$title
=
html_entity_decode
(
$data
[
'title'
]);
$url
=
$this
->
shorterUrl
(
url
(
'post/'
.
$data
[
'slug'
]));
$keys
=
$data
[
'keys'
];
$olhashtag
=
explode
(
', '
,
str_replace
([
', '
,
','
],
', '
,
$keys
));
$client
=
new
Client
([
'headers'
=>
[
$hashtag
=
'#unesa #unesaterkini '
;
'Accept'
=>
'application/json'
,
foreach
(
$olhashtag
as
$value
)
{
// 'Authorization' => 'Bearer ' . session('token')
$hashtag
.=
'#'
.
trim
(
$value
)
.
' '
;
],
}
'form_params'
=>
[
'url'
=>
url
(
'post/'
.
$data
[
'slug'
])]
]);
$result1
=
$client
->
post
(
'https://alia.unesa.ac.id/api/posts'
);
$value
=
json_decode
(
$result1
->
getBody
()
->
getContents
(),
true
);
// $setting = webprofilesetting();
// $autoPost = $this->autoPostRepo->get();
// if ($request->hasFile('thumbnail')) {
// $img = $request->file('thumbnail')->getRealPath();
// } else {
// $img = null;
// }
// $title = html_entity_decode($data['title']);
// $url = $this->shorterUrl(url('post/'.$data['slug']));
// $keys = $data['keys'];
// $olhashtag = explode(', ', str_replace([', ', ','], ', ', $keys));
// $hashtag = '#unesa #unesaterkini ';
// foreach ($olhashtag as $value) {
// $hashtag .= '#'.trim($value).' ';
// }
// dd($autoPost);
foreach
(
$autoPost
as
$value
)
{
foreach
(
$autoPost
as
$value
)
{
//Social Share Facebook
//Social Share Facebook
...
@@ -182,16 +194,7 @@ class PostController extends Controller
...
@@ -182,16 +194,7 @@ class PostController extends Controller
$client
=
new
Client
([
'headers'
=>
[
'Accept'
=>
'application/json'
,
// 'Authorization' => 'Bearer ' . session('token')
],
'form_params'
=>
[
'url'
=>
url
(
'post/'
.
$data
[
'slug'
])]
]);
$result1
=
$client
->
post
(
'https://alia.unesa.ac.id/api/posts'
);
$value
=
json_decode
(
$result1
->
getBody
()
->
getContents
(),
true
);
dd
(
$value
);
}
}
...
...
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