Laravel Api tracks are not loading. 404 Not Found

For reference, I worked with this tutorial https://scotch.io/tutorials/build-a-time-tracker-with-laravel-5-and-angularjs-part-2 .

I wanted to get acquainted with laravel 5, since earlier I used only 4 and found the above tutorial, which was also mixed with a little angular js. I followed part one and two of the writing tutorials and created the database using mysql and phpmyadmin as indicated.

I get to the section, on the half of which the group route with the api prefix is โ€‹โ€‹configured to pull the data from the database and display it in the view.

// app/Http/routes.php

 ...

// A route group allows us to have a prefix, in this case api
Route::group(array('prefix' => 'api'), function()
{
    Route::resource('time', 'TimeEntriesController');
    Route::resource('users', 'UsersController');
});

, , , . , " , 404 ( )", time-tracker-2/public/api/time.

, userdata

// app/Http/Controllers/TimeEntriesController.php

...

use App\Http\Requests;
use App\Http\Controllers\Controller;    
use App\TimeEntry;

use Illuminate\Support\Facades\Request;

class TimeEntriesController extends Controller {

    // Gets time entries and eager loads their associated users
    public function index()
    {
        $time = TimeEntry::with('user')->get();

        return $time;
    }


// app/Http/Controllers/UsersController.php

...

use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\User;

use Illuminate\Http\Request;

class UsersController extends Controller {

    // Gets all users in the users table and returns them
    public function index()
    {
        $users = User::all();

        return $users;
    }

Laravel, angular, , - . , , . , - , .

, .

+4
1

, . URL time-tracker-2/public/api/time, time-tracker-2/api/time. 404.

+3

Source: https://habr.com/ru/post/1606610/


All Articles