Skip to content

Instantly share code, notes, and snippets.

@Sairahcaz
Last active February 2, 2023 09:01
Show Gist options
  • Select an option

  • Save Sairahcaz/a3091060661d5b14e758f56795a84361 to your computer and use it in GitHub Desktop.

Select an option

Save Sairahcaz/a3091060661d5b14e758f56795a84361 to your computer and use it in GitHub Desktop.
<?php
use LaracraftTech\LaravelUsefulTraits\UsefulScopes;
DB::table('scope_test_table')->insert([
'foo' => 'foo',
'bar' => 'bar',
'quz' => 'quz',
]);
$class = new class extends Model
{
use UsefulScopes;
protected $table = 'scope_test_table';
};
$class::query()->selectAllBut(['foo'])->first()->toArray();
// return ['bar' => 'bar', 'quz' => 'quz']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment