Client added to login, admin panel finished

This commit is contained in:
ilmedova 2022-07-06 13:08:56 +05:00
parent 7da271d37b
commit e9f3fdfd38
8 changed files with 142 additions and 67 deletions

View File

@ -39,13 +39,7 @@ public function setup()
*/
protected function setupListOperation()
{
/**
* Columns can be defined using the fluent syntax or array syntax:
* - CRUD::column('price')->type('number');
* - CRUD::addColumn(['name' => 'price', 'type' => 'number']);
*/
$this->crud->setFromDb();
}
/**
@ -79,7 +73,23 @@ protected function setupCreateOperation()
'type' => 'upload',
'upload' => true,
'disk' => 'uploads', // if you store files in the /public folder, please ommit this; if you store them in /storage or S3, please specify it;
]
],
[
'name' => 'document_id',
'type' => 'select',
'label' => 'Document',
'entity' => 'document',
'model' => "App\Models\Document",
'attribute' => 'name_ru'
],
[
'name' => 'application_id',
'type' => 'select',
'label' => 'Application',
'entity' => 'application',
'model' => "App\Models\Application",
'attribute' => 'account_id'
],
]);
}

View File

@ -21,7 +21,7 @@ class DocumentCrudController extends CrudController
/**
* Configure the CrudPanel object. Apply settings to all operations.
*
*
* @return void
*/
public function setup()
@ -33,43 +33,66 @@ public function setup()
/**
* Define what happens when the List operation is loaded.
*
*
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
/**
* Columns can be defined using the fluent syntax or array syntax:
* - CRUD::column('price')->type('number');
* - CRUD::addColumn(['name' => 'price', 'type' => 'number']);
*/
$this->crud->setFromDb();
}
/**
* Define what happens when the Create operation is loaded.
*
*
* @see https://backpackforlaravel.com/docs/crud-operation-create
* @return void
*/
protected function setupCreateOperation()
{
CRUD::setValidation(DocumentRequest::class);
/**
* Fields can be defined using the fluent syntax or array syntax:
* - CRUD::field('price')->type('number');
* - CRUD::addField(['name' => 'price', 'type' => 'number']));
*/
$this->crud->addFields([
[
'name' => 'name_ru',
'type' => 'text',
'label' => 'Name ru'
],
[
'name' => 'name_en',
'type' => 'text',
'label' => 'Name en'
],
[
'name' => 'name_tm',
'type' => 'text',
'label' => 'Name tm'
],
[
'name' => 'description_ru',
'type' => 'textarea',
'label' => 'Description ru'
],
[
'name' => 'description_en',
'type' => 'textarea',
'label' => 'Description en'
],
[
'name' => 'description_tm',
'type' => 'textarea',
'label' => 'Description tm'
],
[
'name' => 'max_size',
'type' => 'text',
'label' => 'Max size'
]
]);
}
/**
* Define what happens when the Update operation is loaded.
*
*
* @see https://backpackforlaravel.com/docs/crud-operation-update
* @return void
*/

View File

@ -21,7 +21,7 @@ class DocumentgroupCrudController extends CrudController
/**
* Configure the CrudPanel object. Apply settings to all operations.
*
*
* @return void
*/
public function setup()
@ -33,24 +33,18 @@ public function setup()
/**
* Define what happens when the List operation is loaded.
*
*
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
/**
* Columns can be defined using the fluent syntax or array syntax:
* - CRUD::column('price')->type('number');
* - CRUD::addColumn(['name' => 'price', 'type' => 'number']);
*/
$this->crud->setFromDb();
}
/**
* Define what happens when the Create operation is loaded.
*
*
* @see https://backpackforlaravel.com/docs/crud-operation-create
* @return void
*/
@ -58,18 +52,48 @@ protected function setupCreateOperation()
{
CRUD::setValidation(DocumentgroupRequest::class);
/**
* Fields can be defined using the fluent syntax or array syntax:
* - CRUD::field('price')->type('number');
* - CRUD::addField(['name' => 'price', 'type' => 'number']));
*/
$this->crud->addField([
[
'name' => 'name_ru',
'type' => 'text',
'label' => 'Name ru'
],
[
'name' => 'name_en',
'type' => 'text',
'label' => 'Name en'
],
[
'name' => 'name_tm',
'type' => 'text',
'label' => 'Name tm'
],
[
'name' => 'description_ru',
'type' => 'textarea',
'label' => 'Description ru'
],
[
'name' => 'description_en',
'type' => 'textarea',
'label' => 'Description en'
],
[
'name' => 'description_tm',
'type' => 'textarea',
'label' => 'Description tm'
],
[
'name' => 'type',
'type' => 'text',
'label' => 'Type'
]
]);
}
/**
* Define what happens when the Update operation is loaded.
*
*
* @see https://backpackforlaravel.com/docs/crud-operation-update
* @return void
*/

View File

@ -21,7 +21,7 @@ class QuestionCrudController extends CrudController
/**
* Configure the CrudPanel object. Apply settings to all operations.
*
*
* @return void
*/
public function setup()
@ -33,24 +33,18 @@ public function setup()
/**
* Define what happens when the List operation is loaded.
*
*
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
/**
* Columns can be defined using the fluent syntax or array syntax:
* - CRUD::column('price')->type('number');
* - CRUD::addColumn(['name' => 'price', 'type' => 'number']);
*/
$this->crud->setFromDb();
}
/**
* Define what happens when the Create operation is loaded.
*
*
* @see https://backpackforlaravel.com/docs/crud-operation-create
* @return void
*/
@ -58,18 +52,23 @@ protected function setupCreateOperation()
{
CRUD::setValidation(QuestionRequest::class);
/**
* Fields can be defined using the fluent syntax or array syntax:
* - CRUD::field('price')->type('number');
* - CRUD::addField(['name' => 'price', 'type' => 'number']));
*/
CRUD::addFields([
[
'name' => 'question_text',
'type' => 'textarea',
'label' => 'Question text'
],
[
'name' => 'options',
'type' => 'text',
'label' => 'Options'
]
]);
}
/**
* Define what happens when the Update operation is loaded.
*
*
* @see https://backpackforlaravel.com/docs/crud-operation-update
* @return void
*/

View File

@ -90,7 +90,7 @@ public function login(Request $request){
$tokenResult = $client->createToken('auth_token');
// return token in json response
return response()->json(['success' => ['token' => $tokenResult]], 200);
return response()->json(['success' => ['token' => $tokenResult, 'client' => $client]], 200);
}
return response()->json(['error' => ['message' => 'email not found']], 404);
}

View File

@ -19,7 +19,15 @@ class Document extends Model
// protected $primaryKey = 'id';
// public $timestamps = false;
protected $guarded = ['id'];
// protected $fillable = [];
protected $fillable = [
'name_ru',
'name_tm',
'name_en',
'description_ru',
'description_en',
'description_tm',
'max_size'
];
// protected $hidden = [];
// protected $dates = [];

View File

@ -19,7 +19,15 @@ class Documentgroup extends Model
// protected $primaryKey = 'id';
// public $timestamps = false;
protected $guarded = ['id'];
// protected $fillable = [];
protected $fillable = [
'name_en',
'name_ru',
'name_tm',
'description_ru',
'description_tm',
'description_en',
'type'
];
// protected $hidden = [];
// protected $dates = [];

View File

@ -19,7 +19,10 @@ class Question extends Model
// protected $primaryKey = 'id';
// public $timestamps = false;
protected $guarded = ['id'];
// protected $fillable = [];
protected $fillable = [
'question_text',
'options'
];
// protected $hidden = [];
// protected $dates = [];