lundi 26 novembre 2018

Laravel: on Model::all() set parameter to model method

I want to set a parameter to each model method when calling Model::all().

Model:

protected $appends = ['convertedImage'];

public function getconvertedImageAttribute(String $logo_base64) {
    //actions here
}

View:

<script>
    var logo_base64 = '...logo_string_to_base_64...';
    var allFrames = '{!! \App\Frame::all()->toJson() !!}';
</script>

My question is how to set logo_base64 from view as parameter to Model method getconvertedImageAttribute() on calling Model::all();



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire