我正在向表中发布一些数据。

由于我的发布数据非常大,有什么方法可以检查是否发布了所有值?然后将其插入数据库。

还是尝试插入它,让数据库处理它?

先感谢您。

最佳答案

您可以使用require属性验证请求


class CreateNotebookRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'modelName' => 'required',
....


Read more about request validation

关于mysql - Laravel 5:仅在所有值都存在时插入,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32103117/

10-15 02:49
查看更多