@extends('backend.layouts.master') @section('section-title', 'Category') @section('page-title', 'Category List') @if (check_permission('category.store')) @section('action-button') Add Category @endsection @endif @section('content')
@forelse($categories as $data) @php $branch_id = session('branch_filter_id', auth()->user()->branch_id); if (auth()->user()->branch_id == 1 && !session('branch_filter_id')) { // Admin & All Branch $branch_category = App\Models\BranchCategory::where( 'category_id', $data->id, )->get(); } else { $branch_category = App\Models\BranchCategory::where( 'category_id', $data->id, ) ->where('branch_id', auth()->user()->branch_id) ->get(); } $count_cat = App\Models\Product::where('category_id', $data->id)->count(); @endphp {{-- edit modal --}} @php $selectedBranchIds = \App\Models\BranchCategory::where( 'category_id', $data->id, )->pluck('branch_id'); @endphp @csrf @method('PUT') @if(auth()->user()->branch_id == 1) @foreach ($branchs as $branch) @endforeach @endif {{-- delete modal --}} @csrf @method('DELETE') @empty @endforelse
# Name Branch Actions
{{ $loop->index + 1 }} {{ $data->name }} @foreach ($branch_category as $branch) {{ $branch->branch?->name }} @endforeach
No Data Available
{{-- Add Modal --}}
@csrf @if(auth()->user()->branch_id == 1) @foreach ($branchs as $data) @endforeach @endif
@endsection