本文整理汇总了PHP中app\Customer::instagramAccount方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::instagramAccount方法的具体用法?PHP Customer::instagramAccount怎么用?PHP Customer::instagramAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Customer
的用法示例。
在下文中一共展示了Customer::instagramAccount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$user = new User();
$user->name = 'mugekural';
$user->surname = str_random(10);
$user->email = $user->name . '@gmail.com';
$user->is_active = true;
$user->password = bcrypt('12345');
$user->type = 'App\\Supplier';
$user->save();
$supplier = new Supplier();
$supplier->phone = '023123';
$supplier->id = $user->id;
$supplier->save();
$user2 = new User();
$user2->name = str_random(10);
$user2->surname = str_random(10);
$user2->email = $user2->name . '@gmail.com';
$user2->is_active = true;
$user2->type = 'App\\Customer';
$user2->save();
$customer = new Customer();
$customer->phone = "053247557437";
$customer->id = $user2->id;
$customer->save();
$instagram = new InstagramAccount();
$instagram->instagram_id = "1231231";
$instagram->access_token = "asdaddads";
$instagram->username = "farukaladag";
$instagram->full_name = "omer faruk";
$instagram->bio = "fdsfasfdsf";
$instagram->website = "string";
$instagram->profile_picture = "";
$supplier->instagramAccount()->save($instagram);
$product = new Product();
$product->supplier_id = $supplier->id;
$product->id = "235";
$product->is_active = true;
$product->title = "kitap";
$product->description = "martı";
$product->price = "340";
$product->save();
$instagram2 = new InstagramAccount();
$instagram2->instagram_id = "700797";
$instagram2->access_token = "fjfjjfjfjf";
$instagram2->username = "mug9";
$instagram2->full_name = "muge kural";
$instagram2->bio = "comp stud";
$instagram2->website = "some string";
$instagram2->profile_picture = "";
$customer->instagramAccount()->save($instagram2);
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$rules = array('firstname' => 'required', 'surname' => 'required', 'customeremail' => 'required|email', 'pass' => 'required', 'phone' => 'required', 'rpass' => 'required|same:pass');
$validator = Validator::make($request->all(), $rules);
if ($validator->fails()) {
// get the error messages from the validator
$messages = $validator->messages();
// redirect our user back to the form with the errors from the validator
return back()->withInput()->withErrors($messages);
} else {
if (User::where('email', $request->input('customeremail'))->first()) {
return redirect()->action('AuthenticationController@showRegister')->withErrors(['messages' => "Sistemde mail adresi kayıtlı"]);
}
$user = new User();
$user->name = trim($request->input('firstname'));
$user->surname = trim($request->input('surname'));
$user->setAsCustomer();
$user->is_active = false;
$user->email = $request->input('customeremail');
$user->password = bcrypt($request->input('pass'));
$user->save();
$customer = new Customer();
$customer->phone = $request->input('phone');
$customer->id = $user->id;
$customer->save();
if (Session::has('user_instagram_info')) {
$instagramInfo = Session::pull('user_instagram_info');
$instagramAccount = new InstagramAccount();
$instagramAccount->instagram_id = $instagramInfo->user->id;
$instagramAccount->username = $instagramInfo->user->username;
$instagramAccount->access_token = $instagramInfo->access_token;
$instagramAccount->full_name = $instagramInfo->user->full_name;
$instagramAccount->bio = $instagramInfo->user->bio;
$instagramAccount->website = $instagramInfo->user->website;
$instagramAccount->profile_picture = $instagramInfo->user->profile_picture;
$customer->instagramAccount()->save($instagramAccount);
}
Storage::makeDirectory($user->id);
return redirect()->action('AuthenticationController@showRegister')->with('success', ['Successful']);
}
}