localization enhancements added
This commit is contained in:
parent
18ca914289
commit
e56c8577c4
|
|
@ -3,9 +3,11 @@
|
|||
namespace App\Http\Controllers\API;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\API\TicketRequest;
|
||||
use App\Http\Resources\MessageResource;
|
||||
use App\Http\Resources\TicketResource;
|
||||
use App\Models\Message;
|
||||
use App\Models\Status;
|
||||
use App\Models\Ticket;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
|
@ -146,4 +148,53 @@ public function getTickets(Request $request){
|
|||
return TicketResource::collection($tickets);
|
||||
}
|
||||
|
||||
/**
|
||||
* @OA\POST(
|
||||
* path="/api/ticket/post-ticket",
|
||||
* summary=" - Create new ticket",
|
||||
* tags = {"Tickets"},
|
||||
* security={
|
||||
* {"bearerAuth": {}}
|
||||
* },
|
||||
* @OA\RequestBody(
|
||||
* @OA\MediaType(
|
||||
* mediaType="application/json",
|
||||
* @OA\Schema(
|
||||
* @OA\Property(
|
||||
* property="title",
|
||||
* type="string",
|
||||
* ),
|
||||
* @OA\Property(
|
||||
* property="content",
|
||||
* type="string",
|
||||
* ),
|
||||
* example={"content": "ilmedovamahri@gmail.com", "title":"hello"}
|
||||
* )
|
||||
* )
|
||||
* ),
|
||||
* @OA\Parameter(
|
||||
* description="Localization",
|
||||
* in="header",
|
||||
* name="X-Localization",
|
||||
* required=false,
|
||||
* @OA\Schema(type="string"),
|
||||
* @OA\Examples(example="ru", value="ru", summary="Russian localization"),
|
||||
* @OA\Examples(example="en", value="en", summary="English localization"),
|
||||
* @OA\Examples(example="tm", value="tm", summary="Turkmen localization"),
|
||||
* ),
|
||||
* @OA\Response(response=201, description="Successful created", @OA\JsonContent()),
|
||||
* @OA\Response(response=404, description="Not found", @OA\JsonContent()),
|
||||
* )
|
||||
*/
|
||||
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();
|
||||
$ticket['status_id'] = $status->id;
|
||||
$ticket->save();
|
||||
|
||||
return TicketResource::make($ticket);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,34 +53,14 @@ protected function setupCreateOperation()
|
|||
CRUD::setValidation(DocumentRequest::class);
|
||||
$this->crud->addFields([
|
||||
[
|
||||
'name' => 'name_ru',
|
||||
'name' => 'name',
|
||||
'type' => 'text',
|
||||
'label' => 'Name ru'
|
||||
'label' => 'Name'
|
||||
],
|
||||
[
|
||||
'name' => 'name_en',
|
||||
'type' => 'text',
|
||||
'label' => 'Name en'
|
||||
],
|
||||
[
|
||||
'name' => 'name_tm',
|
||||
'type' => 'text',
|
||||
'label' => 'Name tm'
|
||||
],
|
||||
[
|
||||
'name' => 'description_ru',
|
||||
'name' => 'description',
|
||||
'type' => 'textarea',
|
||||
'label' => 'Description ru'
|
||||
],
|
||||
[
|
||||
'name' => 'description_en',
|
||||
'type' => 'textarea',
|
||||
'label' => 'Description en'
|
||||
],
|
||||
[
|
||||
'name' => 'description_tm',
|
||||
'type' => 'textarea',
|
||||
'label' => 'Description tm'
|
||||
'label' => 'Description'
|
||||
],
|
||||
[
|
||||
'name' => 'max_size',
|
||||
|
|
|
|||
|
|
@ -54,34 +54,14 @@ protected function setupCreateOperation()
|
|||
|
||||
$this->crud->addField([
|
||||
[
|
||||
'name' => 'name_ru',
|
||||
'name' => 'name',
|
||||
'type' => 'text',
|
||||
'label' => 'Name ru'
|
||||
'label' => 'Name'
|
||||
],
|
||||
[
|
||||
'name' => 'name_en',
|
||||
'type' => 'text',
|
||||
'label' => 'Name en'
|
||||
],
|
||||
[
|
||||
'name' => 'name_tm',
|
||||
'type' => 'text',
|
||||
'label' => 'Name tm'
|
||||
],
|
||||
[
|
||||
'name' => 'description_ru',
|
||||
'name' => 'description',
|
||||
'type' => 'textarea',
|
||||
'label' => 'Description ru'
|
||||
],
|
||||
[
|
||||
'name' => 'description_en',
|
||||
'type' => 'textarea',
|
||||
'label' => 'Description en'
|
||||
],
|
||||
[
|
||||
'name' => 'description_tm',
|
||||
'type' => 'textarea',
|
||||
'label' => 'Description tm'
|
||||
'label' => 'Description'
|
||||
],
|
||||
[
|
||||
'name' => 'type',
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ public function rules()
|
|||
return [
|
||||
'title' => 'required',
|
||||
'content' => 'required',
|
||||
'category_id' => 'required'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,11 +3,13 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Backpack\CRUD\app\Models\Traits\CrudTrait;
|
||||
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Country extends Model
|
||||
{
|
||||
use CrudTrait;
|
||||
use HasTranslations;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
@ -24,6 +26,7 @@ class Country extends Model
|
|||
];
|
||||
// protected $hidden = [];
|
||||
// protected $dates = [];
|
||||
protected $translatable = ['name'];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -3,11 +3,14 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Backpack\CRUD\app\Models\Traits\CrudTrait;
|
||||
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
|
||||
class Document extends Model
|
||||
{
|
||||
use CrudTrait;
|
||||
use HasTranslations;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
@ -20,16 +23,13 @@ class Document extends Model
|
|||
// public $timestamps = false;
|
||||
protected $guarded = ['id'];
|
||||
protected $fillable = [
|
||||
'name_ru',
|
||||
'name_tm',
|
||||
'name_en',
|
||||
'description_ru',
|
||||
'description_en',
|
||||
'description_tm',
|
||||
'name',
|
||||
'description',
|
||||
'max_size'
|
||||
];
|
||||
// protected $hidden = [];
|
||||
// protected $dates = [];
|
||||
protected $translatable = ['name', 'description'];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -3,11 +3,13 @@
|
|||
namespace App\Models;
|
||||
|
||||
use Backpack\CRUD\app\Models\Traits\CrudTrait;
|
||||
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Documentgroup extends Model
|
||||
{
|
||||
use CrudTrait;
|
||||
use HasTranslations;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
@ -20,16 +22,13 @@ class Documentgroup extends Model
|
|||
// public $timestamps = false;
|
||||
protected $guarded = ['id'];
|
||||
protected $fillable = [
|
||||
'name_en',
|
||||
'name_ru',
|
||||
'name_tm',
|
||||
'description_ru',
|
||||
'description_tm',
|
||||
'description_en',
|
||||
'name',
|
||||
'description',
|
||||
'type'
|
||||
];
|
||||
// protected $hidden = [];
|
||||
// protected $dates = [];
|
||||
protected $translatable = ['name', 'description'];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
"laravel/framework": "^9.11",
|
||||
"laravel/sanctum": "^2.15",
|
||||
"laravel/tinker": "^2.7",
|
||||
"spatie/laravel-translatable": "^6.0",
|
||||
"zircote/swagger-php": "^4.4"
|
||||
},
|
||||
"require-dev": {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "eb98a99c92a6ca19bbcf7630d5634a54",
|
||||
"content-hash": "761a5e13276a1c37fad37fad451bcd20",
|
||||
"packages": [
|
||||
{
|
||||
"name": "backpack/crud",
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Laravel-Backpack/CRUD/zipball/4539c787a2e052d2e2e2c00188c38432dc2a7ea9",
|
||||
"url": "file:///C:/MAMP/htdocs/legalization/legalization/CRUD-5.zip",
|
||||
"reference": "4539c787a2e052d2e2e2c00188c38432dc2a7ea9",
|
||||
"shasum": ""
|
||||
},
|
||||
|
|
@ -4203,6 +4203,65 @@
|
|||
],
|
||||
"time": "2022-03-27T21:42:02+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spatie/laravel-package-tools",
|
||||
"version": "1.12.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/spatie/laravel-package-tools.git",
|
||||
"reference": "09f80fa240d44fafb1c70657c74ee44ffa929357"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/09f80fa240d44fafb1c70657c74ee44ffa929357",
|
||||
"reference": "09f80fa240d44fafb1c70657c74ee44ffa929357",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/contracts": "^7.0|^8.0|^9.0",
|
||||
"php": "^7.4|^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^1.4",
|
||||
"orchestra/testbench": "^5.0|^6.23|^7.0",
|
||||
"phpunit/phpunit": "^9.4",
|
||||
"spatie/test-time": "^1.2"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Spatie\\LaravelPackageTools\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Freek Van der Herten",
|
||||
"email": "freek@spatie.be",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Tools for creating Laravel packages",
|
||||
"homepage": "https://github.com/spatie/laravel-package-tools",
|
||||
"keywords": [
|
||||
"laravel-package-tools",
|
||||
"spatie"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/spatie/laravel-package-tools/issues",
|
||||
"source": "https://github.com/spatie/laravel-package-tools/tree/1.12.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/spatie",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2022-06-28T14:29:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spatie/laravel-permission",
|
||||
"version": "5.5.5",
|
||||
|
|
@ -4285,6 +4344,87 @@
|
|||
],
|
||||
"time": "2022-06-29T23:11:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spatie/laravel-translatable",
|
||||
"version": "6.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/spatie/laravel-translatable.git",
|
||||
"reference": "c4c2bef702738f26562b6dc37b66bdac545610e1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/spatie/laravel-translatable/zipball/c4c2bef702738f26562b6dc37b66bdac545610e1",
|
||||
"reference": "c4c2bef702738f26562b6dc37b66bdac545610e1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/database": "^9.0",
|
||||
"illuminate/support": "^9.0",
|
||||
"php": "^8.0",
|
||||
"spatie/laravel-package-tools": "^1.11"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^1.4",
|
||||
"orchestra/testbench": "^7.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Spatie\\Translatable\\TranslatableServiceProvider"
|
||||
]
|
||||
},
|
||||
"aliases": {
|
||||
"Translatable": "Spatie\\Translatable\\Facades\\Translatable"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Spatie\\Translatable\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Freek Van der Herten",
|
||||
"email": "freek@spatie.be",
|
||||
"homepage": "https://spatie.be",
|
||||
"role": "Developer"
|
||||
},
|
||||
{
|
||||
"name": "Sebastian De Deyne",
|
||||
"email": "sebastian@spatie.be",
|
||||
"homepage": "https://spatie.be",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "A trait to make an Eloquent model hold translations",
|
||||
"homepage": "https://github.com/spatie/laravel-translatable",
|
||||
"keywords": [
|
||||
"eloquent",
|
||||
"i8n",
|
||||
"laravel-translatable",
|
||||
"model",
|
||||
"multilingual",
|
||||
"spatie",
|
||||
"translate"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/spatie/laravel-translatable/issues",
|
||||
"source": "https://github.com/spatie/laravel-translatable/tree/6.0.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/spatie",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2022-03-07T13:50:51+00:00"
|
||||
},
|
||||
{
|
||||
"name": "studio-42/elfinder",
|
||||
"version": "2.1.61",
|
||||
|
|
@ -9672,5 +9812,5 @@
|
|||
"php": "^8.0.9"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.1.0"
|
||||
"plugin-api-version": "2.3.0"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public function up()
|
|||
{
|
||||
Schema::create('countries', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->nullable();
|
||||
$table->text('name')->nullable();
|
||||
$table->string('code')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -15,12 +15,8 @@ public function up()
|
|||
{
|
||||
Schema::create('documents', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name_ru')->nullable();
|
||||
$table->string('name_tm')->nullable();
|
||||
$table->string('name_en')->nullable();
|
||||
$table->text('description_ru')->nullable();
|
||||
$table->text('description_tm')->nullable();
|
||||
$table->text('description_en')->nullable();
|
||||
$table->text('name')->nullable();
|
||||
$table->text('description')->nullable();
|
||||
$table->double('max_size')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -15,12 +15,8 @@ public function up()
|
|||
{
|
||||
Schema::create('documentgroups', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name_en')->nullable();
|
||||
$table->string('name_ru')->nullable();
|
||||
$table->string('name_tm')->nullable();
|
||||
$table->text('description_ru')->nullable();
|
||||
$table->text('description_tm')->nullable();
|
||||
$table->text('description_en')->nullable();
|
||||
$table->text('name')->nullable();
|
||||
$table->text('description')->nullable();
|
||||
$table->string('type')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
Route::get('/my-tickets',[TicketController::class, 'getTickets']);
|
||||
Route::get('/ticket-messages',[TicketController::class,'getTicketMessages']);
|
||||
Route::post('/post-message',[TicketController::class,'postMessage']);
|
||||
Route::post('/post-ticket',[TicketController::class,'postTicket']);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -822,6 +822,84 @@
|
|||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/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