Answers for "print array in blade + laravel"

PHP
0

how to print array in laravel blade

@php
            var_dump($arr);
        @endphp
Posted by: Guest on December-01-2020
1

Create and Print Array in Laravel

In App -> project.php modal file


    // NOTE: service #1 : General Translation
    public static function translationTypes()
    {
        return collect([
          [
            'id' => '1',
            'en_title' => 'Medical',
          ],
          [
            'id' => '2',
            'en_title' => 'General',
          ],
          [
            'id' => '3',
            'en_title' => 'Commercial',
          ],
          [
            'id' => '4',
            'en_title' => 'Literary',
          ],
        ]);
    }


In Controller

            $translationTypes = Project::translationTypes();

In View 

                @foreach($translationTypes as $translationType)
                <option value="{{$translationType['id']}}">{{ $translationType['en_title'] }}</option>
                @endforeach
Posted by: Guest on September-18-2021

Code answers related to "print array in blade + laravel"

Browse Popular Code Answers by Language