Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

madsem's avatar

Laravel 5.5 looking for table named "software" instead of expected "softwares"

I named my model Software, database table "softwares", set up relationships like:

class Software extends Model
{
    use SoftDeletes;

    protected $guarded = ['id'];

    protected $connection= 'mysql2';

    protected $table = 'softwares';

    function categories()
    {
        return $this->belongsToMany(Category::class)->withTimestamps();
    }

    function screenshots()
    {
        return $this->hasMany(Screenshot::class);
    }

    function review()
    {
        return $this->belongsTo(Review::class);
    }
}

But Laravel was looking for a table named "software", only after I changed the table name property it worked.

Was there a change to how Laravel pluralizes words? Because expected would have been that it looks for a table "softwares"?

0 likes
4 replies
austenc's avatar
austenc
Best Answer
Level 10

Hi there @madsem! Laravel is actually doing the correct thing here because the word "software" is what is known as an uncountable noun -- aka it has no plural form.

So as far as Laravel is concerned, software is the plural form. That's what I'd recommend using for your table name. Cheers!

1 like
madsem's avatar

Alright, thanks @austenc I did not know that Laravel is THAT smart :) As non-english native speaker, is there a recommended way to find out how Laravel would look for a table, instead of finding out after the fact? :D

austenc's avatar

@madsem Great question! One option might be using the artisan tinker command and then using str_plural('example') as I believe that's what Laravel uses internally to get these table names. str_plural should work for you! Beyond that... most words should be simply an s or ies in English

Please or to participate in this conversation.