src/LaravelPanel/controllers/PanelController.php
public function create($entity, $record = null, $child = null)
    {
        if (!$record && !$child && ($entityObject = Entity::fromYamlFile($entity))) {
            $form = new Form($entityObject, null, Session::get('errors'));

            return $form->view();
        } elseif (($parentEntity = Entity::fromYamlFile($entity)) && ($entityObject = Entity::fromYamlFile($child))) {
            // Get parent's record
            $parentRecord = $parentEntity->class::findOrFail($record);

            $form = new Form($entityObject, null, Session::get('errors'), $parentEntity, $parentRecord);

            return $form->view();
        } else {
            abort(404);
        }
    }
public function create($entity, $record = null, $child = null)
    {
        if (!$record && !$child && ($entityObject = Entity::fromYamlFile($entity))) {
            $form = new Form($entityObject, null, Session::get('errors'));

            return $form->view();
        } elseif (($parentEntity = Entity::fromYamlFile($entity)) && ($entityObject = Entity::fromYamlFile($child))) {
            // Get parent's record
            $parentRecord = $parentEntity->class::findOrFail($record);

            $form = new Form($entityObject, null, Session::get('errors'), $parentEntity, $parentRecord);

            return $form->view();
        } else {
            abort(404);
        }
    }
public function create ( $ entity , $ record = null , $ child = null ) { if ( ! $ record && ! $ child && ( $ entityObject = Entity :: fromYamlFile ( $ entity ) ) ) { $ form = new Form ( $ entityObject , null , Session :: get ( 'errors' ) ) ; return $ form -> view ( ) ; } elseif ( ( $ parentEntity = Entity :: fromYamlFile ( $ entity ) ) && ( $ entityObject = Entity :: fromYamlFile ( $ child ) ) ) { // Get parent's record $ parentRecord = $ parentEntity -> class :: findOrFail ( $ record ) ; $ form = new Form ( $ entityObject , null , Session :: get ( 'errors' ) , $ parentEntity , $ parentRecord ) ; return $ form -> view ( ) ; } else { abort ( 404 ) ; } }
Show the form to create a new record.

@return \Illuminate\Http\Response
Show the form to create a new record .