Merge branch 'dev'
This commit is contained in:
commit
d6808a8a41
|
|
@ -3,7 +3,9 @@
|
|||
namespace App\Http\Controllers\API;
|
||||
|
||||
use App\Http\Resources\CountryResource;
|
||||
use App\Http\Resources\CategoryResource;
|
||||
use App\Models\Country;
|
||||
use App\Models\Category;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class ResourceController extends Controller
|
||||
|
|
@ -13,4 +15,8 @@ public function countries(){
|
|||
return CountryResource::collection(Country::all());
|
||||
}
|
||||
|
||||
public function categories(){
|
||||
return CategoryResource::collection(Category::all());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,10 +41,10 @@ public function getTickets(Request $request){
|
|||
}
|
||||
|
||||
public function postTicket(TicketRequest $request){
|
||||
$ticket = new Ticket($request->only('content', 'title'));
|
||||
$ticket = new Ticket($request->only('content', 'title','category_id'));
|
||||
$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();
|
||||
|
||||
|
|
|
|||
|
|
@ -39,9 +39,7 @@ public function setup()
|
|||
*/
|
||||
protected function setupListOperation()
|
||||
{
|
||||
CRUD::column('name_en');
|
||||
CRUD::column('name_ru');
|
||||
CRUD::column('name_tm');
|
||||
CRUD::column('name');
|
||||
|
||||
/**
|
||||
* Columns can be defined using the fluent syntax or array syntax:
|
||||
|
|
@ -60,9 +58,7 @@ protected function setupCreateOperation()
|
|||
{
|
||||
CRUD::setValidation(CategoryRequest::class);
|
||||
|
||||
CRUD::field('name_en');
|
||||
CRUD::field('name_ru');
|
||||
CRUD::field('name_tm');
|
||||
CRUD::field('name');
|
||||
|
||||
/**
|
||||
* Fields can be defined using the fluent syntax or array syntax:
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ public function authorize()
|
|||
public function rules()
|
||||
{
|
||||
return [
|
||||
'category_id' => 'required',
|
||||
'title' => 'required',
|
||||
'content' => 'required',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -15,10 +15,8 @@ class CategoryResource extends JsonResource
|
|||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name_en' => $this->name_en,
|
||||
'name_ru' => $this->name_ru,
|
||||
'name_tm' => $this->name_tm
|
||||
'id' => $this->id,
|
||||
'name' => $this->name
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ class Ticket extends Model
|
|||
'client_id',
|
||||
'status_id',
|
||||
'title',
|
||||
'content'
|
||||
'content',
|
||||
'category_id'
|
||||
];
|
||||
// protected $hidden = [];
|
||||
// protected $dates = [];
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\Client;
|
||||
use App\Models\Account;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class ClientSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Client::truncate();
|
||||
|
||||
$account = Account::create([
|
||||
'country_id' => 1,
|
||||
'type' => 'business'
|
||||
]);
|
||||
|
||||
$client = [
|
||||
'firstname' => 'test',
|
||||
'lastname' => 'test',
|
||||
'email' => 'test@mail.com',
|
||||
'password' => Hash::make('123123123'),
|
||||
'is_verified' => true,
|
||||
'account_id' => $account->id
|
||||
];
|
||||
|
||||
Client::create($client);
|
||||
}
|
||||
}
|
||||
|
|
@ -18,7 +18,9 @@ public function run()
|
|||
$this->call([
|
||||
SettingsSeeder::class,
|
||||
CountrySeeder::class,
|
||||
StatusSeeder::class
|
||||
StatusSeeder::class,
|
||||
CategorySeeder::class,
|
||||
ClientSeeder::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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,9 @@
|
|||
Route::post('/forgot-password', [AuthController::class, 'sendPasswordResetLinkEmail']);
|
||||
Route::post('/verify-email', [AuthController::class, 'verifyEmail']);
|
||||
Route::get('/countries', [ResourceController::class, 'countries']);
|
||||
Route::get('/categories', [ResourceController::class, 'categories']);
|
||||
// Route::post('/prof',[AccountController::class,'storeProfileInfo']);
|
||||
Route::middleware(['auth.client','auth:api'])->group(function () {
|
||||
Route::middleware(['auth.client','auth:api', 'auth:sanctum'])->group(function () {
|
||||
/**
|
||||
* Client endpoints
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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