@extends('layouts.app') @section('content')

Edit Project

@if(auth()->user()->canProject('view')) Back to Projects @else Back to Dashboard @endif
@if(session('success')) @endif @if($errors->any())
    @foreach($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif
@csrf @method('PUT')
@php // Handle existing unit data - could be single string or JSON array $existingUnits = []; if (!empty($project->unit)) { // Try to decode as JSON first, if that fails treat as single unit $decoded = json_decode($project->unit, true); if (json_last_error() === JSON_ERROR_NONE && is_array($decoded)) { $existingUnits = $decoded; } else { $existingUnits = [$project->unit]; } } $selectedUnits = old('units', $existingUnits); @endphp Hold Ctrl (or Cmd on Mac) to select multiple units
RM
@endsection