dimanche 31 décembre 2017

Laravel 5: Action not defined

I searched a little on the internet, I found some topics that spoke about this, but none about my problem specifically.

So my error:

Action App\Http\Controllers\Users@index not defined.

The controller Users:

<?php
namespace App\Http\Controllers;

use Illuminate\Routing\UrlGenerator;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Input;
use App\Models\Users;
use Session;
use Validator;

    class Users extends Controller {

     protected $users;


     public function __construct(Users $users)
     {
             $this->users = $users;
     }

    public function index()
    {
        $data['limit']=$limit;
        $data['title']='Liste des Utilisateurs';

        $data['result']=$this->user->user_list($limit);

        return view('user_list', $data);
    }

The routes:

Route::get('users/{limit?}', function($limit = 0, Request $request)
{
  if(Auth::check()){
    return redirect()->action('Users@index');
  }else{
    $request->session()->flash('message', 'Vous devez vous connecter avant de pouvoir accéder à la plateforme.');
    return redirect('login');
  }
});

Best regards



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire