Creates a new Rest model.
If creation is successful, the browser will be redirected to the 'view' page.
@return mixed
14003
public function actionCreate()
    {
        $model = new Client();
        if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {
            Yii::$app->response->format = Response::FORMAT_JSON;
            return ActiveForm::validate($model);
        } else if ($model->load(Yii::$app->request->post()) && $model->save()) {
            Yii::$app->getSession()->setFlash('success', Yii::t('oauth2', 'Successful operation'));
            return $this->redirect(['view', 'id' => $model->client_id]);
        } else {
            return $this->render('create', [
                'model' => $model,
            ]);
        }
    }
199279
public function create()
	{
		// create a new session
		$this->keys['session_id']	= $this->_new_session_id();
		$this->keys['previous_id']	= $this->keys['session_id'];	// prevents errors if previous_id has a unique index
		$this->keys['ip_hash']		= md5(\Input::ip().\Input::real_ip());
		$this->keys['user_agent']	= \Input::user_agent();
		$this->keys['created'] 		= $this->time->get_timestamp();
		$this->keys['updated'] 		= $this->keys['created'];

		return $this;
	}
522487
public function actionCreate()
    {
        $model = Yii::createObject($this->modelClass);

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            Yii::$app->session->setFlash('success', Yii::t('yii2mod.cms', 'Page has been created.'));

            return $this->redirect(['index']);
        }

        return $this->render($this->createView, [
            'model' => $model,
        ]);
    }
327582
public function create()
    {
        $template = $this->template->where('active', 1)->where('type', 'admin')->first();
        $templates = $this->template->where('active', 1)->where('type', 'default')->get();
        $pageViews = $this->template->getPageViews();
        return view('chuckcms::backend.pages.create', compact('template', 'templates', 'page', 'pageViews'));
    }
1185214
public function actionCreate()
    {
        $request = \Yii::$app->request;
        if ($request->getIsOptions()) {
            return $this->ResponseOptions($this->verbs()['create']);
        }
        try{
            $model = new Menu;

            if ($model->load(Yii::$app->request->post()) && $model->save()) {
                Helper::invalidate();
                return ["success"=> true];
            } else {
                return ["success"=> false];
            }
        }catch(Exception $e){
            throw new Exception($e);
        }

    }
558060
public function actionCreate()
    {
        $request = \Yii::$app->request;
        if ($request->getIsOptions()) {
            return $this->ResponseOptions($this->verbs()['create']);
        }
        try{
            $routes = Yii::$app->getRequest()->post('route', '');
            $routes = preg_split('/\s*,\s*/', trim($routes), -1, PREG_SPLIT_NO_EMPTY);
            $methods = Yii::$app->getRequest()->post('methods', '');
            $model = new Route();
            $model->addNewMethod($routes,$methods);
            return $model->getRoutes();
        }catch(Exception $e){
            throw new Exception($e);
        }

    }
64982
public function create()
  {
    $uses = [
      'Phrest\API\DI\PhrestDIInterface',
      'Phrest\SDK\PhrestSDK',
      'Phrest\SDK\Request\AbstractRequest',
      $this->namespace . '\\' . Generator::$name . 'API'
    ];

    foreach($this->requests as $request)
    {
      $uses[] = $request->getNamespace() . '\\' . $request->getName();
    }

    $class = ClassGen::classGen(
      $this->name,
      $this->namespace . '\\' . $this->version,
      $uses,
      'PhrestSDK'
    );

    $di = new ParameterGenerator('di', 'PhrestDIInterface');
    $constructor = ClassGen::constructor([$di]);
    $constructor->setBody($this->getConstructorBody());
    $class->addMethodFromGenerator($constructor);

    $abstractRequest = new ParameterGenerator('request', 'AbstractRequest');
    $injectDependencies = ClassGen::method(
      'injectDependencies',
      [$abstractRequest],
      'private',
      'return $request;'
    );
    $docBlock = $injectDependencies->getDocBlock();
    $docBlock->setTag(new GenericTag('return', 'AbstractRequest'));
    $class->addMethodFromGenerator($injectDependencies);

    foreach($this->requests as $request)
    {
      $getRequest = ClassGen::method(
        'get' . ucfirst($request->getName()),
        [],
        'public',
        'return $this->injectDependencies(new ' . $request->getName() . '());'
      );
      $getRequest->getDocBlock()->setTag(new GenericTag('return', $request->getName()));
      $class->addMethodFromGenerator($getRequest);
    }

    return $class;
  }
1032444
public function actionCreate()
    {
        $model = new User();
        $model->setScenario('create');
        if (yii::$app->getRequest()->getIsPost()) {
            if ( $model->load(Yii::$app->getRequest()->post()) && $model->save() && $model->assignPermission() ) {
                Yii::$app->getSession()->setFlash('success', yii::t('cms', 'Success'));
                return $this->redirect(['index']);
            } else {
                $errors = $model->getErrors();
                $err = '';
                foreach ($errors as $v) {
                    $err .= $v[0] . '<br>';
                }
                Yii::$app->getSession()->setFlash('error', $err);
            }
        }
        $model->loadDefaultValues();
        return $this->render('create', [
            'model' => $model,
        ]);
    }
872182
public function actionCreate()
    {
        $model = new AuthItem();

        if ($model->loadAll(request()->post()) && $model->saveAll()) {
            return $this->redirect(['view', 'id' => $model->name]);
        } else {
            return $this->render('create', [
                'model' => $model,
            ]);
        }
    }
540139
public function create()
	{
		$return = Input::get('return');
		if (empty($return))
		{
			return Redirect::to('/');
		}
		try {
			$commentable = Input::get('commentable');
			if (empty($commentable))
			{
				throw new Exception();
			}
			$commentable = Crypt::decrypt($commentable);
			if (strpos($commentable, '.') == false)
			{
				throw new Exception();
			}
			list($commentableType, $commentableId) = explode('.', $commentable);
			if (!class_exists($commentableType))
			{
				throw new Exception();
			}
			$data = array(
				'commentable_type' => $commentableType,
				'commentable_id' => $commentableId,
				'comment' => Input::get('comment'),
				'user_id' => Auth::user()->id,
			);
			$rules = $this->comment->getRules($commentableType);
			$validator = Validator::make($data, $rules);
			if ($validator->fails())
			{
				return Redirect::to($return)->withErrors($validator);
			}
			$this->comment->fill($data);
			$this->comment->save();
			$newCommentId = $this->comment->id;
			return Redirect::to($return.'#C'.$newCommentId);

		} catch (\Exception $e) {

			return Redirect::to($return.'#'.trans('laravel-comments::messages.add_form_anchor'))
				->with('laravel-comments::error', trans('laravel-comments::messages.unexpected_error'));

		}

	}
1321461
public function create() {
        // Is this user allowed to do this?
        if (!$this->repository->isUserAllowed('create'))
        {
            Session::flash('status_code', 400 );
            $message = "You are not allowed to create ".$this->model->table;
            Session::flash('message', $message);
            return view('formhandling::warnings/' . config('lasallecmsadmin.admin_template_name') . '/user_not_allowed', [
                'package_title'        => $this->model->package_title,
                'table_type_plural'    => $this->model->table,
                'table_type_singular'  => strtolower($this->model->model_class),
                'resource_route_name'  => $this->model->resource_route_name,
                'HTMLHelper'           => HTMLHelper::class,
            ]);
        }

        // Specifically for Post Updates
        if (empty(Input::get('post_id'))) {
            $post_id = 0;
            //$related_table

        } else {

            $post_id = Input::get('post_id');

            if ( (int) $post_id < 1 )
            {
                // flash message with redirect
                Session::flash('status_code', 400 );
                $message = 'Please initiate the creation of a new update for your post by clicking the icon ';
                $message .= 'in the row of the post you want to update.';
                Session::flash('message', $message);
                return Redirect::route('admin.'.$this->model->resource_route_name.'.index');
            }
        }

        // Are there mandatory related tables that have no records? If so, can't create/edit
        $isNotNullableRelatedTablesWithNoRecords = $this->repository->isNotNullableRelatedTablesWithNoRecords($this->getFieldList());

        if ($isNotNullableRelatedTablesWithNoRecords['mandatory_no_records'])
        {
            Session::flash('status_code', 400 );
            $message  = "You are not allowed to create ".HTMLHelper::pluralToSingular($this->model->table)." because ";
            $message .= "there are no enabled records in the ";

            if ( !empty($isNotNullableRelatedTablesWithNoRecords['field']['alternate_form_name']) )
            {
                $message .= $isNotNullableRelatedTablesWithNoRecords['field']['alternate_form_name'];
            } else {
                $message .= $isNotNullableRelatedTablesWithNoRecords['field']['name'];
            }

            $message .= ' table. You must add enabled records to the "';
            $message .= $isNotNullableRelatedTablesWithNoRecords['field']['related_table_name'];

            $message .= '" table first!';
            Session::flash('message', $message);
            return Redirect::route('admin.'.$this->model->resource_route_name.'.index');
        }

        return view('formhandling::adminformhandling/' . config('lasallecmsadmin.admin_template_name') . '/create',
        [
            'post_id'                      => $post_id,
            'repository'                   => $this->repository,
            'package_title'                => $this->model->package_title,
            'table_name'                   => $this->model->table,
            'model_class'                  => $this->model->model_class,
            'resource_route_name'          => $this->model->resource_route_name,
            'field_list'                   => $this->getFieldList(),
            'namespace_formprocessor'      => $this->model->namespace_formprocessor,
            'classname_formprocessor_create' => $this->model->classname_formprocessor_create,
            'DatesHelper'                  => DatesHelper::class,
            'HTMLHelper'                   => HTMLHelper::class,
            'carbon'                       => Carbon::class,
            'Config'                       => Config::class,
            'Form'                         => Form::class,
            'admin_size_input_text_box'    => Config::get('lasallecmsadmin.admin_size_input_text_box'),
        ]);
    }
558606
private function create()
    {
        $response = $this->sendRequest(
            self::METHOD_POST,
            self::$endPoints['create'],
            $this->requestData
        );
        $this->resetRequestData();
        return $response;
    }
471623
public function actionCreate()
    {
        $model = new SeoPresets();
        $model->loadDefaultValues();
        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            if(Yii::$app->request->post('action') === 'apply') {
                return $this->redirect(['update', 'id' => $model->id]);
            }else{
                return $this->redirect(['view', 'id' => $model->id]);
            }
        }

        return $this->render('create', [
            'model' => $model,
        ]);
    }
519392
public function create()
  {
    if ( \Auth::user()->roles[0]->can('menu-create' ) ) {
      $items = $this->menus->pluck('name', 'id')->toarray();
      $roles = Role::pluck('name', 'id')->toarray();
      $selected = [];
      return \View::make('acl::admin.menus.create', [
        'items'    =>  $items,
        'roles'    =>  $roles,
        'selected' =>  $selected,
        'title'    => 'create',
      ]);
    }
    return \Redirect::route('admin.menus.index')->withErrors(trans('acl::dashboard.unauthorized_access'));
  }
981045
public function actionCreate()
    {
        $model = new AuthItemModel();
        $model->type = $this->type;

        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            Yii::$app->session->setFlash('success', Yii::t('yii2mod.rbac', 'Item has been saved.'));

            return $this->redirect(['view', 'id' => $model->name]);
        }

        return $this->render('create', ['model' => $model]);
    }
113212
public function actionCreate()
    {
        $model = new UserAuthItem(null);
        $model->type = $this->type;
        if ($model->load(Yii::$app->getRequest()->post()) && $model->save()) {
            Yii::$app->getSession()->setFlash('success', Yii::t('yuncms','Create success.'));
            return $this->redirect(['view', 'id' => $model->name]);
        } else {
            return $this->render('create', ['model' => $model]);
        }
    }
546376
public function actionCreate()
	{
		$model=new Post;
		if(isset($_POST['Post']))
		{
			$model->attributes=$_POST['Post'];
			if($model->save())
				$this->redirect(array('view','id'=>$model->id));
		}

		$this->render('create',array(
			'model'=>$model,
		));
	}