本文整理汇总了PHP中Illuminate\Database\Eloquent\Builder::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Builder::create方法的具体用法?PHP Builder::create怎么用?PHP Builder::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\Eloquent\Builder
的用法示例。
在下文中一共展示了Builder::create方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
/** @var Category $category */
$category = $this->category->create(['name' => $request->get('name')]);
$this->webUi->successMessage("Created new category `{$category->name}`.");
return $this->webUi->redirect('categories.index');
}
示例2: storeUploadedImage
/**
* @param UploadedFile $upload
*
* @throws \Symfony\Component\HttpFoundation\File\Exception\FileException
*
* @return Image
*/
public function storeUploadedImage(UploadedFile $upload) : Image
{
$newImage = $this->imageResource->create(['filename' => uniqid('', true) . $upload->getClientOriginalName()]);
$upload->move(storage_path('image'), $newImage->filename());
$this->dispatcher->fire(new NewImageEvent($newImage));
return $newImage;
}
示例3: create
/**
* Create a new item
*
* @param array $data
* @return mixed
*/
public function create(array $data)
{
$item = $this->builder->create($data);
// Reset the query builder
$this->newBuilder();
return $item;
}
示例4: storeSingle
/**
* Save a single notification sent
*
* @param array $info
* @return Notification
*/
public function storeSingle(array $info)
{
return $this->notification->create($info);
}
示例5: create
/**
* @param array $tagData
*
* @return Tag
*/
public function create(array $tagData)
{
return $this->tagResource->create($tagData);
}
示例6: create
/**
* @param array $data
* @return mixed
*/
public function create(array $data)
{
return $this->model->create($data);
}
示例7: add
/**
* Add a category to the DB.
*
* @param array $name
* @param $text
* @return static
*/
public function add($name, $text)
{
return $this->categoryModel->create(compact('name', 'text'));
}
示例8: create
/**
* Create a new group
*
* @param $name
* @return \Illuminate\Database\Eloquent\Model
*/
public function create($name)
{
return $this->groupModel->create(compact('name'));
}
示例9: create
/**
* Save a new model and return the instance.
*
* @param array $attributes
* @return \Illuminate\Database\Eloquent\Model
*/
public function create(array $attributes = [])
{
return $this->model->create($this->filterAttributes($attributes));
}