I'm new to Lumen and Laravel, but I have to write a REST API using Lumen. I've set up a controller and I'm having a problem using the logger. I've followed the documentation: Lumen docs
This is my controller app/Http/Controllers/DocumentsController.php:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Log;
class DocumentsController extends Controller
{
public function index()
{
Log::info('test');
return response()->json(['result' => 'Oh hey!']);
}
}
If I run this I'm getting an error saying:
FatalErrorException in DocumentsController.php line 22: Class 'Log' not found
So there seems to be something wrong with the Log facade (not quite sure how those work yet in Laravel/Lumen).
But if I change the Log::info() call, to manually pull the log service out of the DI container then it works:
$app = app();
$app->make('log')->info('test');
Any ideas as to why the facade method as described in the official documentation isn't working?