I have tried just about every set of instructions I can find on setting up a Helper class in Laravel 5.0; but something is still wrong because neither the autoload route or the namespace route are working. I only get a message such as "Class 'KidFit\Helpers\Helper.php not found'
What I also don't understand, is that when I include "$helper = new Helper();" statement into my UserController.php class -- that causes the php code of Helper.php to just get dumped to the screen. I have included an example of that in the screen output below. I don't have 10 rep points, so it appears to just be a link.
Here is what I get: Wonky Screen Output
I have nothing setup inside of config/app.php or composer.json. However, these are the contents of Helpers/Helper.php:
<$php
namespace KidFit\Helpers;
class Helper
{
public function __construct()
{
}
public function dominic()
{
\Log::info("dominic was here");
}
}
and this is the code I have at the top of UserController.php, where I am using the Helper Class:
<?php namespace KidFit\Http\Controllers;
use KidFit\Http\Requests;
use KidFit\Http\Controllers\Controller;
use KidFit\User;
use KidFit\Games;
use KidFit\Helpers\Helper;
use Illuminate\Http\Request;
class UserController extends Controller {
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function getShow($userID)
{
$helper = new Helper();
\Log::info("Attempting to log data, DWayda");
$Group = new Games;
$Group->gameID = 4;
$helper->dominic();
//$Group->gameName = stripXSS("DROP TABLE user from KidFit_Secure;");
$todaysDate = date_create('now');
$todaysDate = date_format($todaysDate, 'Y-m-d');
$Group->createDate = $todaysDate;
$Group->metric = "SELECT * FROM users";
$Group->status = "hacked";
$Group->save();
return User::find($userID);
}
May I ask if I anyone can see what I am doing wrong? After my changes, I usually execute:
sudo composer dump-autoload
sudo composer install --no-dev --no-scripts
sudo composer install --no-dev -o
I've been stuck on this for 2 weeks now (working off & on...) Any help would e much appreciated!! =D
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2MdU6e9
via IFTTT
Aucun commentaire:
Enregistrer un commentaire