I've installed the Dashboard addon 2.0. and tried to run the Dashboard demo Inputs example. But when adding it to the App.php, to run it. The page doesn't load, instead echoing "Something went wrong".
Something went Wrong error, when adding InputsBoard to App.php
There is also a potentially related problem that when I click the Dealhack Board, the loading icon appears, but the page doesn't load to that board.
Loading icon, when clicking 2nd Board in menu, loads infinitely, but remains on Payments Board page
Working Table Example, without InputsBoard in App.php
App.php Code for reference
<?php
//App.php
use \koolreport\dashboard\Application;
use \koolreport\dashboard\pages\Login;
use \koolreport\dashboard\User;
class App extends Application
{
protected function dashboards()
{
//$user = $request->user();
//if($user->hasRole("Sales")){
// return [
// "Sale"=>SaleBoard::create(),
// //"Sale"=>SaleBoard::create()->enabled(function($request){
// //$user = $request->user();
// //if($user->hasRole("Sales"))
// //{
// //return true;
// //}
// //return false;
// //}),
// ];
//}
//else{
// return [
// "Payments Board"=>PaymentBoard::create(),
// "Claims Board"=>ClaimsBoard::create(),
// ];
//}
return [
"Payments Board"=>PaymentBoard::create(),
"Dealhack Board"=>DealhackBoard::create(),
// "Input Board"=>InputBoard::create(), //INPUT BOARD WHICH CAUSES ERROR WHEN UNCOMMENTED
// "Claims Board"=>ClaimsBoard::create(),
// "Order Board"=>OrderBoard::create(),
// "Product Board"=>ProductBoard::create(),
// "Claims by Region"=>ClaimRegionBoard::create(),
// "SoPro Mailing"=>SoProBoard::create(),
];
}
protected function login()
{
return Login::create()
->authenticate(function($username,$password){
//if($username===admin@example.com && $password==="admin_password")
//{
// // If authenticated, return User object
// return User::create()
// ->id(1)
// ->name("Admin")
// ->avatar("avatars/8.jpg")
// ->roles(["admin"]);
//}
//else
//{
$users = explode("\n", file_get_contents('users.php'));
if (!$users){
//die('Cannot find users list!');
return null;
}
unset($users[0]);
//echo $users[1];
// prepare users list and redirects
$LOGIN_INFORMATION = array();
$ROLES_INFORMATION = array();
$ID_INFORMATION = array();
$i=0;
foreach ($users as $userdetail) {
$pos = strpos($userdetail, ",");
if ($pos <> false) {
$u = explode(',',$userdetail);
if(trim($u[0]) == $username) {
$i=1;
}
$LOGIN_INFORMATION[trim($u[0])] = trim($u[1]);
$ROLES_INFORMATION[trim($u[0])] = trim($u[4]);
$ID_INFORMATION[trim($u[0])] = trim($u[3]);
}
//echo "0=" . trim($u[0]) . " 1=" . trim($u[1]);
}
if ($i > 0){
if($LOGIN_INFORMATION[$username]==$password)
{
return User::create()
->id($ID_INFORMATION[trim($u[0])])
->name($username)
->avatar("avatars/8.jpg")
->roles([$ROLES_INFORMATION[trim($u[0])]]);
//echo "Completed match";
}
else{
return null;
}
}
else
{
return null;
}
//}
// If unauthenticated, return null
//return null;
});
}
}
?>