mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 06:04:08 -08:00
condition makes this work, needs more testing
This commit is contained in:
parent
43d8474caa
commit
bcfa913450
|
@ -11,6 +11,7 @@ use App\Models\User;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Input;
|
use Illuminate\Support\Facades\Input;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\View;
|
use Illuminate\Support\Facades\View;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
|
@ -513,9 +514,8 @@ class AssetModelsController extends Controller
|
||||||
|
|
||||||
$validator = Validator::make($data, $rules);
|
$validator = Validator::make($data, $rules);
|
||||||
|
|
||||||
// Okay, this is the problem. Seems to be failing every time, kind of makes sense because it looks like
|
|
||||||
// $rules is an empty array, but I need to wrap my head around this entire method a little more.
|
|
||||||
if($validator->fails()){
|
if($validator->fails()){
|
||||||
|
Log::debug($validator->errors());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,9 +92,12 @@ class CustomFieldset extends Model
|
||||||
|
|
||||||
array_push($rule, $field->attributes['format']);
|
array_push($rule, $field->attributes['format']);
|
||||||
$rules[$field->db_column_name()] = $rule;
|
$rules[$field->db_column_name()] = $rule;
|
||||||
//add not_array to rules for all fields
|
// add not_array to rules for all fields
|
||||||
|
// condition added to fix issue with model default updates
|
||||||
|
if ($field->element != 'checkbox') {
|
||||||
$rules[$field->db_column_name()][] = 'not_array';
|
$rules[$field->db_column_name()][] = 'not_array';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $rules;
|
return $rules;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue