jeudi 16 novembre 2017

Pass variable from custom Laravel Helpers to Blade file

I'm trying to create a helper to centralize a complicated Form::select.

My helper:

namespace App\Helpers;
use Log;
use App\Countries;

class Address {
    public static function country() {
        $countries = Countries::orderby('name_zh','asc');
        $form = "Form::select('countries', \$countries);";
        return $form;
    }
}

My View:

{!! Address::country() !!}

I would like to have this select form with $countries variable from this helper and show a Dropdown list on my view. How do I do it?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire