Controllers

The controller will be stubbed out with the following methods by default:

  • index()
  • store(Request $request)
  • show($id)
  • update(Request $request, $id)
  • destroy($id)
  • model (protected)

The following parameters are set in the Base Api controller and can be overwritten by your Controller on a case by case basis:

  • protected $resourceSingle Collection to use for your single resource.
  • protected $resourceCollection Collection to use for your resource collection
  • protected $defaultSort = null; Set the default sorting for queries.
  • protected $defaultLimit = 25; Number of items displayed at once if not specified. (0 = maximumLimit)
  • protected $maximumLimit = 0; Maximum limit that can be set via $_GET. this ties in with the defaultLimit aswell, and if wanting to disable pagination , both should be 0. ) will allow all records to be returned in a single call.
  • protected $unguard = false; Do we need to unguard the model before create/update?
  • protected $includesWhitelist = []; & protected $includesBlacklist = []; work much like the model guard / unguard options, if you whitelist only those will be allowed, blacklist will block only those, blank in both allows all includes.