Logging update, Trying to get JS post to work
This commit is contained in:
parent
3ec04c090d
commit
1716443bf9
7 changed files with 642 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
|||
APP_NAME="Hoschis Tippspiel"
|
||||
APP_ENV=local
|
||||
APP_KEY=base64:skYbYLqiGeOCTWD7J9xHzAKgmwuTkknm9BLGinIgn88=
|
||||
APP_KEY=base64:1+1OyIuQj0id5SH2kBWdQoCDdmEqwGGHxkqtfJPLA00=
|
||||
APP_DEBUG=true
|
||||
APP_LOG_LEVEL=debug
|
||||
APP_URL=http://localhost
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ use App\Leagues\League;
|
|||
use App\Leagues\LeagueMember;
|
||||
use App\Leagues\Match;
|
||||
|
||||
use Illuminate\Support\Facades\Input;
|
||||
use Log;
|
||||
use DB;
|
||||
|
||||
|
|
@ -210,6 +211,28 @@ class LeaguesController extends Controller
|
|||
return view ('leagues.chart_swapform',compact('season', 'leagueNames', 'userNames','leagueScores','rankInfo','rank','cols'));
|
||||
}
|
||||
|
||||
public static function swapLeagueMembers(Request $request) {
|
||||
Log::info("Start: LeaguesController::swapLeagueMembers");
|
||||
Log::info("Method triggered successfully.");
|
||||
|
||||
Log::info($request->method()); // Klappt
|
||||
|
||||
$input=$request->input();
|
||||
Log::info("Params:".sizeof($input));
|
||||
foreach ($input as $key => $value) {
|
||||
Log::inf( $key."=>".$value );
|
||||
}
|
||||
Log::info($request->input('user1', 'not_set'));
|
||||
|
||||
//Log::info("Request-param:" . request('user1'));
|
||||
/*
|
||||
$user1_id=request('user1_id');
|
||||
$user2_id=request('user2_id');
|
||||
error_log("User1:".$user1_id);
|
||||
error_log("User2:".$user2_id);
|
||||
error_log()
|
||||
*/
|
||||
}
|
||||
|
||||
public static function showSingleUserMatches($userId) {
|
||||
$season = Season::getCurrent();
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'log' => env('APP_LOG', 'single'),
|
||||
'log' => env('APP_LOG', 'daily'),
|
||||
|
||||
'log_level' => env('APP_LOG_LEVEL', 'debug'),
|
||||
|
||||
|
|
|
|||
94
pfosten/config/logging.php
Normal file
94
pfosten/config/logging.php
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
<?php
|
||||
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Handler\SyslogUdpHandler;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option defines the default log channel that gets used when writing
|
||||
| messages to the logs. The name specified in this option should match
|
||||
| one of the channels defined in the "channels" configuration array.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('LOG_CHANNEL', 'stack'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log Channels
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the log channels for your application. Out of
|
||||
| the box, Laravel uses the Monolog PHP logging library. This gives
|
||||
| you a variety of powerful log handlers / formatters to utilize.
|
||||
|
|
||||
| Available Drivers: "single", "daily", "slack", "syslog",
|
||||
| "errorlog", "monolog",
|
||||
| "custom", "stack"
|
||||
|
|
||||
*/
|
||||
|
||||
'channels' => [
|
||||
'stack' => [
|
||||
'driver' => 'stack',
|
||||
'channels' => ['daily'],
|
||||
'ignore_exceptions' => false,
|
||||
],
|
||||
|
||||
'single' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => 'debug',
|
||||
],
|
||||
|
||||
'daily' => [
|
||||
'driver' => 'daily',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => 'debug',
|
||||
'days' => 14,
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'driver' => 'slack',
|
||||
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||
'username' => 'Laravel Log',
|
||||
'emoji' => ':boom:',
|
||||
'level' => 'critical',
|
||||
],
|
||||
|
||||
'papertrail' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => 'debug',
|
||||
'handler' => SyslogUdpHandler::class,
|
||||
'handler_with' => [
|
||||
'host' => env('PAPERTRAIL_URL'),
|
||||
'port' => env('PAPERTRAIL_PORT'),
|
||||
],
|
||||
],
|
||||
|
||||
'stderr' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => StreamHandler::class,
|
||||
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||
'with' => [
|
||||
'stream' => 'php://stderr',
|
||||
],
|
||||
],
|
||||
|
||||
'syslog' => [
|
||||
'driver' => 'syslog',
|
||||
'level' => 'debug',
|
||||
],
|
||||
|
||||
'errorlog' => [
|
||||
'driver' => 'errorlog',
|
||||
'level' => 'debug',
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
|
|
@ -87,6 +87,59 @@
|
|||
}
|
||||
}
|
||||
alert("Tauschen:\n"+selected_players.join("\n"));
|
||||
|
||||
xmlhttp=new XMLHttpRequest()
|
||||
|
||||
var formData=new FormData()
|
||||
//alert(inputElems[0].id);
|
||||
formData.append('user1',inputElems[0].id)
|
||||
formData.append('user2',inputElems[1].id)
|
||||
|
||||
|
||||
let params="user1=test&user2=test2"
|
||||
|
||||
xmlhttp.open("POST",'/league/swap')
|
||||
xmlhttp.setRequestHeader('Content-Type', 'application/json')
|
||||
xmlhttp.setRequestHeader('X-CSRF-Token', '{{ csrf_token() }}')
|
||||
|
||||
//xmlhttp.send(params)
|
||||
|
||||
xmlhttp.send(formData)
|
||||
|
||||
return;
|
||||
// For POST, we need a configuration object for the fetch call
|
||||
const update = {
|
||||
title: 'A blog post by Kingsley',
|
||||
body: 'Brilliant post on fetch API',
|
||||
userId: 1,
|
||||
};
|
||||
|
||||
console.log("Before stringify")
|
||||
const options = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRF-Token': '{{ csrf_token() }}'
|
||||
},
|
||||
body: JSON.stringify(update),
|
||||
};
|
||||
console.log(JSON.stringify(update))
|
||||
console.log("After stringify")
|
||||
|
||||
fetch('/league/swap', options)
|
||||
.then(data => {
|
||||
if (!data.ok) {
|
||||
throw Error(data.status);
|
||||
}
|
||||
return data.json();
|
||||
}).then(update => {
|
||||
console.log(update);
|
||||
}).catch(e => {
|
||||
console.log("There is some error")
|
||||
alert(e)
|
||||
console.log(e);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
<div class="lead">{{ $game->team1 }} : {{ $game->team2 }}</div>
|
||||
|
||||
<div >
|
||||
<div>
|
||||
<form method="POST" action="/tipps/store">
|
||||
{{ csrf_field() }}
|
||||
<div class="form-group">
|
||||
|
|
|
|||
469
tools/pfosten_2022-06-05_093059.sql
Normal file
469
tools/pfosten_2022-06-05_093059.sql
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue