@extends('layouts.app') @section('title', 'Instagram – Social Networks') @section('content')

← Social Networks

Instagram

Connect your Instagram Business or Creator account via the Instagram Graph API to view followers and recent media (reels and posts) here.

{{-- Flash success/error come from layouts.app (avoid duplicate green banners). --}} @if($apiError ?? null)
API error: {{ $apiError }}
Check that your Access Token is valid and has not expired, and that the Instagram User ID is correct. You can update the credentials below.
@endif @php $igConnected = $instagramSetting->isConnected(); @endphp

Connection

Connect Instagram via Meta Graph API for growth metrics, reels, and storefront carousel sync.

@if($igConnected && !($apiError ?? null)) Connected @elseif($igConnected && ($apiError ?? null)) Token issue @else Not connected @endif
@csrf
@if($igConnected) @endif
@if($igConnected)
Token saved securely
@else Generate a long-lived token in Meta for Developers. @endif
Numeric ID of your Instagram Business / Creator account.
Reel playback

Reels play on your site (muted by default; visitors can unmute). No redirect to Instagram.

@if($igConnected) @endif
@if($igConnected) @endif
@if(($profile ?? null) && !($apiError ?? null)) @php $growth = $growth ?? ['has_data' => false, 'followers' => 0, 'views' => 0, 'interactions' => 0]; $formatMetric = function ($n) { if ($n === null) return '—'; $n = (int) $n; if ($n >= 1000000) return round($n / 1000000, 1) . 'M'; if ($n >= 1000) return round($n / 1000, 1) . 'K'; return (string) $n; }; @endphp

Instagram Growth

@if(!empty($profile['profile_picture_url'])) @else @endif
@{{ $profile['username'] ?? $instagramSetting->username ?? '—' }}
View Instagram

Last 30 days

Followers @if($growth['has_data'] && $growth['followers'] > 0)
{{ $formatMetric($growth['followers']) }}
@else {{ $formatMetric($growth['followers']) }} @endif
Views {{ $formatMetric($growth['views']) }}
Interactions {{ $formatMetric($growth['interactions']) }}
@if(!($growth['has_data'] ?? false))

Metrics are synced by a scheduled job. Run php artisan instagram:sync-growth-stats once, or wait for the next run (every 12 hours).

@endif

Profile & stats

@if(!empty($profile['profile_picture_url'])) @endif

@{{ $profile['username'] ?? $instagramSetting->username ?? '—' }}

@if(!empty($profile['name']))

{{ $profile['name'] }}

@endif

Recent media

Showing {{ $totalMediaCount ?? count($media ?? []) }} reels/posts (first {{ $perPage ?? 10 }} load quickly; use Load more for the rest). Assign each one a category: Available Online, Custom Piece, or In-Store Only. Check Do not show on web for items you don't want on the storefront. Each sync picks 15 at random from the non-excluded pool for the carousel. Click the image to open on Instagram.

@if(count($media ?? []) > 0)
@csrf
    @include('social_networks.partials.instagram_media_page', [ 'media' => $media, 'reelSettings' => $reelSettings ?? [], 'reelDetailsByMediaId' => $reelDetailsByMediaId ?? [], 'excludedMediaIds' => $excludedMediaIds ?? [], ])
@if(!empty($hasMoreMedia))
@endif
@else

No media to show.

@endif
{{-- Reel settings modal --}} @endif
@push('styles') @endpush @if(($profile ?? null) && !($apiError ?? null)) @push('scripts') @endpush @endif @endsection