-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from ngtinn59/Version-Deploy-Ubuntu
Version-Deploy-Ubuntu
- Loading branch information
Showing
135 changed files
with
8,933 additions
and
1,654 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +0,0 @@ | ||
|
||
**Project: Job Finder - CV Export API** | ||
|
||
[****Installation****]() | ||
|
||
- Clone the repository. | ||
- Run `composer install`. | ||
- Copy .env.example to .env. | ||
- Generate a secure key in the .env file by running `php artisan key:generate`. | ||
|
||
[****API Documentation****]() | ||
|
||
- **Link Postman**: [Postman Link](https://app.getpostman.com/join-team?invite_code=397abbe48fa386e5196125f8977342e5&target_code=345b78a8750f067c027971d49da4b134) | ||
- **Link Drive**: [Drive Link](https://drive.google.com/file/d/1ne18eqa7bhZ0O8zQKqe4byYgzWaadI-f/view) | ||
|
||
**Link API Deploy:** [API Deploy Link](http://20.212.246.49/api/countries) | ||
|
||
**Link Slide Báo cáo:** [Slide](https://www.canva.com/design/DAGDhAD8K-4/XY7H4xQ30hsrozfU_DS3_g/view?utm_content=DAGDhAD8K-4&utm_campaign=designshare&utm_medium=link&utm_source=editor) | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
namespace App\Events; | ||
|
||
use Illuminate\Broadcasting\Channel; | ||
use Illuminate\Broadcasting\InteractsWithSockets; | ||
use Illuminate\Broadcasting\PresenceChannel; | ||
use Illuminate\Broadcasting\PrivateChannel; | ||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast; | ||
use Illuminate\Foundation\Events\Dispatchable; | ||
use Illuminate\Queue\SerializesModels; | ||
|
||
class ApplicationStatusUpdated implements ShouldBroadcast | ||
{ | ||
use Dispatchable, InteractsWithSockets, SerializesModels; | ||
|
||
public $jobId; | ||
public $userId; | ||
public $status; | ||
public $name; | ||
public $notification; | ||
public $job; | ||
|
||
|
||
public function __construct($jobId, $userId, $status, $name, $notification, $job) | ||
{ | ||
$this->jobId = $jobId; | ||
$this->userId = $userId; | ||
$this->status = $status; | ||
$this->name = $name; | ||
$this->notification = $notification; | ||
$this->job = $job; | ||
|
||
} | ||
|
||
/** | ||
* Get the channels the event should broadcast on. | ||
* | ||
* @return array<int, \Illuminate\Broadcasting\Channel> | ||
*/ | ||
public function broadcastOn() | ||
{ | ||
return ['user.' . $this->userId]; // Kênh riêng cho ứng viên | ||
} | ||
public function broadcastAs() | ||
{ | ||
return 'ApplicationStatusUpdated'; | ||
} | ||
|
||
public function broadcastWith(): array | ||
{ | ||
return [ | ||
'notifications' => [ | ||
'notifiable_id' => $this->notification->id, | ||
'data' => [ | ||
'job_id' => $this->jobId, | ||
'job_title' => $this->job->title, | ||
'status' => $this->status, | ||
'message' => 'Trạng thái đơn ứng tuyển của bạn đã được cập nhật.' | ||
], | ||
'read' => $this->notification->read_at ? true : false, // Kiểm tra xem thông báo đã đọc hay chưa | ||
'created_at' => $this->notification->created_at->format('Y-m-d H:i:s'), // Định dạng thời gian | ||
] | ||
|
||
]; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
168 changes: 168 additions & 0 deletions
168
app/Http/Controllers/Api/Admin/AdminCompaniesController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Api\Admin; | ||
|
||
use App\Http\Controllers\Controller; | ||
use App\Models\Company; | ||
use Illuminate\Http\Request; | ||
|
||
class AdminCompaniesController extends Controller | ||
{ | ||
public function index(Request $request) | ||
{ | ||
// Lấy danh sách công ty, có thể phân trang | ||
$companies = Company::paginate(10); | ||
|
||
$companiesdata = $companies->map(function ($company) { | ||
$companyType = optional($company->companytype)->name; | ||
$companySize = optional($company->companysize)->name; | ||
$country = optional($company->country)->name; | ||
$city = optional($company->city)->name; | ||
$district = optional($company->district)->name; | ||
|
||
return [ | ||
'id' => $company->id, | ||
'name' => $company->company_name, | ||
'phone' => $company->phone, // Thêm số điện thoại | ||
'company_email' => $company->company_email, // Thêm email công ty | ||
'logo' => asset('uploads/images/' . $company->logo), | ||
'city' => $city, | ||
'is_hot' => $company->is_hot | ||
]; | ||
|
||
}); | ||
|
||
return response()->json([ | ||
'success' => true, | ||
'message' => 'successfully.', | ||
'data' => $companiesdata | ||
], 200); | ||
} | ||
|
||
public function show($id) | ||
{ | ||
$company = Company::find($id); | ||
|
||
if (!$company) { | ||
return response()->json([ | ||
'success' => false, | ||
'message' => 'Công ty không tồn tại.', | ||
], 404); | ||
} | ||
|
||
// Retrieve optional related data | ||
$companyType = optional($company->companytype)->name; | ||
$companySize = optional($company->companysize)->name; | ||
$country = optional($company->country)->name; | ||
$city = optional($company->city)->name; | ||
$district = optional($company->district)->name; | ||
|
||
// Structured company data | ||
$companyDetails = [ | ||
'id' => $company->id, | ||
'name' => $company->company_name, | ||
'company_type' => $companyType, | ||
'company_size' => $companySize, | ||
'country' => $country, | ||
'city' => $city, | ||
'district' => $district, | ||
'phone' => $company->phone, | ||
'company_email' => $company->company_email, | ||
'tax_code' => $company->tax_code, | ||
'date_of_establishment' => $company->date_of_establishment, | ||
'working_days' => $company->working_days, | ||
'overtime_policy' => $company->overtime_policy, | ||
'website' => $company->website, | ||
'facebook' => $company->facebook, | ||
'youtube' => $company->youtube, | ||
'linked' => $company->linked, | ||
'address' => $company->address, | ||
'latitude' => $company->latitude, | ||
'longitude' => $company->longitude, | ||
'description' => $company->description, | ||
'is_hot' => $company->is_hot, | ||
'logo' => asset('uploads/images/' . $company->logo), | ||
'banner' => asset('uploads/images/' . $company->banner), | ||
|
||
]; | ||
|
||
return response()->json([ | ||
'success' => true, | ||
'message' => 'successfully.', | ||
'data' => $companyDetails | ||
], 200); | ||
} | ||
|
||
|
||
public function markAsHot($companyId) | ||
{ | ||
$company = Company::find($companyId); | ||
|
||
if (!$company) { | ||
return response()->json([ | ||
'success' => false, | ||
'message' => 'Không tìm thấy công ty.', | ||
'status_code' => 404, | ||
], 404); | ||
} | ||
|
||
// Đánh dấu công ty là "nổi bật" | ||
$company->is_hot = true; | ||
$company->save(); | ||
|
||
// Chuẩn bị dữ liệu trả về | ||
$companyType = optional($company->companytype)->name; | ||
$companySize = optional($company->companysize)->name; | ||
$country = optional($company->country)->name; | ||
$city = optional($company->city)->name; | ||
$district = optional($company->district)->name; | ||
|
||
$companyDetails = [ | ||
'id' => $company->id, | ||
'name' => $company->company_name, | ||
'company_type' => $companyType, | ||
'company_size' => $companySize, | ||
'country' => $country, | ||
'city' => $city, | ||
'district' => $district, | ||
'phone' => $company->phone, | ||
'company_email' => $company->company_email, | ||
'tax_code' => $company->tax_code, | ||
'date_of_establishment' => $company->date_of_establishment, | ||
'working_days' => $company->working_days, | ||
'overtime_policy' => $company->overtime_policy, | ||
'website' => $company->website, | ||
'facebook' => $company->facebook, | ||
'youtube' => $company->youtube, | ||
'linked' => $company->linked, | ||
'address' => $company->address, | ||
'latitude' => $company->latitude, | ||
'longitude' => $company->longitude, | ||
'description' => $company->description, | ||
'is_hot' => $company->is_hot, | ||
'logo' => asset('uploads/images/' . $company->logo), | ||
'banner' => asset('uploads/images/' . $company->banner), | ||
|
||
]; | ||
|
||
return response()->json([ | ||
'success' => true, | ||
'message' => 'Công ty đã được đánh dấu là nổi bật.', | ||
'data' => $companyDetails, | ||
'status_code' => 200, | ||
], 200); | ||
} | ||
|
||
public function destroy(Company $company) | ||
{ | ||
$company->delete(); | ||
return response()->json([ | ||
'success' => true, | ||
'message' => 'Company deleted successfully.', | ||
'status_code' => 200 | ||
]); | ||
|
||
} | ||
|
||
|
||
} |
Oops, something went wrong.