Commit 4dac1879 authored by Kittisak Maneewong's avatar Kittisak Maneewong

Edit

parent de38734c
...@@ -4,6 +4,7 @@ namespace App\Http\Controllers; ...@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Company; use App\Company;
use App\User; use App\User;
use App\Job;
use Illuminate\Http\Request; use Illuminate\Http\Request;
class CompanyController extends Controller class CompanyController extends Controller
...@@ -85,10 +86,11 @@ class CompanyController extends Controller ...@@ -85,10 +86,11 @@ class CompanyController extends Controller
public function show($id) public function show($id)
{ {
$exists = Company::where('user_id', $id)->exists(); $exists = Company::where('user_id', $id)->exists();
$count = Job::where('user_id', $id)->count();
if ($exists) { if ($exists) {
return response()->json(['exists' => true, 'company' => Company::where('user_id', $id)->first()]); return response()->json(['exists' => true, 'company' => Company::where('user_id', $id)->first(), 'count' => $count]);
} else { } else {
return response()->json(['exists' => false, 'company' => User::where('id', $id)->first()]); return response()->json(['exists' => false, 'company' => User::where('id', $id)->first(), 'count' => $count]);
} }
} }
...@@ -124,6 +126,8 @@ class CompanyController extends Controller ...@@ -124,6 +126,8 @@ class CompanyController extends Controller
$name = 'Company'.time().'.'.explode('/', explode(':', substr($image, 0, strpos($image, ';')))[1])[1]; $name = 'Company'.time().'.'.explode('/', explode(':', substr($image, 0, strpos($image, ';')))[1])[1];
\Image::make($request->get('imageCompany'))->save(public_path('uploads/').$name); \Image::make($request->get('imageCompany'))->save(public_path('uploads/').$name);
$company->imageCompany = '/uploads/'.$name; $company->imageCompany = '/uploads/'.$name;
} else {
$company->imageCompany = 'https://asianinteriorservices.com/wp-content/uploads/2018/04/noImg.png';
} }
} }
if ($request->get('imageMap') !== $company->imageMap) { if ($request->get('imageMap') !== $company->imageMap) {
...@@ -132,6 +136,8 @@ class CompanyController extends Controller ...@@ -132,6 +136,8 @@ class CompanyController extends Controller
$name = 'Map'.time().'.'.explode('/', explode(':', substr($image, 0, strpos($image, ';')))[1])[1]; $name = 'Map'.time().'.'.explode('/', explode(':', substr($image, 0, strpos($image, ';')))[1])[1];
\Image::make($request->get('imageMap'))->save(public_path('uploads/').$name); \Image::make($request->get('imageMap'))->save(public_path('uploads/').$name);
$company->imageMap = '/uploads/'.$name;; $company->imageMap = '/uploads/'.$name;;
} else {
$company->imageMap = null;
} }
} }
$company->company_name = $request->get('company_name'); $company->company_name = $request->get('company_name');
......
...@@ -45,7 +45,7 @@ return [ ...@@ -45,7 +45,7 @@ return [
'local' => [ 'local' => [
'driver' => 'local', 'driver' => 'local',
'root' => storage_path('app'), 'root' => public_path(''),
], ],
'public' => [ 'public' => [
......
This diff is collapsed.
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<v-flex xs12 sm10 offset-sm1> <v-flex xs12 sm10 offset-sm1>
<v-toolbar flat color="white" height="40"> <v-toolbar flat color="white" height="40">
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-btn small="" dark color="deep-orange darken-4" class="elevation-0" @click="$router.push('/employer/login')">สำหรับผู้ประกอบการ</v-btn> <v-btn small="" dark color="deep-orange darken-4" class="elevation-0" @click="$router.push('/employer')">สำหรับผู้ประกอบการ</v-btn>
<v-divider inset vertical></v-divider> <v-divider inset vertical></v-divider>
<v-btn v-if="!currentUser" small outline color="deep-orange darken-4" @click.stop="login()"> <v-btn v-if="!currentUser" small outline color="deep-orange darken-4" @click.stop="login()">
<v-icon>person</v-icon>&nbsp;เข้าสู่ระบบ <v-icon>person</v-icon>&nbsp;เข้าสู่ระบบ
......
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
label="ระดับการศึกษา" label="ระดับการศึกษา"
v-model="job_data.degree" v-model="job_data.degree"
placeholder=" " placeholder=" "
item-value="text" :items="degree"
></v-select> ></v-select>
<v-text-field <v-text-field
label="เกรดเฉลี่ย " label="เกรดเฉลี่ย "
...@@ -185,6 +185,9 @@ ...@@ -185,6 +185,9 @@
export default { export default {
data () { data () {
return { return {
degree: [
'ระดับ'
],
gender: [], gender: [],
items: [ items: [
'ชาย', 'ชาย',
......
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
label="ระดับการศึกษา" label="ระดับการศึกษา"
v-model="job_data.degree" v-model="job_data.degree"
placeholder=" " placeholder=" "
item-value="text" :items="degree"
></v-select> ></v-select>
<v-text-field <v-text-field
label="เกรดเฉลี่ย " label="เกรดเฉลี่ย "
...@@ -185,6 +185,9 @@ ...@@ -185,6 +185,9 @@
export default { export default {
data () { data () {
return { return {
degree: [
'ระดับ'
],
gender: [], gender: [],
items: [ items: [
'ชาย', 'ชาย',
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
งานทั้งหมด งานทั้งหมด
</v-flex> </v-flex>
<v-flex xs12 sm12 class="subheading font-weight-black" > <v-flex xs12 sm12 class="subheading font-weight-black" >
0 งาน {{countJob}} งาน
</v-flex> </v-flex>
</v-flex> </v-flex>
<v-flex xs4 sm1 class="text-sm-center text-xs-center"> <v-flex xs4 sm1 class="text-sm-center text-xs-center">
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
งานที่เปิดรับสมัคร งานที่เปิดรับสมัคร
</v-flex> </v-flex>
<v-flex xs12 sm12 class="subheading font-weight-black" > <v-flex xs12 sm12 class="subheading font-weight-black" >
0 งาน {{countJob}} งาน
</v-flex> </v-flex>
</v-flex> </v-flex>
<v-flex xs4 sm1 class="text-sm-center text-xs-center"> <v-flex xs4 sm1 class="text-sm-center text-xs-center">
...@@ -122,6 +122,7 @@ export default { ...@@ -122,6 +122,7 @@ export default {
data () { data () {
return { return {
user: null, user: null,
countJob: 0,
companies: { companies: {
about: null, about: null,
addr: null, addr: null,
...@@ -166,6 +167,7 @@ export default { ...@@ -166,6 +167,7 @@ export default {
axios.get(`/api/companys/${res.id}`) axios.get(`/api/companys/${res.id}`)
.then(res => { .then(res => {
console.log(res) console.log(res)
this.countJob = res.data.count
if (res.data.exists) { if (res.data.exists) {
this.companies = res.data.company this.companies = res.data.company
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment