fix update profile error

fix update profile frontend unauthorize
This commit is contained in:
jack
2018-05-31 09:56:15 +08:00
parent e3632fce8d
commit d1023faeb4
3 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ 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', 'contact_person'];
protected $fillable = ['user_id', 'company_profile', 'reg_cert', 'company_name', 'registration_no', 'tax_no', 'tel_no', 'fax', 'address', 'city', 'postcode', 'state', 'country', 'contact_person'];
//protected $guarded = [];
public function user()
+2 -1
View File
@@ -149,8 +149,9 @@ class AuthController extends Controller
// TODO : create company for user
$company = new Company;
$company->user = $user;
$company->user_id = $user->id;
$company->save();
return response()->json(['success'=> true, 'message'=> 'Profile updated.']);
}
+1 -1
View File
@@ -78,8 +78,8 @@
token: $('#verify-code').val()},
success: function(data) {
if( data.success){
localStorage.token = data.token;
document.location.href="profile-first-setup.html";
localStorage.token = data.data.token;
}
else{
console.log('wrong code');