changed files according to discussions on Gitlab and tweaked search function

This commit is contained in:
Aqeeb Imtiaz Harun
2018-08-06 15:10:25 +08:00
parent f4763b9b29
commit e34df92ef6
3 changed files with 22 additions and 19 deletions
+18 -18
View File
@@ -6,38 +6,38 @@ use Illuminate\Database\Eloquent\Model;
class Company extends Model
{
protected $fillable = [
'company_profile',
'reg_cert',
'company_name',
'registration_no',
'tax_no',
'tel_no',
'fax',
'address',
'city',
'postcode',
'state',
'country',
'company_profile',
'reg_cert',
'company_name',
'registration_no',
'tax_no',
'tel_no',
'fax',
'address',
'city',
'postcode',
'state',
'country',
'contact_person',
'user_id',
'user_id',
];
public function user()
{
return $this->belongsTo('App\User');
}
public function deliveryinfo() {
public function deliveryInfo() {
return $this->hasMany('App\Deliveryinfo');
}
public function warehouse() {
public function warehouses() {
return $this->hasMany('App\Warehouse');
+1 -1
View File
@@ -14,7 +14,7 @@ class Contact extends Model
}
public function companies(){
public function company(){
return $this->belongsTo('App\Company');
@@ -22,7 +22,10 @@ class CompanyController extends Controller
{
foreach ($matchedTerms as $key => $matchedTerm)
{
if($matchedTerm->id != Auth::user()->company()->first()->id)
{
array_push($output, ['recipient_id'=> $matchedTerm->id, 'company_name' => $matchedTerm->company_name, 'tel_no' => $matchedTerm->tel_no, 'contact_person'=>$matchedTerm->contact_person ]);
}
}
return response($output);