Laravel使列的特定值唯一

时间:2016-03-18 11:55:19

标签: php mysql laravel

~ gem install sciruby-full Building native extensions. This could take a while... ERROR: Error installing sciruby-full: ERROR: Failed to build gem native extension. /usr/local/var/rbenv/versions/2.2.3/bin/ruby -r ./siteconf20160318-8616-cy3gbi.rb extconf.rb checking for apparent GNU g++ binary with C++0x/C++11 support... 4.9 using C++ standard... c++11 g++ reports version... gcc49 checking for main() in -lclapack... yes checking for main() in -llapack... yes checking for main() in -lcblas... yes checking for main() in -latlas... no checking for atlas/cblas.h... no checking for cblas.h... no checking for clapack.h... no checking for clapack_dgetrf() in atlas/clapack.h... no checking for clapack_dgetri() in atlas/clapack.h... no checking for dgesvd_() in clapack.h... no checking for cblas_dgemm() in cblas.h... no creating nmatrix_config.h creating Makefile make "DESTDIR=" clean make "DESTDIR=" compiling nmatrix.cpp In file included from nmatrix.cpp:59:0: math/math.h:128:29: error: use of enum 'CBLAS_ORDER' without previous declaration inline void syrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, ^ math/math.h:128:59: error: use of enum 'CBLAS_UPLO' without previous declaration inline void syrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, ^ math/math.h:128:87: error: use of enum 'CBLAS_TRANSPOSE' without previous declaration inline void syrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, ^ math/math.h:134:29: error: use of enum 'CBLAS_ORDER' without previous declaration inline void herk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, ^ math/math.h:134:59: error: use of enum 'CBLAS_UPLO' without previous declaration inline void herk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, ^ math/math.h:134:87: error: use of enum 'CBLAS_TRANSPOSE' without previous declaration inline void herk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, ^ math/math.h:140:29: error: use of enum 'CBLAS_ORDER' without previous declaration inline void syrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, ^ math/math.h:140:59: error: use of enum 'CBLAS_UPLO' without previous declaration inline void syrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, ^ math/math.h:140:87: error: use of enum 'CBLAS_TRANSPOSE' without previous declaration inline void syrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, ^ math/math.h: In function 'void nm::math::syrk(int, int, int, int, int, const DType*, const DType*, int, const DType*, DType*, int) [with DType = float]': math/math.h:142:70: error: 'cblas_ssyrk' was not declared in this scope cblas_ssyrk(Order, Uplo, Trans, N, K, *alpha, A, lda, *beta, C, ldc); ^ math/math.h: At global scope: math/math.h:146:29: error: use of enum 'CBLAS_ORDER' without previous declaration inline void syrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, ^ math/math.h:146:59: error: use of enum 'CBLAS_UPLO' without previous declaration inline void syrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, ^ math/math.h:146:87: error: use of enum 'CBLAS_TRANSPOSE' without previous declaration inline void syrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, ^ math/math.h: In function 'void nm::math::syrk(int, int, int, int, int, const DType*, const DType*, int, const DType*, DType*, int) [with DType = double]': math/math.h:148:70: error: 'cblas_dsyrk' was not declared in this scope cblas_dsyrk(Order, Uplo, Trans, N, K, *alpha, A, lda, *beta, C, ldc); ^ math/math.h: At global scope: math/math.h:152:29: error: use of enum 'CBLAS_ORDER' without previous declaration inline void syrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, ^ math/math.h:152:59: error: use of enum 'CBLAS_UPLO' without previous declaration inline void syrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, ^ math/math.h:152:87: error: use of enum 'CBLAS_TRANSPOSE' without previous declaration inline void syrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, ^ math/math.h: In function 'void nm::math::syrk(int, int, int, int, int, const DType*, const DType*, int, const DType*, DType*, int) [with DType = nm::Complex<float>]': math/math.h:154:68: error: 'cblas_csyrk' was not declared in this scope cblas_csyrk(Order, Uplo, Trans, N, K, alpha, A, lda, beta, C, ldc); ^ math/math.h: At global scope: math/math.h:158:29: error: use of enum 'CBLAS_ORDER' without previous declaration inline void syrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, ^ math/math.h:158:59: error: use of enum 'CBLAS_UPLO' without previous declaration inline void syrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, ^ math/math.h:158:87: error: use of enum 'CBLAS_TRANSPOSE' without previous declaration inline void syrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, ^ math/math.h: In function 'void nm::math::syrk(int, int, int, int, int, const DType*, const DType*, int, const DType*, DType*, int) [with DType = nm::Complex<double>]': math/math.h:160:68: error: 'cblas_zsyrk' was not declared in this scope cblas_zsyrk(Order, Uplo, Trans, N, K, alpha, A, lda, beta, C, ldc); ^ math/math.h: At global scope: math/math.h:165:29: error: use of enum 'CBLAS_ORDER' without previous declaration inline void herk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, ^ math/math.h:165:59: error: use of enum 'CBLAS_UPLO' without previous declaration inline void herk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, ^ math/math.h:165:87: error: use of enum 'CBLAS_TRANSPOSE' without previous declaration inline void herk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, ^ math/math.h: In function 'void nm::math::herk(int, int, int, int, int, const DType*, const DType*, int, const DType*, DType*, int) [with DType = nm::Complex<float>]': math/math.h:167:74: error: 'cblas_cherk' was not declared in this scope cblas_cherk(Order, Uplo, Trans, N, K, alpha->r, A, lda, beta->r, C, ldc); ^ math/math.h: At global scope: math/math.h:171:29: error: use of enum 'CBLAS_ORDER' without previous declaration inline void herk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, ^ math/math.h:171:59: error: use of enum 'CBLAS_UPLO' without previous declaration inline void herk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, ^ math/math.h:171:87: error: use of enum 'CBLAS_TRANSPOSE' without previous declaration inline void herk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, ^ math/math.h: In function 'void nm::math::herk(int, int, int, int, int, const DType*, const DType*, int, const DType*, DType*, int) [with DType = nm::Complex<double>]': math/math.h:173:74: error: 'cblas_zherk' was not declared in this scope cblas_zherk(Order, Uplo, Trans, N, K, alpha->r, A, lda, beta->r, C, ldc); ^ math/math.h: At global scope: math/math.h:178:29: error: use of enum 'CBLAS_ORDER' without previous declaration inline void trmm(const enum CBLAS_ORDER order, const enum CBLAS_SIDE side, const enum CBLAS_UPLO uplo, ^ math/math.h:178:59: error: use of enum 'CBLAS_SIDE' without previous declaration inline void trmm(const enum CBLAS_ORDER order, const enum CBLAS_SIDE side, const enum CBLAS_UPLO uplo, ^ math/math.h:178:87: error: use of enum 'CBLAS_UPLO' without previous declaration inline void trmm(const enum CBLAS_ORDER order, const enum CBLAS_SIDE side, const enum CBLAS_UPLO uplo, ^ math/math.h:179:29: error: use of enum 'CBLAS_TRANSPOSE' without previous declaration const enum CBLAS_TRANSPOSE ta, const enum CBLAS_DIAG diag, const int m, const int n, const DType* alpha, ^ math/math.h:179:60: error: use of enum 'CBLAS_DIAG' without previous declaration const enum CBLAS_TRANSPOSE ta, const enum CBLAS_DIAG diag, const int m, const int n, const DType* alpha, ^ math/math.h:185:29: error: use of enum 'CBLAS_ORDER' without previous declaration inline void trmm(const enum CBLAS_ORDER order, const enum CBLAS_SIDE side, const enum CBLAS_UPLO uplo, ^ math/math.h:185:59: error: use of enum 'CBLAS_SIDE' without previous declaration inline void trmm(const enum CBLAS_ORDER order, const enum CBLAS_SIDE side, const enum CBLAS_UPLO uplo, ^ math/math.h:185:87: error: use of enum 'CBLAS_UPLO' without previous declaration inline void trmm(const enum CBLAS_ORDER order, const enum CBLAS_SIDE side, const enum CBLAS_UPLO uplo, ^ math/math.h:186:29: error: use of enum 'CBLAS_TRANSPOSE' without previous declaration const enum CBLAS_TRANSPOSE ta, const enum CBLAS_DIAG diag, const int m, const int n, const float* alpha, ^ math/math.h:186:60: error: use of enum 'CBLAS_DIAG' without previous declaration const enum CBLAS_TRANSPOSE ta, const enum CBLAS_DIAG diag, const int m, const int n, const float* alpha, ^ math/math.h: In function 'void nm::math::trmm(int, int, int, int, int, int, int, const DType*, const DType*, int, DType*, int) [with DType = float]': math/math.h:188:72: error: 'cblas_strmm' was not declared in this scope cblas_strmm(order, side, uplo, ta, diag, m, n, *alpha, A, lda, B, ldb); ^ math/math.h: At global scope: math/math.h:192:29: error: use of enum 'CBLAS_ORDER' without previous declaration inline void trmm(const enum CBLAS_ORDER order, const enum CBLAS_SIDE side, const enum CBLAS_UPLO uplo, ^ math/math.h:192:59: error: use of enum 'CBLAS_SIDE' without previous declaration inline void trmm(const enum CBLAS_ORDER order, const enum CBLAS_SIDE side, const enum CBLAS_UPLO uplo, ^ math/math.h:192:87: error: use of enum 'CBLAS_UPLO' without previous declaration inline void trmm(const enum CBLAS_ORDER order, const enum CBLAS_SIDE side, const enum CBLAS_UPLO uplo, ^ math/math.h:193:29: error: use of enum 'CBLAS_TRANSPOSE' without previous declaration const enum CBLAS_TRANSPOSE ta, const enum CBLAS_DIAG diag, const int m, const int n, const double* alpha, ^ math/math.h:193:60: error: use of enum 'CBLAS_DIAG' without previous declaration const enum CBLAS_TRANSPOSE ta, const enum CBLAS_DIAG diag, const int m, const int n, const double* alpha, ^ math/math.h: In function 'void nm::math::trmm(int, int, int, int, int, int, int, const DType*, const DType*, int, DType*, int) [with DType = double]': math/math.h:195:72: error: 'cblas_dtrmm' was not declared in this scope cblas_dtrmm(order, side, uplo, ta, diag, m, n, *alpha, A, lda, B, ldb); ^ math/math.h: At global scope: math/math.h:199:29: error: use of enum 'CBLAS_ORDER' without previous declaration inline void trmm(const enum CBLAS_ORDER order, const enum CBLAS_SIDE side, const enum CBLAS_UPLO uplo, ^ math/math.h:199:59: error: use of enum 'CBLAS_SIDE' without previous declaration inline void trmm(const enum CBLAS_ORDER order, const enum CBLAS_SIDE side, const enum CBLAS_UPLO uplo, ^ math/math.h:199:87: error: use of enum 'CBLAS_UPLO' without previous declaration inline void trmm(const enum CBLAS_ORDER order, const enum CBLAS_SIDE side, const enum CBLAS_UPLO uplo, ^ math/math.h:200:29: error: use of enum 'CBLAS_TRANSPOSE' without previous declaration const enum CBLAS_TRANSPOSE ta, const enum CBLAS_DIAG diag, const int m, const int n, const Complex64* alpha, ^ math/math.h:200:60: error: use of enum 'CBLAS_DIAG' without previous declaration const enum CBLAS_TRANSPOSE ta, const enum CBLAS_DIAG diag, const int m, const int n, const Complex64* alpha, ^ math/math.h: In function 'void nm::math::trmm(int, int, int, int, int, int, int, const DType*, const DType*, int, DType*, int) [with DType = nm::Complex<float>]': math/math.h:202:71: error: 'cblas_ctrmm' was not declared in this scope cblas_ctrmm(order, side, uplo, ta, diag, m, n, alpha, A, lda, B, ldb); ^ math/math.h: At global scope: math/math.h:206:29: error: use of enum 'CBLAS_ORDER' without previous declaration inline void trmm(const enum CBLAS_ORDER order, const enum CBLAS_SIDE side, const enum CBLAS_UPLO uplo, ^ math/math.h:206:59: error: use of enum 'CBLAS_SIDE' without previous declaration inline void trmm(const enum CBLAS_ORDER order, const enum CBLAS_SIDE side, const enum CBLAS_UPLO uplo, ^ math/math.h:206:87: error: use of enum 'CBLAS_UPLO' without previous declaration inline void trmm(const enum CBLAS_ORDER order, const enum CBLAS_SIDE side, const enum CBLAS_UPLO uplo, ^ math/math.h:207:29: error: use of enum 'CBLAS_TRANSPOSE' without previous declaration const enum CBLAS_TRANSPOSE ta, const enum CBLAS_DIAG diag, const int m, const int n, const Complex128* alpha, ^ math/math.h:207:60: error: use of enum 'CBLAS_DIAG' without previous declaration const enum CBLAS_TRANSPOSE ta, const enum CBLAS_DIAG diag, const int m, const int n, const Complex128* alpha, ^ math/math.h: In function 'void nm::math::trmm(int, int, int, int, int, int, int, const DType*, const DType*, int, DType*, int) [with DType = nm::Complex<double>]': math/math.h:209:71: error: 'cblas_ztrmm' was not declared in this scope cblas_ztrmm(order, side, uplo, ta, diag, m, n, alpha, A, lda, B, ldb); ^ math/math.h: At global scope: math/math.h:540:29: error: use of enum 'CBLAS_ORDER' without previous declaration inline int potrf(const enum CBLAS_ORDER order, const enum CBLAS_UPLO uplo, const int N, DType* A, const int lda) { ^ math/math.h:540:59: error: use of enum 'CBLAS_UPLO' without previous declaration inline int potrf(const enum CBLAS_ORDER order, const enum CBLAS_UPLO uplo, const int N, DType* A, const int lda) { ^ math/math.h:881:30: error: use of enum 'CBLAS_ORDER' without previous declaration inline void lauum(const enum CBLAS_ORDER order, const enum CBLAS_UPLO uplo, const int N, DType* A, const int lda) { ^ math/math.h:881:60: error: use of enum 'CBLAS_UPLO' without previous declaration inline void lauum(const enum CBLAS_ORDER order, const enum CBLAS_UPLO uplo, const int N, DType* A, const int lda) { ^ math/math.h: In function 'void nm::math::lauum(int, int, int, DType*, int)': math/math.h:896:17: error: 'CblasUpper' was not declared in this scope if (uplo == CblasUpper) { ^ math/math.h:897:20: error: 'CblasRowMajor' was not declared in this scope if (order == CblasRowMajor) { ^ math/math.h:905:20: error: 'CblasRowMajor' was not declared in this scope if (order == CblasRowMajor) { ^ math/math.h:919:37: error: 'CblasLower' was not declared in this scope uplo == CblasLower ? CblasConjTrans : CblasNoTrans, ^ math/math.h:919:50: error: 'CblasConjTrans' was not declared in this scope uplo == CblasLower ? CblasConjTrans : CblasNoTrans, ^ math/math.h:919:67: error: 'CblasNoTrans' was not declared in this scope uplo == CblasLower ? CblasConjTrans : CblasNoTrans, ^ math/math.h:922:36: error: 'CblasLeft' was not declared in this scope nm::math::trmm<DType>(order, CblasLeft, uplo, CblasConjTrans, CblasNonUnit, Nright, Nleft, &ONE, U1, lda, G, lda); ^ math/math.h:922:69: error: 'CblasNonUnit' was not declared in this scope nm::math::trmm<DType>(order, CblasLeft, uplo, CblasConjTrans, CblasNonUnit, Nright, Nleft, &ONE, U1, lda, G, lda); ^ math/math.h:925:37: error: 'CblasLower' was not declared in this scope uplo == CblasLower ? CblasTrans : CblasNoTrans, ^ math/math.h:925:50: error: 'CblasTrans' was not declared in this scope uplo == CblasLower ? CblasTrans : CblasNoTrans, ^ math/math.h:925:63: error: 'CblasNoTrans' was not declared in this scope uplo == CblasLower ? CblasTrans : CblasNoTrans, ^ math/math.h:928:36: error: 'CblasLeft' was not declared in this scope nm::math::trmm<DType>(order, CblasLeft, uplo, CblasTrans, CblasNonUnit, Nright, Nleft, &ONE, U1, lda, G, lda); ^ math/math.h:928:65: error: 'CblasNonUnit' was not declared in this scope nm::math::trmm<DType>(order, CblasLeft, uplo, CblasTrans, CblasNonUnit, Nright, Nleft, &ONE, U1, lda, G, lda); ^ math/math.h: At global scope: math/math.h:969:37: error: use of enum 'CBLAS_ORDER' without previous declaration inline int clapack_lauum(const enum CBLAS_ORDER order, const enum CBLAS_UPLO uplo, const int n, void* a, const int lda) { ^ math/math.h:969:67: error: use of enum 'CBLAS_UPLO' without previous declaration inline int clapack_lauum(const enum CBLAS_ORDER order, const enum CBLAS_UPLO uplo, const int n, void* a, const int lda) { ^ math/math.h: In function 'int nm::math::clapack_lauum(int, int, int, void*, int)': math/math.h:973:15: error: 'CblasUpper' was not declared in this scope if (uplo == CblasUpper) lauum<is_complex, DType>(order, uplo, n, reinterpret_cast<DType*>(a), lda); ^ math/math.h: At global scope: math/math.h:1016:37: error: use of enum 'CBLAS_ORDER' without previous declaration inline int clapack_potrf(const enum CBLAS_ORDER order, const enum CBLAS_UPLO uplo, const int n, void* a, const int lda) { ^ math/math.h:1016:67: error: use of enum 'CBLAS_UPLO' without previous declaration inline int clapack_potrf(const enum CBLAS_ORDER order, const enum CBLAS_UPLO uplo, const int n, void* a, const int lda) { ^ math/math.h:1023:29: error: use of enum 'CBLAS_ORDER' without previous declaration inline int potri(const enum CBLAS_ORDER order, const enum CBLAS_UPLO uplo, const int n, DType* a, const int lda) { ^ math/math.h:1023:59: error: use of enum 'CBLAS_UPLO' without previous declaration inline int potri(const enum CBLAS_ORDER order, const enum CBLAS_UPLO uplo, const int n, DType* a, const int lda) { ^ math/math.h:1060:37: error: use of enum 'CBLAS_ORDER' without previous declaration inline int clapack_potri(const enum CBLAS_ORDER order, const enum CBLAS_UPLO uplo, const int n, void* a, const int lda) { ^ math/math.h:1060:67: error: use of enum 'CBLAS_UPLO' without previous declaration inline int clapack_potri(const enum CBLAS_ORDER order, const enum CBLAS_UPLO uplo, const int n, void* a, const int lda) { ^ In file included from nmatrix.cpp:297:0: ruby_nmatrix.c: In function 'VALUE nm_reshape_bang(VALUE, VALUE)': ruby_nmatrix.c:1069:11: warning: unused variable 'elem' [-Wunused-variable] void* elem = s->elements; ^ make: *** [nmatrix.o] Error 1 make failed, exit code 2 Gem files will remain installed in /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nmatrix-0.1.0 for inspection. Results logged to /usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-15/2.2.0-static/nmatrix-0.1.0/gem_make.out 表包含billing_plans列。只能选择一个作为默认值。但您可以在表格中编辑计划。我想创建一个二进制列,1值等于默认值,0不是。但是mysql和laravel认为0值也是唯一的。是否可以仅使列的特定值唯一?

移植

default_plan

1 个答案:

答案 0 :(得分:0)

使用Mysql无法忽略唯一约束的 false 值。您需要将列置为可空,并且当它为false时,将其置为null而不是false。

$billingPlan->default_plan = ($request->input('default_plan'))?:null;

请参阅https://stackoverflow.com/a/4617940/2389232