Giter Club home page Giter Club logo

Comments (11)

lewisoc avatar lewisoc commented on August 12, 2024

I'm also getting this error. Any updates?

from laravel-blog.

mercuryseries avatar mercuryseries commented on August 12, 2024

In order to resolve this issue you have to:

  1. First, rollback your previous migration.
  2. Then, update the migration file present in this folder vendor\fbf\laravelblog\src\migrations
    just add this line:
$table->dateTime('deleted_at')->nullable();
  1. After that run: php artisan migrate --package=fbf/laravel-blog
  2. Then in vendor\fbf\laravel-blog\src\models\Post.php
    add this line after the namespace declaration:
use Illuminate\Database\Eloquent\SoftDeletingTrait;

And also in the same file add this two lines like that:

class Post extends \Eloquent {

    use SoftDeletingTrait;
    protected $dates = ['deleted_at'];

    ....

You should now have something like that:

<?php namespace Fbf\LaravelBlog;

use Illuminate\Database\Eloquent\SoftDeletingTrait;

class Post extends \Eloquent {

    use SoftDeletingTrait;
    protected $dates = ['deleted_at'];

    /**
     * Status values for the database
     */
    const DRAFT = 'DRAFT';
    const APPROVED = 'APPROVED';
        ....

Now you can run php artisan db:seed --class="Fbf\LaravelBlog\PostTableFakeSeeder" without problem.

Let me know if that resolve your issue. Thanks

from laravel-blog.

nevrending avatar nevrending commented on August 12, 2024

Was having the same problem
Did the above
It works!

Thanks 👍

from laravel-blog.

mercuryseries avatar mercuryseries commented on August 12, 2024

You're welcome !

from laravel-blog.

singhjay avatar singhjay commented on August 12, 2024

After doing the above, I'm getting:

[Illuminate\Database\QueryException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel.fbf_blog
_posts' doesn't exist (SQL: delete from fbf_blog_posts)

[PDOException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel.fbf_blog
_posts' doesn't exist

from laravel-blog.

mercuryseries avatar mercuryseries commented on August 12, 2024

@singhjay It seems that you are trying to delete a table that doesn't exists.
Maybe you have manually deleted this table without using migrations.

If possible, run this command php artisan migrate:reset in order to make a reset of your migrations.
After that, you can follow the process described above.

If you still have some issues, you can manually delete all the tables in your database, run php artisan migrate and follow the process described above.

from laravel-blog.

singhjay avatar singhjay commented on August 12, 2024

I didn't create the tables in the first place it seems and I was trying to run the command without noticing. After creating the tables and trying to seed the file, I'm getting:

[BadMethodCallException]
Call to undefined method Illuminate\Database\Query\Builder::withTrashed()

Should I just try everything all over again from scratch?

I'm running Laravel 4.2 by the way on an ec2 instance and when using composer, I used

{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"laravel/framework": "4.2.*",
"fbf/laravel-blog": "0.7.0"
},
"autol

....

in composer.json

from laravel-blog.

mercuryseries avatar mercuryseries commented on August 12, 2024

@singhjay You just have to follow the steps that I have described above if you got this error [BadMethodCallException]
Call to undefined method Illuminate\Database\Query\Builder::withTrashed()

from laravel-blog.

singhjay avatar singhjay commented on August 12, 2024

Thank you for your time, it worked.

from laravel-blog.

mercuryseries avatar mercuryseries commented on August 12, 2024

@singhjay You're welcome!

from laravel-blog.

ziazon avatar ziazon commented on August 12, 2024

Can we expect to see this fix in a future release? would suck to not be able to update the package because of this...

from laravel-blog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.