PHP code example of touhidurabir / laravel-presenter
1. Go to this page and download the library: Download touhidurabir/laravel-presenter library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
touhidurabir / laravel-presenter example snippets
namespace Touhidurabir\Presenter\Tests\App\Presenters;
use Touhidurabir\Presenter\BasePresenter;
class UserPresenter extends BasePresenter {
}
use Illuminate\Database\Eloquent\Model;
use Touhidurabir\Presenter\HasPresenter;
use Touhidurabir\Presenter\Tests\App\Presenters\UserPresenter;
class User extends Model {
use HasPresenter;
protected $presenter = UserPresenter::class;
}
class UserPresenter extends BasePresenter {
public function someMethod() {
return $this->model->some_presentable_data;
}
}