Laravel cannot find class

I am learning Laravel, but some things are not how they suggest I think. When I try to add something to the database using a model (model has table name). I am getting the error:

FatalErrorException in folder C: \ wamp \ www \ app \ Http \ Controllers \ blog.php 23:

Class 'App \ models \ posts' not found

This is the mij blog.php:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use View;
use App\models\posts;
use App\Http\Controllers\Controller;



    class blog extends Controller
    {
       public function newPost() 
       {
          return View::make('new');
       }

       public function createPost() 
       {
            $posts = new posts();
            $posts->title = Input::get('title');
            $posts->content = nl2br(Input::get('content'));
            $posts->save();
           // return Redirect::route('viewpost',array('id' => $post->id));
       }
    }

      

So my message class is located in the App \ models folder. Why is laravel telling me it can't find it? When I create an object inside php artisan and add things it got good in the database.

+3


source to share





All Articles