mardi 8 novembre 2022

laravel log debug is not working.I checked A response is returned from the server side

laravel log debug is not working.

I create app with laravel5 and vue.js.

I send a request to the server side with vue and catch this with laravel Controller.php.

I code Log::debug to PostsController.php, but the log is not written in laravel.log.

I try use Illuminate\Support\Facades\Log; and use Log; , but both are not working.

Do you find anything wrong with my code?

Thank you for your help.

// web.php

Route::get('/posts/items', 'PostsController@items');
PostsController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Http\Response;
use App\Model\Post;
use App\Model\Item;
// use Log;
use Illuminate\Support\Facades\Log;

use App\Http\Resources\Post as PostResource;
use App\Http\Resources\Item as ItemResource;

class PostsController extends Controller
{

    public function items(Request $request)
    {
        Log::info('kita');
        Log::debug('kurukao');
        logger()->debug('debug');

        $post_id = $request->input('post_id');
        return $post_id;
    }

//vue


    methods: {
      mouseenter(id) {
        this.itemId = id;
      },
      mouseleave(id) {
        this.itemId = null;
      },
      getItems() {
        axios.get("/posts/items", {
            post_id: this.$route.params.id
        })
        .then((res) => {
        //   console.log(res.data)
          console.log('ok')
          this.postDataList = res.data.data;
        //   console.log(this.postDataList)
          if(this.postDataList != null){
            this.itemDataList = this.postDataList[0]['items'];
          }
        });
      },


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire