How do I write to the console from a Laravel Controller

0 votes

So I have a Laravel controller:

class YeahMyController extends BaseController {
    public function getSomething() {
        Console::info('mymessage'); // <-- what do I put here?
        return 'yeahoutputthistotheresponse';
    }
}

Currently, I'm running the application using artisan (which runs PHP's built-in development web server under the hood):

php artisan serve

I would like to log console messages to the STDOUT pipe for the artisan process.

Aug 11, 2020 in Laravel by kartik
• 37,510 points
6,886 views

1 answer to this question.

0 votes

Hello @kartik,

This can be done with the following PHP function:

error_log('Some message here.');

Hope this is helpfull!!
Thank You!

answered Aug 11, 2020 by Niroj
• 82,880 points

Related Questions In Laravel

0 votes
1 answer

How Can I Set the Default Value of a Timestamp Column to the Current Timestamp with Laravel Migrations?

Hello, To create both of the created_at and updated_at columns: $t->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP')); $t->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP on update ...READ MORE

answered Apr 2, 2020 in Laravel by Niroj
• 82,880 points
11,459 views
0 votes
1 answer

How do I include partials from a blade layout in laravel?

Hello @kartik, You need to give the full ...READ MORE

answered Nov 2, 2020 in Laravel by Niroj
• 82,880 points
3,754 views
0 votes
1 answer

How do I set up phpMyAdmin on a Laravel Homestead box?

Hello, Step 1: Go to the phpMyAdmin website, download the latest ...READ MORE

answered Mar 31, 2020 in Laravel by Niroj
• 82,880 points
6,806 views
0 votes
1 answer

How do you get the path to the Laravel Storage folder?

Hello @kartik, In Laravel 3, call path('storage'). In Laravel 4, ...READ MORE

answered Sep 11, 2020 in Laravel by Niroj
• 82,880 points
9,091 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,880 points
21,750 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,880 points
2,647 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,880 points
2,504 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,880 points
41,371 views
0 votes
1 answer

How do I write to the console from a Laravel Controller?

Hello @kartik, This can be done with the ...READ MORE

answered Oct 29, 2020 in Laravel by Niroj
• 82,880 points
532 views
0 votes
1 answer

How can I serve a single HTML page from the Laravel public folder without having to use the .html extension?

Hello @kartik, You may rename the test folder ...READ MORE

answered Nov 12, 2020 in Laravel by Niroj
• 82,880 points
5,051 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP