42 lines
907 B
PHP
42 lines
907 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Product;
|
|
use App\Products;
|
|
|
|
class GeneralController extends Controller
|
|
{
|
|
/**
|
|
* Show the profile for the given user.
|
|
*
|
|
* @param int $id
|
|
* @return View
|
|
*/
|
|
|
|
|
|
public function show()
|
|
{
|
|
$products = Products::all();
|
|
|
|
$response = file_get_contents('https://instagram.com/bricabracomania_metalworks/?__a=1');
|
|
|
|
$data = json_decode($response);
|
|
|
|
$pic_raw_data = $data->graphql->user->edge_owner_to_timeline_media->edges;
|
|
|
|
$pic_data = [];
|
|
|
|
for ($x = 0; $x <= count($pic_raw_data) - 6; $x++) {
|
|
$edge = $pic_raw_data[$x];
|
|
|
|
$actual_pic_url = $edge->node->display_url;
|
|
|
|
array_push($pic_data, $actual_pic_url);
|
|
}
|
|
|
|
return view('home')->with('products', $products)->with('pic_data', $pic_data);
|
|
}
|
|
}
|