Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please set the $presenter property to your presenter path. #54

Open
sezohessen opened this issue Mar 15, 2023 · 0 comments
Open

Please set the $presenter property to your presenter path. #54

sezohessen opened this issue Mar 15, 2023 · 0 comments

Comments

@sezohessen
Copy link

My Model :

<?php

namespace App\Models;
use App\Presenters\InventoryOutProductPresenter;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Laracasts\Presenter\PresentableTrait;

class InventoryOutProduct extends Model 
{
    use HasFactory,PresentableTrait;
    protected $presenter = InventoryOutProductPresenter::class;
   
}

My Presenter :

<?php
namespace App\Presenters;
use Laracasts\Presenter\Presenter;

class InventoryOutProductPresenter extends Presenter {

    public function product_text_format()
    {
        return $this->title.'('.$this->price_per_qty.')';
    }

}

Call : $model->present()->product_text_format;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant