categories seeder added
This commit is contained in:
parent
e8b3ede1d0
commit
baf21f3ca9
|
|
@ -44,7 +44,7 @@ public function postTicket(TicketRequest $request){
|
|||
$ticket = new Ticket($request->only('content', 'title'));
|
||||
$client = $request->user();
|
||||
$ticket['client_id'] = $client->id;
|
||||
$status = Status::where('name', 'LIKE', '%' . 'open' . '%')->firstOrFail();
|
||||
$status = Status::where('name', 'LIKE', '%' . 'Open' . '%')->firstOrFail();
|
||||
$ticket['status_id'] = $status->id;
|
||||
$ticket->save();
|
||||
|
||||
|
|
|
|||
|
|
@ -4,10 +4,12 @@
|
|||
|
||||
use Backpack\CRUD\app\Models\Traits\CrudTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
|
||||
|
||||
class Category extends Model
|
||||
{
|
||||
use CrudTrait;
|
||||
use HasTranslations;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
@ -20,10 +22,13 @@ class Category extends Model
|
|||
// public $timestamps = false;
|
||||
protected $guarded = ['id'];
|
||||
protected $fillable = [
|
||||
'name_en', 'name_tm', 'name_ru'
|
||||
'name'
|
||||
];
|
||||
// protected $hidden = [];
|
||||
// protected $dates = [];
|
||||
protected $translatable = [
|
||||
'name'
|
||||
];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -4,5 +4,8 @@
|
|||
"username": "root",
|
||||
"password": "root"
|
||||
}
|
||||
},
|
||||
"github-oauth": {
|
||||
"github.com": "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"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "file:///C:/MAMP/htdocs/legalization/legalization/CRUD-5.zip",
|
||||
"url": "file://C:/MAMP/htdocs/birzha-legalizasia/CRUD-5.zip",
|
||||
"reference": "4539c787a2e052d2e2e2c00188c38432dc2a7ea9",
|
||||
"shasum": ""
|
||||
},
|
||||
|
|
|
|||
|
|
@ -15,9 +15,7 @@ public function up()
|
|||
{
|
||||
Schema::create('categories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name_en');
|
||||
$table->string('name_ru');
|
||||
$table->string('name_tm');
|
||||
$table->text('name');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\Category;
|
||||
|
||||
class CategorySeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Category::truncate();
|
||||
|
||||
$categories = [
|
||||
['name' => 'Bug report'],
|
||||
['name' => 'Application issue'],
|
||||
['name' => 'Other'],
|
||||
];
|
||||
|
||||
foreach ($categories as $key => $value) {
|
||||
Category::create($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -18,7 +18,8 @@ public function run()
|
|||
$this->call([
|
||||
SettingsSeeder::class,
|
||||
CountrySeeder::class,
|
||||
StatusSeeder::class
|
||||
StatusSeeder::class,
|
||||
CategorySeeder::class
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,8 +18,12 @@ public function run()
|
|||
Status::truncate();
|
||||
|
||||
$statuses = [
|
||||
['name' => 'Garaşylýar', 'color' => 'yellow'],
|
||||
['name' => 'Ýapyk', 'color' => 'green']
|
||||
['name' => 'Open', 'color' => 'yellow'],
|
||||
['name' => 'Closed', 'color' => 'green']
|
||||
];
|
||||
|
||||
foreach ($statuses as $key => $value) {
|
||||
Status::create($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1063,6 +1063,174 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/api/categories": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Resources"
|
||||
],
|
||||
"summary": " - Get categories list for ticketing questions",
|
||||
"operationId": "564aa61702ec5a6b97507a0505ef1tgh",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "X-Localization",
|
||||
"in": "header",
|
||||
"description": "Localization",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"examples": {
|
||||
"ru": {
|
||||
"summary": "Russian localization",
|
||||
"value": "ru"
|
||||
},
|
||||
"en": {
|
||||
"summary": "English localization",
|
||||
"value": "en"
|
||||
},
|
||||
"tm": {
|
||||
"summary": "Turkmen localization",
|
||||
"value": "tm"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/ticket/my-tickets": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Tickets"
|
||||
],
|
||||
"summary": " - Get client tickets",
|
||||
"operationId": "3dfdd9308e24af6164e9a9235d383bbb",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "X-Localization",
|
||||
"in": "header",
|
||||
"description": "Localization",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"examples": {
|
||||
"ru": {
|
||||
"summary": "Russian localization",
|
||||
"value": "ru"
|
||||
},
|
||||
"en": {
|
||||
"summary": "English localization",
|
||||
"value": "en"
|
||||
},
|
||||
"tm": {
|
||||
"summary": "Turkmen localization",
|
||||
"value": "tm"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearerAuth": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/ticket/post-ticket": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"Tickets"
|
||||
],
|
||||
"summary": " - Create new ticket",
|
||||
"operationId": "24acefdf33a7a299d4773103cb6626fe",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "X-Localization",
|
||||
"in": "header",
|
||||
"description": "Localization",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"examples": {
|
||||
"ru": {
|
||||
"summary": "Russian localization",
|
||||
"value": "ru"
|
||||
},
|
||||
"en": {
|
||||
"summary": "English localization",
|
||||
"value": "en"
|
||||
},
|
||||
"tm": {
|
||||
"summary": "Turkmen localization",
|
||||
"value": "tm"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"properties": {
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"content": {
|
||||
"type": "string"
|
||||
},
|
||||
"category_id": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"example": {
|
||||
"content": "ilmedovamahri@gmail.com",
|
||||
"title": "hello",
|
||||
"category_id": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Successful created",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not found",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearerAuth": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/ticket/ticket-messages": {
|
||||
"get": {
|
||||
"tags": [
|
||||
|
|
@ -1199,131 +1367,6 @@
|
|||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/ticket/my-tickets": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"Tickets"
|
||||
],
|
||||
"summary": " - Get client tickets",
|
||||
"operationId": "3dfdd9308e24af6164e9a9235d383bbb",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "X-Localization",
|
||||
"in": "header",
|
||||
"description": "Localization",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"examples": {
|
||||
"ru": {
|
||||
"summary": "Russian localization",
|
||||
"value": "ru"
|
||||
},
|
||||
"en": {
|
||||
"summary": "English localization",
|
||||
"value": "en"
|
||||
},
|
||||
"tm": {
|
||||
"summary": "Turkmen localization",
|
||||
"value": "tm"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearerAuth": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/ticket/post-ticket": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"Tickets"
|
||||
],
|
||||
"summary": " - Create new ticket",
|
||||
"operationId": "24acefdf33a7a299d4773103cb6626fe",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "X-Localization",
|
||||
"in": "header",
|
||||
"description": "Localization",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"examples": {
|
||||
"ru": {
|
||||
"summary": "Russian localization",
|
||||
"value": "ru"
|
||||
},
|
||||
"en": {
|
||||
"summary": "English localization",
|
||||
"value": "en"
|
||||
},
|
||||
"tm": {
|
||||
"summary": "Turkmen localization",
|
||||
"value": "tm"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"properties": {
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"content": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"example": {
|
||||
"content": "ilmedovamahri@gmail.com",
|
||||
"title": "hello"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Successful created",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not found",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearerAuth": []
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
|
|
|
|||
Loading…
Reference in New Issue