I am testing Laravel webform and having a problem when modifying the code. I have a customer list that shows all the added customers. I can create new customers, make them active or Inactive and submit. But now I am unable to navigate to the customer list page which is also an index page. Below is where I get error every time. I need help from you.
D:\wsPHP\blog\app\Customer.php
namespace App;
use Illuminate\Database\Eloquent\Model;
use App\company;
use App\Customer;
class Customer extends Model
{
//Allow mass assignment
//protected $fillable = ['name','email', 'mobile', 'active'] ;
//Guarded
protected $guarded =[];//Nothing is guarded when empty array, opposite of fillable
protected $attribute =['$active'=>0,]; //default attribute
public function getActiveAttribute($attribute){
return [0=>'Inactive',1=>'Active',][$attribute];
}
public function scopeActive($query)
{
return $query->where('active',1);
}
public function scopeInactive($query)
{
return $query->where('active',0);
}
public function company()
{
return $this->belongsTo(company::class);
}
}
Arguments
"Undefined index: disabled (View: D:\wsPHP\blog\resources\views\customers\index.blade.php)"
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire