G
G
GrimJack2017-01-03 12:06:14
Laravel
GrimJack, 2017-01-03 12:06:14

Why is post from telegram not processed?

According to the server logs, I see that the message is coming, but the server responds with a 500 error. Laravel log is empty for some reason.
In routes/web.php In app/Http/Controllers/TelegramController.php
Route::resource('telegram', 'TelegramController');

<?php

namespace App\Http\Controllers;

use Storage;
use Illuminate\Http\Request;

class TelegramController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        Storage::disk('local')->put('file.txt', 'Contents');
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        Storage::disk('local')->put('file.txt', 'Contents');
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }
}

There are no problems in the line with saving the file - it works correctly (I checked it on another controller).
In access.log it is (error log is empty):
149.154.167.204 - - [03/Jan/2017:12:05:26 +0300] "POST /telegram HTTP/1.0" 500 17121 "-" "-"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel, 2017-01-03
@GrimJack

Each post must contain _token - CSRF
App\Http\MiddlewareVerifyCsrfToken - here specify the routes that will ignore the filter

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question