This commit is contained in:
foobar
2022-08-21 21:39:06 +02:00
commit 27c1969aaa
7354 changed files with 897064 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreCityRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
$user = $this->user();
return $user != null && $user->tokenCan('create');
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, mixed>
*/
public function rules()
{
return [
'locationName' => ['required'],
'locationCountry' => ['required'],
'currentTemperature' => ['required'],
'weatherIcon' => ['required'],
'weatherDescription' => ['required'],
'windSpeed' => ['required'],
'localtimeEpoch' => ['required'],
];
}
protected function prepareForValidation() {
$this->merge([
'location_name' => $this->locationName,
'location_country' => $this->locationCountry,
'current_temperature' => $this->currentTemperature,
'weather_icon' => $this->weatherIcon,
'weather_description' => $this->weatherDescription,
'wind_speed' => $this->wind_speed,
'localtime_epoch' => $this->localtime_epoch
]);
}
}