giobi
2/3/2019 - 9:11 PM

AjaxEntityControllerAbstract.php

<?php

namespace App\Http\Controllers\Ajax;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

abstract class AjaxEntityControllerAbstract
    extends Controller
    implements AjaxEntityControllerInterface {

    static protected $model;

    public function get($entityId) {
        $entity = static::$model::find($entityId);

        return response(['data' => $entity]);
    }

}