Support the ongoing development of Laravel.io →
Database Laravel
Last updated 2 years ago.
0

for now I worked around with

DB::table('host_armory')->get();

But I would like to let my answer open: Should it be like this or is there a solution?

Thanks :)

Last updated 5 years ago.
0
moderator Solution

First the explanation why it does a select on host_armories from the documentation:

By convention, the "snake case", plural name of the class will be used as the table name unless another name is explicitly specified.

See: https://laravel.com/docs/5.7/eloquent#defining-models (table names)

You can overwrite it on your model class by adding the table variable.


use Illuminate\Database\Eloquent\Model;

class HostArmory extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'host_armory';
} 

Last updated 5 years ago.
0

Thanks a lot! :)

0

You can try something like this.

set @SQLQuery = 'update ' +@tablename+ ' set Flag1 = ''new'' where [Flag1] = '+@flag1+' AND Flag1 IN (SELET TOP 200 Flag1 FROM ' +@tablename+ 'WHERE [Flag1] = '+@flag1+')';

Last updated 5 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Fibo zer0byzer0 Joined 26 Nov 2018

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.

© 2024 Laravel.io - All rights reserved.