Skip to content

Instantly share code, notes, and snippets.

@arungpisyadi
Last active December 16, 2016 04:35
Show Gist options
  • Save arungpisyadi/49b2dadcdc5a1bdc158450ada2e8fced to your computer and use it in GitHub Desktop.
Save arungpisyadi/49b2dadcdc5a1bdc158450ada2e8fced to your computer and use it in GitHub Desktop.
Archive the unused codes from Panel.php
/* if(isset($_POST['slug']) && !empty($_POST['slug'])){
$oldslug = User::where('id',$_POST['user_id'])->value('slug');
$newslug = str_slug($_POST['slug'], '-');
//if data not change
if($oldslug == $newslug){
$counts = User::where('slug',$newslug)->count();
//if data more than the object original
if($counts>1){
$newslug_copy = $newslug.'-'.$counts+1;
$newslug = $newslug_copy;
}else{
$newslug;
}
}else{
//if old slug is diff with new slug
$othercount = User::where('slug',$newslug)->count();
//if newslug is there are same with others slug
if($othercount>0){
$newslug = $newslug.'-'.$othercount+1;
}
$newslug = $newslug;
}
$user->slug = $newslug;
}*/
// TODO: Turn off temporarily becasue of the suspension of SES account
/*
$get_table = DB::table($table)
->whereIn('listings.id', $ids)
->leftJoin('users','listings.userId','=','users.id')
->select('listings.id','userId','title','users.email as email','users.fullName as fullName','listings.slug as slug', 'users.email_notify as email_notify') // fix email notify
->get();
$group = collect($get_table)->groupBy('userId')->toArray();
foreach ($group as $ids) {
// fix #70 - Arung - Bulk approval / Error
if($ids[0]->email_notify != '0' || $ids[0]->email_notify != '1'){
$email = $ids[0]->email;
$username_to = $ids[0]->fullName;
$details = array('to' => $email);
$listing_url = url('/luxify-estates/3d-estates');
$listing_rejected = array();
foreach ($ids as $items) {
$listing_rejected[] = $items->title;
}
Mail::send('emails.new-luxify-listing-rejected-en-us', ['username_to' => $username_to,'listing_rejected'=>$listing_rejected, 'listing_url' => $listing_url], function ($message) use ($details){
$message->from('technology@luxify.com', 'Luxify Admin');
//please update subject
$message->subject('Listing Rejected');
$message->replyTo('no_reply@luxify.com', $name = null);
$message->to($details['to']);
});
}
// end fix #70 - Arung - Bulk approval / Error
}
$get_table = DB::table($table)
->whereIn('listings.id', $ids)
->leftJoin('users','listings.userId','=','users.id')
->select('listings.id','userId','title','users.email as email','users.fullName as fullName','listings.slug as slug', 'users.email_notify as email_notify')
->get();
$group = collect($get_table)->groupBy('userId')->toArray();
foreach ($group as $ids) {
// fix #70 - Arung - Bulk approval / Error
if($ids[0]->email_notify != '0' || $ids[0]->email_notify != '1'){
$email = $ids[0]->email;
$username_to = $ids[0]->fullName;
$details = array('to' => $email);
$listing_url = url('/dashboard/products');
$listing_approved = array();
foreach ($ids as $items) {
$listing_approved[] = $items->title;
}
Mail::send('emails.new-luxify-listing-approved-en-us', ['username_to' => $username_to,'listing_approved'=>$listing_approved, 'listing_url' => $listing_url], function ($message) use ($details){
$message->from('technology@luxify.com', 'Luxify Admin');
//please update subject
//#fiqi 2016-09-15 update bulkaction
$message->subject('Listing Approved');
//end #fiqi
$message->replyTo('no_reply@luxify.com', $name = null);
$message->to($details['to']);
});
}
// end fix #70 - Arung - Bulk approval / Error
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment