2

My controller as below;

public function edit($id) {
$get_property = StockPropertyTemplate::where('group_id' , $id)->where('type' , 'property')->get();

 //like get_property = ['1' , '2' , '3'];
 return view('eticaret.property_groups.edit' , compact('get_property'));
}

My edit.blade as below;

@extends('layouts.app_master')
    @section('content')
    {--this part is not important--}
    @endsection 
    @section('footer')
     <script>
            var getProperty = {!! $get_property !!}
            alert(getProperty);
        </script>
    @endsection

How can i get output.

ufuk
  • 367
  • 3
  • 16

1 Answers1

3

You should do json_encode

var getProperty = {!! json_encode($get_property) !!}
Peter Kota
  • 8,048
  • 5
  • 25
  • 51