help desk crud

This commit is contained in:
merdan 2020-04-29 17:55:49 +05:00
parent 437f64debc
commit 0e3bd35b3e
5 changed files with 27 additions and 8 deletions

View File

@ -34,7 +34,12 @@ class HelpTicketCategoryCrudController extends CrudController
*/
// TODO: remove setFromDb() and manually define Fields and Columns
$this->crud->setFromDb();
// $this->crud->setFromDb();
$this->crud->setColumns([
['name' => 'title_tk','label'=>'Title Turkmen','type'=>'text'],
['name' => 'title_ru','label'=>'Title Russioan','type'=>'text'],
['name' => 'active', 'label' => 'Active', 'type' => 'check']
]);
// add asterisk for fields that are required in HelpTicletCategoryRequest
$this->crud->setRequiredFields(StoreRequest::class, 'create');

View File

@ -15,11 +15,11 @@ class HelpTicket extends Model
|--------------------------------------------------------------------------
*/
protected $table = 'help_ticlets';
protected $table = 'help_tickets';
// protected $primaryKey = 'id';
// public $timestamps = false;
// protected $guarded = ['id'];
protected $fillable = [];
protected $fillable = ['code','email','name','phone','text','subject', 'attachment','status','ticket_category_id'];
// protected $hidden = [];
// protected $dates = [];
@ -35,6 +35,13 @@ class HelpTicket extends Model
|--------------------------------------------------------------------------
*/
public function category(){
return $this->belongsTo(HelpTicketCategory::class,'ticket_category_id');
}
public function comments(){
return $this->hasMany(HelpTicketComment::class);
}
/*
|--------------------------------------------------------------------------
| SCOPES

View File

@ -15,11 +15,11 @@ class HelpTicketCategory extends Model
|--------------------------------------------------------------------------
*/
protected $table = 'help_ticlet_categories';
protected $table = 'help_ticket_categories';
// protected $primaryKey = 'id';
// public $timestamps = false;
public $timestamps = false;
// protected $guarded = ['id'];
protected $fillable = [];
protected $fillable = ['title_tk','title_ru','active'];
// protected $hidden = [];
// protected $dates = [];
@ -35,6 +35,9 @@ class HelpTicketCategory extends Model
|--------------------------------------------------------------------------
*/
public function tickets(){
return $this->hasMany(HelpTicket::class,'ticket_category_id');
}
/*
|--------------------------------------------------------------------------
| SCOPES

View File

@ -17,9 +17,9 @@ class HelpTicketComment extends Model
protected $table = 'help_ticket_comments';
// protected $primaryKey = 'id';
// public $timestamps = false;
public $timestamps = true;
// protected $guarded = ['id'];
protected $fillable = [];
protected $fillable = ['text','attachment','parent_id','user_id','name','help_ticket_id'];
// protected $hidden = [];
// protected $dates = [];
@ -35,6 +35,9 @@ class HelpTicketComment extends Model
|--------------------------------------------------------------------------
*/
public function ticket(){
return $this->belongsTo(HelpTicket::class);
}
/*
|--------------------------------------------------------------------------
| SCOPES

View File

@ -16,6 +16,7 @@ class CreateHelpTicketCategoriesTable extends Migration
$table->increments('id');
$table->string('title_tk');
$table->string('title_ru');
$table->boolean('active')->default(1);
});
}