Support the ongoing development of Laravel.io →
Database Eloquent

Paste: http://laravel.io/bin/9vvxv

php artisan tweek

Tweet::first() PHP Fatal error: Class 'Tweet' not found in eval()'d code on line 1 use \ComdexxSolutions\Models\Tweet; => false Tweet::first() string(30) "select * from tweets limit 1" => <ComdexxSolutions\Models\Tweet #000000003887eebf000000000bd3633b> { id: 2, title: "Test Title", body: "A body goes here if even I care.", created_at: "2015-06-05 20:59:26", updated_at: "2015-06-05 20:59:26" }

routes.php

Route::get('tweets/json', function() {
    return Tweet::first();
});

/ComdexxSolutions/Models/Tweet.php

<?php namespace ComdexxSolutions\Models; use \ComdexxSolutions\Models\BaseModel; class Tweet extends BaseModel { // } ## BaseModel.php <?php namespace ComdexxSolutions\Models; class BaseModel extends \Eloquent { public function update(array $attributes = []) { $class = get_class($this); $path = "ComdexxSolutions\\Services\\Validation\\{$class}Validator"; if (class_exists($path)) { App::make($path)->validateForUpdate($attributes); } parent::update($attributes); } } ##Error ## Illuminate \ Database \ Eloquent \ ModelNotFoundException HELP No query results for model [ComdexxSolutions\Models\Tweet].
Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.