本文整理汇总了PHP中app\Config::getUploadBaseDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::getUploadBaseDirectory方法的具体用法?PHP Config::getUploadBaseDirectory怎么用?PHP Config::getUploadBaseDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Config
的用法示例。
在下文中一共展示了Config::getUploadBaseDirectory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postCreate
public function postCreate(Request $request)
{
$validator = Validator::make($request->all(), array('firstName' => 'required', 'lastName' => 'required', 'username' => 'required|max:20|min:3|unique:users', 'password' => 'required|min:6', 'email' => 'required|max:50|email|unique:users', 'roleId' => 'integer|min:1'));
if ($validator->fails()) {
return redirect()->route('admin-users-create')->withErrors($validator)->withInput();
} else {
$user = User::create(array('firstName' => $request->get('firstName'), 'lastName' => $request->get('lastName'), 'username' => $request->get('username'), 'password' => Hash::make($request->get('password')), 'email' => $request->get('email'), 'active' => $request->has('active') ? true : false, 'mobile' => $request->get('mobile'), 'roleId' => $request->get('roleId')));
$arr = array('id' => $user->id, 'firstName' => $user->firstName, 'lastName' => $user->lastName, 'username' => $user->username, 'email' => $user->email, 'active' => $user->active, 'mobile' => $user->mobile);
if ($user) {
//$message = trans('language.USER-CREATED');
$message = 'User has been created.';
//Logging::created('User', $arr);
} else {
//$message = trans('language.USER-NOT-CREATED');
$message = 'User can not be created, please try again.';
//Logging::not_created('User', $arr);
}
$copy1 = copy('output/crops.xlsx', 'uploads/' . $user->id . '$crops.xlsx');
$result = Upload::uploadInputFile(Config::getUploadBaseDirectory() . 'uploads/' . $user->id . '$crops.xlsx', 'crop', $user->id);
if ($copy1 == true and strpos($result, 'Uploaded') !== false) {
$state = '1';
} else {
$state = '0';
}
$copy2 = copy('output/soils.xlsx', 'uploads/' . $user->id . '$soils.xlsx');
$result = Upload::uploadInputFile(Config::getUploadBaseDirectory() . 'uploads/' . $user->id . '$soils.xlsx', 'soil', $user->id);
if ($copy2 == true and strpos($result, 'Uploaded') !== false) {
$state .= '-1';
} else {
$state .= '-0';
}
$copy3 = copy('output/efficiency.xlsx', 'uploads/' . $user->id . '$efficiency.xlsx');
$result = Upload::uploadInputFile(Config::getUploadBaseDirectory() . 'uploads/' . $user->id . '$efficiency.xlsx', 'efficiency', $user->id);
if ($copy3 == true and strpos($result, 'Uploaded') !== false) {
$state .= '-1';
} else {
$state .= '-0';
}
$copy4 = copy('output/yield.xlsx', 'uploads/' . $user->id . '$yield.xlsx');
$result = Upload::uploadInputFile(Config::getUploadBaseDirectory() . 'uploads/' . $user->id . '$yield.xlsx', 'yield', $user->id);
if ($copy4 == true and strpos($result, 'Uploaded') !== false) {
$state .= '-1';
} else {
$state .= '-0';
}
$state .= '-0-0-0-0-0-0';
$upload = Upload::create(array('userId' => $user->id, 'state' => $state));
if ($copy1 == true) {
$upload->crop = 'crops.xlsx';
$upload->crop_at = date('Y-m-d H:i:s');
$upload->save();
}
if ($copy2 == true) {
$upload->soil = 'soils.xlsx';
$upload->soil_at = date('Y-m-d H:i:s');
$upload->save();
}
if ($copy3 == true) {
$upload->efficiency = 'efficiency.xlsx';
$upload->efficiency_at = date('Y-m-d H:i:s');
$upload->save();
}
if ($copy4 == true) {
$upload->yield = 'yield.xlsx';
$upload->yield_at = date('Y-m-d H:i:s');
$upload->save();
}
}
return redirect()->route('admin-users-list')->with('global', $message);
}
示例2: runModel
public function runModel()
{
$uploads = Upload::getUploads();
$upload = $uploads->first();
$state_arr = explode('-', $upload->state);
/*
for($i=0; $i<=7; $i++) {
if($i==5) continue;
else if($state_arr[$i]==0) {
switch ($i) {
case 0: return json_encode(array('type'=>'Crop', 'state'=>$state_arr[$i])); break;
case 1: return json_encode(array('type'=>'Soil', 'state'=>$state_arr[$i])); break;
case 2: return json_encode(array('type'=>'Irrigation Efficiency', 'state'=>$state_arr[$i])); break;
case 3: return json_encode(array('type'=>'Crop Yield', 'state'=>$state_arr[$i])); break;
case 4: return json_encode(array('type'=>'Climate Model', 'state'=>$state_arr[$i])); break;
case 5: return json_encode(array('type'=>'Weather Data', 'state'=>$state_arr[$i])); break;
case 6: return json_encode(array('type'=>'Model Type', 'state'=>$state_arr[$i])); break;
case 7: return json_encode(array('type'=>'Model Type', 'state'=>$state_arr[$i])); break;
}
}
}*/
for ($i = 0; $i <= 7; $i++) {
if ($i == 5 && $upload->climate_model != 'SelfSuppliedStation') {
continue;
} else {
if ($state_arr[$i] == 0) {
switch ($i) {
case 0:
return json_encode(array('type' => 'Crop', 'state' => $state_arr[$i]));
break;
case 1:
return json_encode(array('type' => 'Soil', 'state' => $state_arr[$i]));
break;
case 2:
return json_encode(array('type' => 'Irrigation Efficiency', 'state' => $state_arr[$i]));
break;
case 3:
return json_encode(array('type' => 'Crop Yield', 'state' => $state_arr[$i]));
break;
case 4:
return json_encode(array('type' => 'Climate Model', 'state' => $state_arr[$i]));
break;
case 5:
return json_encode(array('type' => 'Weather Data', 'state' => $state_arr[$i]));
break;
case 6:
return json_encode(array('type' => 'Model Type', 'state' => $state_arr[$i]));
break;
case 7:
return json_encode(array('type' => 'Model Type', 'state' => $state_arr[$i]));
break;
}
}
}
}
$state_arr[8] = 1;
$state = $state_arr[0];
for ($j = 1; $j < count($state_arr); $j++) {
$state .= '-' . $state_arr[$j];
}
$upload->state = $state;
$upload->save();
$result = Upload::uploadInputFile(Config::getUploadBaseDirectory() . 'uploads/' . User::getSignedInUserId() . "\$" . "IC_ClimIn.txt", 'run_model', User::getSignedInUserId());
return json_encode(array('state' => -1));
}