-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
647 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,57 @@ | ||
<?php | ||
|
||
return [ | ||
/** | ||
* To disable the pixel injection, set this to false. | ||
*/ | ||
'inject-pixel'=>true, | ||
|
||
/** | ||
* To disable injecting tracking links, set this to false. | ||
*/ | ||
'track-links'=>true, | ||
|
||
/** | ||
* Optionally expire old emails, set to 0 to keep forever. | ||
*/ | ||
'expire-days'=>60, | ||
|
||
/** | ||
* Where should the pingback URL route be? | ||
*/ | ||
/** | ||
* To disable the pixel injection, set this to false. | ||
*/ | ||
'inject-pixel'=>true, | ||
|
||
/** | ||
* To disable injecting tracking links, set this to false. | ||
*/ | ||
'track-links'=>true, | ||
|
||
/** | ||
* Optionally expire old emails, set to 0 to keep forever. | ||
*/ | ||
'expire-days'=>60, | ||
|
||
/** | ||
* Where should the pingback URL route be? | ||
*/ | ||
'route' => [ | ||
'prefix' => 'email', | ||
'middleware' => [], | ||
'middleware' => ['web'], | ||
], | ||
|
||
/** | ||
* Where should the admin route be? | ||
*/ | ||
'admin-route' => [ | ||
'prefix' => 'email-manager', | ||
'middleware' => 'super', | ||
'middleware' => ['web'], | ||
], | ||
|
||
/** | ||
* Admin Tamplate | ||
* example | ||
* 'name' => 'layouts.app' for Default emailTraking use 'emailTrakingViews::layouts.app' | ||
* 'section' => 'content' for Default emailTraking use 'content' | ||
* 'styles_section' => 'styles' for Default emailTraking use 'styles' | ||
*/ | ||
'admin-template' => [ | ||
'name' => 'emailTrakingViews::layouts.app', | ||
'section' => 'content', | ||
], | ||
|
||
/** | ||
* Number of emails per page in the admin view | ||
*/ | ||
'emails-per-page'=>5, | ||
|
||
/** | ||
* Date Format | ||
*/ | ||
'date-format' => 'm/d/Y g:i a', | ||
|
||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
migrations/2016_09_07_193027_create_sent_emails_Url_Clicked_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class CreateSentEmailsUrlClickedTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('sent_emails_url_clicked', function (Blueprint $table) { | ||
$table->increments('id'); | ||
$table->integer('sent_email_id')->unsigned(); | ||
$table->foreign('sent_email_id')->references('id')->on('sent_emails')->onDelete('cascade'); | ||
$table->string('url'); | ||
$table->char('hash',32); | ||
$table->integer('clicks')->default('1'); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::drop('sent_emails_url_clicked'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?php | ||
|
||
namespace jdavidbakr\MailTracker; | ||
|
||
use Illuminate\Http\Request; | ||
use Response; | ||
|
||
use App\Http\Requests; | ||
use App\Http\Controllers\Controller; | ||
|
||
use jdavidbakr\MailTracker\Model\SentEmail; | ||
use jdavidbakr\MailTracker\Model\SentEmailUrlClicked; | ||
|
||
use Mail; | ||
|
||
|
||
class AdminController extends Controller | ||
{ | ||
/** | ||
* Sent email search | ||
*/ | ||
public function postSearch(Request $request) | ||
{ | ||
session(['mail-tracker-index-search'=>$request->search]); | ||
return redirect(route('mailTracker_Index')); | ||
} | ||
|
||
/** | ||
* Clear search | ||
*/ | ||
public function clearSearch() | ||
{ | ||
session(['mail-tracker-index-search'=>null]); | ||
return redirect(route('mailTracker_Index')); | ||
} | ||
|
||
/** | ||
* Index. | ||
* | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function getIndex() | ||
{ | ||
session(['mail-tracker-index-page'=>request()->page]); | ||
$search = session('mail-tracker-index-search'); | ||
|
||
$query = SentEmail::query(); | ||
|
||
if($search) { | ||
$terms = explode(" ",$search); | ||
foreach($terms as $term) { | ||
$query->where(function($q) use($term) { | ||
$q->where('sender','like','%'.$term.'%') | ||
->orWhere('recipient','like','%'.$term.'%') | ||
->orWhere('subject','like','%'.$term.'%'); | ||
}); | ||
} | ||
} | ||
|
||
$emails = $query->paginate(config('mail-tracker.emails-per-page')); | ||
|
||
return \View('emailTrakingViews::index')->with('emails', $emails); | ||
} | ||
|
||
/** | ||
* Show Email. | ||
* | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function getShowEmail($id) | ||
{ | ||
$email = SentEmail::where('id',$id)->first(); | ||
return \View('emailTrakingViews::show')->with('email', $email); | ||
} | ||
|
||
/** | ||
* Url Detail. | ||
* | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function getUrlDetail($id) | ||
{ | ||
$detalle = SentEmailUrlClicked::where('sent_email_id',$id)->get(); | ||
return \View('emailTrakingViews::url_detail')->with('details', $detalle); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.