12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- namespace App\Repositories\Transformers;
- use League\Fractal\TransformerAbstract;
- /**
- * Class ProjectTransformer.
- *
- * @package namespace App\Repositories\Transformers\Review;
- */
- abstract class BaseTransformer extends TransformerAbstract
- {
- protected $type = 'list';
- public function __construct($type = 'list')
- {
- $this->type = $type;
- }
- /**
- * Transform the Project entity.
- *
- *
- * @return array
- */
- public function transform($model)
- {
- switch ($this->type) {
- case 'list':
- return $this->lists($model);
- break;
- default:
- return $this->detail($model);
- break;
- }
- }
- public abstract function lists($model);
- public abstract function detail($model);
- }
|