uasoft-indonesia / badaso

Laravel Vue headless CMS / admin panel / dashboard / builder / API CRUD generator, anything !
https://badaso.uatech.co.id
MIT License
1.21k stars 224 forks source link

Unable to use a php trait with parameter(s) in a crud with a model #1026

Closed Dri372 closed 10 months ago

Dri372 commented 1 year ago

Version : 2.9.4

Steps to reproduce

• 1-Create the badaso table t1026s with an additional text field f1
• 2-Create this php trait
      namespace App\Traits;
trait T1026t {
    public function f0() {}
    public function f1($v1) {}
    public function fct1($v1) {}
    public function f2($v1,$v2) {}
}
• 3-Create the model T1026
namespace App\Models;

use App\Traits\T1026t;
use Eloquent as Model;

class T1026 extends Model
{
    use T1026t;
    public $table = 't1026s';
}
• 4-Create the basdaso Crud on the table using the model

• You get this error :
  local.ERROR: Too few arguments to function App\Models\T1026::fct1(), 0 passed in .../vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php on line 585 and exactly 2 expected {"userId":1,"exception":"[object] (ArgumentCountError(code: 0): Too few arguments to function App\\Models\\T1026::f2(), 0 passed in /var/www/html/Badaso/Bon/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php on line 585 and exactly 2 expected at /var/www/html/Badaso/Bon/app/Traits/T1026t.php:12)
• same error on f2 if you comment fct1 in the trait
stale[bot] commented 10 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.