PHP code example of saidjon / inertia-crud-generator
1. Go to this page and download the library: Download saidjon/inertia-crud-generator 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/ */
saidjon / inertia-crud-generator example snippets
public function share(Request $request)
{
return array_merge(parent::share($request), [
'csrf' =>csrf_token(),
]);
}
public function serializeForIndex(RestifyRequest $request): array
{
$data = parent::serializeForIndex($request);
// $attributes = $this->when((bool) $attrs = $this->resolveIndexAttributes($request), $attrs);
/**
* move attributes to one level up and extract them , unset original attributes
*/
$data = array_merge($data,$data['attributes']);
unset($data['attributes']);
return $data;
}