1. Go to this page and download the library: Download coburncodes/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/ */
coburncodes / presenter example snippets
use Coburncodes\Presenter\Presentable;
class User
{
use Presentable;
protected $fillable = [
'first_name', 'last_name', 'email', 'password',
];
...
bash
$ php artisan vendor:publish
bash
$ php artisan presenter:generate
php
namespace App\Presenters;
use Coburncodes\Presenter\Presenter;
class UserPresenter extends Presenter
{
public function fullName()
{
return $this->first_name . ' ' . $this->last_name;
}
}
php
public function index()
{
return Auth::user()->first_name . ' ' . Auth::user()->last_name;
}
php
public function index()
{
return Auth::user()->present()->fullName;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.