mardi 4 février 2020

Laravel Type error: Too few arguments to function Illuminate\Database\Eloquent\Model::setAttribute(), 1 passed in

i want to ask about error "Too few arguments to function Illuminate\Database\Eloquent\Model::setAttribute(), 1 passed "

this is my code :

Dataanggota.php

class Dataanggota extends Model
{
    protected $table;
    protected $primaryKey = "";
    protected $casts = ['cno' => 'string'];
    protected $guarded = [ ];

    public $incrementing = false;
    public $timestamps = false;

    public $rules = array();
    public $nicename = array();
    public function __construct(array $attributes = [])
    {
        parent::__construct($attributes);
        $this->table = config("consyst.dataanggota.table");
        $this->primaryKey=config('consyst.dataanggota.primary_key');
        $this->rules = array(
        );
      }

DataAnggotaControllers.php

public function insertBank()
    {
        // dd($this->request->cno);
        if ($this->request->ajax()) {
                try {
                    $metas = new Hubbank;
                    $metas->cno = $this->request->cno;
                    $metas->no_urut = $this->request->no_urut;
                    $metas->kdcab = $this->request->kdcab;
                    $metas->nm_bank = $this->request->nm_bank;
                    $metas->alternate = $this->request->alternate;
                    $metas->dari_tahun = $this->request->dari_tahun;
                    $metas->jns_produk = $this->request->jns_produk;
                    $metas->save();
                    return \Response::json(['status' => 99, 'msg' => 'Data has been Added']);
                } catch (\Exeception $e) {
                    return \Response::json(['status' => 0, 'msg' => 'Error Accoured!']);
                }
            } else {
                return \Response::view('errors.401');
            }
    }

This is error massage

FatalThrowableError in Model.php line 2870:
Type error: Too few arguments to function Illuminate\Database\Eloquent\Model::setAttribute(), 1 passed in 
C:\xampp\htdocs\project\consyst\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php on line 2878 and exactly 2 expected


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire