Laravel 5 throw just exception error on its own - laravel-5

I am running the following query :
$data2 = DB::table('affiliate')->where('affID','=', $collectData['AffiliateID'])->where('AffStatus','==',1)->get();
if (count($data2)) {
throw new Exception('Affiliate Paused');
}
When there is an error, it throws an exception , but a whole lot of other error information as well, please see below. How do i throw only the Exception error and nothing else.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="robots" content="noindex,nofollow" />
<style>
/* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */
html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}
html { background: #eee; padding: 10px }
img { border: 0; }
#sf-resetcontent { width:970px; margin:0 auto; }
.sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 }
.sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; }
.sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }
.sf-reset .clear_fix { display:inline-block; }
.sf-reset * html .clear_fix { height:1%; }
.sf-reset .clear_fix { display:block; }
.sf-reset, .sf-reset .block { margin: auto }
.sf-reset abbr { border-bottom: 1px dotted #000; cursor: help; }
.sf-reset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }
.sf-reset strong { font-weight:bold; }
.sf-reset a { color:#6c6159; cursor: default; }
.sf-reset a img { border:none; }
.sf-reset a:hover { text-decoration:underline; }
.sf-reset em { font-style:italic; }
.sf-reset h1, .sf-reset h2 { font: 20px Georgia, "Times New Roman", Times, serif }
.sf-reset .exception_counter { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; float: left; display: block; }
.sf-reset .exception_title { margin-left: 3em; margin-bottom: 0.7em; display: block; }
.sf-reset .exception_message { margin-left: 3em; display: block; }
.sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }
.sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;
border-bottom-right-radius: 16px;
border-bottom-left-radius: 16px;
border-bottom:1px solid #ccc;
border-right:1px solid #ccc;
border-left:1px solid #ccc;
word-wrap: break-word;
}
.sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px;
border-top-left-radius: 16px;
border-top-right-radius: 16px;
border-top:1px solid #ccc;
border-right:1px solid #ccc;
border-left:1px solid #ccc;
overflow: hidden;
word-wrap: break-word;
}
.sf-reset a { background:none; color:#868686; text-decoration:none; }
.sf-reset a:hover { background:none; color:#313131; text-decoration:underline; }
.sf-reset ol { padding: 10px 0; }
.sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px;
border-radius: 10px;
border: 1px solid #ccc;
}
</style>
</head>
<body ondblclick="var t = event.target; if (t.title && !t.href) { var f = t.innerHTML; t.innerHTML = t.title; t.title = f; }">
<div id="sf-resetcontent" class="sf-reset">
<h1>Whoops, looks like something went wrong.</h1>
<h2 class="block_exception clear_fix">
<span class="exception_counter">1/1</span>
<span class="exception_title"><abbr title="ErrorException">ErrorException</abbr> in <a title="/home/comloantreedata/public_html/api/routes/web.php line 199">web.php line 199</a>:</span>
<span class="exception_message">Undefined index: AffiliateIDs</span>
</h2>
<div class="block">
<ol class="traces list_exception">
<li> in <a title="/home/comloantreedata/public_html/api/routes/web.php line 199">web.php line 199</a></li>
<li>at <abbr title="Illuminate\Foundation\Bootstrap\HandleExceptions">HandleExceptions</abbr>->handleError(8, 'Undefined index: AffiliateIDs', '/home/comloantreedata/public_html/api/routes/web.php', 199, <em>array</em>('collectData' => <em>array</em>('SubID2' => '99999999', 'LeadSource' => 'testdomain.com', 'Address1' => 'Flat 5, Jacobs Court', 'Address2' => 'Kyrle Street', 'AddressFrom' => '2014-04-01', 'AddressStatus' => 'private tenant', 'AffiliateID' => 'StressTest', 'APIKey' => '46AB77889181713BFB7200EA7479636009284C8F44536192947870E4AA8F0053', 'AffiliateReference' => 'MW0010', 'BankAccount' => '23411931', 'BankSortCode' => '203964', 'Consent' => '1', 'County' => 'Herefordshire', 'DebitCard' => 'visa debit', 'DOB' => '1983-07-31', 'Email' => 'slawekk83#googlemail.com', 'Employer' => 'Cargill', 'Position' => 'Other', 'ExpenseCredit' => '20', 'ExpenseRentMortgage' => '20', 'ExpenseUtilitiesBills' => '20', 'ExpenseTransport' => '70', 'ExpenseFood' => '60', 'ExpenseRegularOutgoings' => '67', 'FirstName' => 'Slawomir', 'IncomeFollowing' => '2017-06-30', 'IncomeFrequency' => 'last working day of month', 'IncomeFrom' => '2014-04-01', 'IncomeMethod' => 'direct into account', 'IncomeMonthly' => '1400', 'IncomeNext' => '2017-05-31', 'IncomeSource' => 'full time employment', 'Industry' => 'not applicable', 'IPAddress' => '94.197.120.118', 'HomePhone' => '01432352400', 'LastName' => 'Kozlowski', 'Live' => '1', 'LoanAmount' => '150', 'MaxTime' => '180', 'MinPrice' => '5', 'Browser' => 'Safari', 'MobilePhone' => '07397764024', 'OPTIN' => '1', 'Postcode' => 'HR1 2EW', 'Title' => 'Mr', 'Town' => 'HEREFORD', 'WorkPhone' => '01432352400', 'SubID1' => '11532', 'SubID3' => <em>null</em>, 'Dependants' => '1', 'MaritalStatus' => 'single', 'LoanReason' => 'pay bills', 'Company' => 'MDXSOLUTIONS', 'Energy' => 'British Gas', 'LoanDuration' => '3', 'Guarantor' => '0', 'Debt5K' => '1'), 'dataCheck1' => <em>object</em>(<abbr title="Illuminate\Support\Collection">Collection</abbr>))) in <a title="/home/comloantreedata/public_html/api/routes/web.php line 199">web.php line 199</a></li>
<li>at <abbr title="Illuminate\Routing\Router">Router</abbr>->{closure}() in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Routing/Route.php line 190">Route.php line 190</a></li>
<li>at <abbr title="Illuminate\Routing\Route">Route</abbr>->runCallable() in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Routing/Route.php line 163">Route.php line 163</a></li>
<li>at <abbr title="Illuminate\Routing\Route">Route</abbr>->run() in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Routing/Router.php line 559">Router.php line 559</a></li>
<li>at <abbr title="Illuminate\Routing\Router">Router</abbr>->Illuminate\Routing\{closure}(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php line 30">Pipeline.php line 30</a></li>
<li>at <abbr title="Illuminate\Routing\Pipeline">Pipeline</abbr>->Illuminate\Routing\{closure}(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php line 41">SubstituteBindings.php line 41</a></li>
<li>at <abbr title="Illuminate\Routing\Middleware\SubstituteBindings">SubstituteBindings</abbr>->handle(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>), <em>object</em>(<abbr title="Closure">Closure</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php line 148">Pipeline.php line 148</a></li>
<li>at <abbr title="Illuminate\Pipeline\Pipeline">Pipeline</abbr>->Illuminate\Pipeline\{closure}(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php line 53">Pipeline.php line 53</a></li>
<li>at <abbr title="Illuminate\Routing\Pipeline">Pipeline</abbr>->Illuminate\Routing\{closure}(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php line 65">VerifyCsrfToken.php line 65</a></li>
<li>at <abbr title="Illuminate\Foundation\Http\Middleware\VerifyCsrfToken">VerifyCsrfToken</abbr>->handle(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>), <em>object</em>(<abbr title="Closure">Closure</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php line 148">Pipeline.php line 148</a></li>
<li>at <abbr title="Illuminate\Pipeline\Pipeline">Pipeline</abbr>->Illuminate\Pipeline\{closure}(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php line 53">Pipeline.php line 53</a></li>
<li>at <abbr title="Illuminate\Routing\Pipeline">Pipeline</abbr>->Illuminate\Routing\{closure}(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php line 49">ShareErrorsFromSession.php line 49</a></li>
<li>at <abbr title="Illuminate\View\Middleware\ShareErrorsFromSession">ShareErrorsFromSession</abbr>->handle(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>), <em>object</em>(<abbr title="Closure">Closure</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php line 148">Pipeline.php line 148</a></li>
<li>at <abbr title="Illuminate\Pipeline\Pipeline">Pipeline</abbr>->Illuminate\Pipeline\{closure}(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php line 53">Pipeline.php line 53</a></li>
<li>at <abbr title="Illuminate\Routing\Pipeline">Pipeline</abbr>->Illuminate\Routing\{closure}(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php line 64">StartSession.php line 64</a></li>
<li>at <abbr title="Illuminate\Session\Middleware\StartSession">StartSession</abbr>->handle(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>), <em>object</em>(<abbr title="Closure">Closure</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php line 148">Pipeline.php line 148</a></li>
<li>at <abbr title="Illuminate\Pipeline\Pipeline">Pipeline</abbr>->Illuminate\Pipeline\{closure}(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php line 53">Pipeline.php line 53</a></li>
<li>at <abbr title="Illuminate\Routing\Pipeline">Pipeline</abbr>->Illuminate\Routing\{closure}(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php line 37">AddQueuedCookiesToResponse.php line 37</a></li>
<li>at <abbr title="Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse">AddQueuedCookiesToResponse</abbr>->handle(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>), <em>object</em>(<abbr title="Closure">Closure</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php line 148">Pipeline.php line 148</a></li>
<li>at <abbr title="Illuminate\Pipeline\Pipeline">Pipeline</abbr>->Illuminate\Pipeline\{closure}(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php line 53">Pipeline.php line 53</a></li>
<li>at <abbr title="Illuminate\Routing\Pipeline">Pipeline</abbr>->Illuminate\Routing\{closure}(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php line 59">EncryptCookies.php line 59</a></li>
<li>at <abbr title="Illuminate\Cookie\Middleware\EncryptCookies">EncryptCookies</abbr>->handle(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>), <em>object</em>(<abbr title="Closure">Closure</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php line 148">Pipeline.php line 148</a></li>
<li>at <abbr title="Illuminate\Pipeline\Pipeline">Pipeline</abbr>->Illuminate\Pipeline\{closure}(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php line 53">Pipeline.php line 53</a></li>
<li>at <abbr title="Illuminate\Routing\Pipeline">Pipeline</abbr>->Illuminate\Routing\{closure}(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php line 102">Pipeline.php line 102</a></li>
<li>at <abbr title="Illuminate\Pipeline\Pipeline">Pipeline</abbr>->then(<em>object</em>(<abbr title="Closure">Closure</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Routing/Router.php line 561">Router.php line 561</a></li>
<li>at <abbr title="Illuminate\Routing\Router">Router</abbr>->runRouteWithinStack(<em>object</em>(<abbr title="Illuminate\Routing\Route">Route</abbr>), <em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Routing/Router.php line 520">Router.php line 520</a></li>
<li>at <abbr title="Illuminate\Routing\Router">Router</abbr>->dispatchToRoute(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Routing/Router.php line 498">Router.php line 498</a></li>
<li>at <abbr title="Illuminate\Routing\Router">Router</abbr>->dispatch(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php line 174">Kernel.php line 174</a></li>
<li>at <abbr title="Illuminate\Foundation\Http\Kernel">Kernel</abbr>->Illuminate\Foundation\Http\{closure}(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php line 30">Pipeline.php line 30</a></li>
<li>at <abbr title="Illuminate\Routing\Pipeline">Pipeline</abbr>->Illuminate\Routing\{closure}(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php line 30">TransformsRequest.php line 30</a></li>
<li>at <abbr title="Illuminate\Foundation\Http\Middleware\TransformsRequest">TransformsRequest</abbr>->handle(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>), <em>object</em>(<abbr title="Closure">Closure</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php line 148">Pipeline.php line 148</a></li>
<li>at <abbr title="Illuminate\Pipeline\Pipeline">Pipeline</abbr>->Illuminate\Pipeline\{closure}(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php line 53">Pipeline.php line 53</a></li>
<li>at <abbr title="Illuminate\Routing\Pipeline">Pipeline</abbr>->Illuminate\Routing\{closure}(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php line 30">TransformsRequest.php line 30</a></li>
<li>at <abbr title="Illuminate\Foundation\Http\Middleware\TransformsRequest">TransformsRequest</abbr>->handle(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>), <em>object</em>(<abbr title="Closure">Closure</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php line 148">Pipeline.php line 148</a></li>
<li>at <abbr title="Illuminate\Pipeline\Pipeline">Pipeline</abbr>->Illuminate\Pipeline\{closure}(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php line 53">Pipeline.php line 53</a></li>
<li>at <abbr title="Illuminate\Routing\Pipeline">Pipeline</abbr>->Illuminate\Routing\{closure}(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php line 27">ValidatePostSize.php line 27</a></li>
<li>at <abbr title="Illuminate\Foundation\Http\Middleware\ValidatePostSize">ValidatePostSize</abbr>->handle(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>), <em>object</em>(<abbr title="Closure">Closure</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php line 148">Pipeline.php line 148</a></li>
<li>at <abbr title="Illuminate\Pipeline\Pipeline">Pipeline</abbr>->Illuminate\Pipeline\{closure}(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php line 53">Pipeline.php line 53</a></li>
<li>at <abbr title="Illuminate\Routing\Pipeline">Pipeline</abbr>->Illuminate\Routing\{closure}(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php line 46">CheckForMaintenanceMode.php line 46</a></li>
<li>at <abbr title="Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode">CheckForMaintenanceMode</abbr>->handle(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>), <em>object</em>(<abbr title="Closure">Closure</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php line 148">Pipeline.php line 148</a></li>
<li>at <abbr title="Illuminate\Pipeline\Pipeline">Pipeline</abbr>->Illuminate\Pipeline\{closure}(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php line 53">Pipeline.php line 53</a></li>
<li>at <abbr title="Illuminate\Routing\Pipeline">Pipeline</abbr>->Illuminate\Routing\{closure}(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php line 102">Pipeline.php line 102</a></li>
<li>at <abbr title="Illuminate\Pipeline\Pipeline">Pipeline</abbr>->then(<em>object</em>(<abbr title="Closure">Closure</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php line 149">Kernel.php line 149</a></li>
<li>at <abbr title="Illuminate\Foundation\Http\Kernel">Kernel</abbr>->sendRequestThroughRouter(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php line 116">Kernel.php line 116</a></li>
<li>at <abbr title="Illuminate\Foundation\Http\Kernel">Kernel</abbr>->handle(<em>object</em>(<abbr title="Illuminate\Http\Request">Request</abbr>)) in <a title="/home/comloantreedata/public_html/api/public/index.php line 54">index.php line 54</a></li>
</ol>
</div>
</div>
</body>
</html>

You could try this, this will only echo out your error response. It does not deal with exceptions at all, it will just stop the script from running any further.
$data2 = DB::table('affiliate')->where('affID','=', $collectData['AffiliateID'])->where('AffStatus','==',1)->get();
if (!count($data2)) {
echo 'Affiliate ID is incorrect or not active';
exit();
}

Related

Drag and Drop Upload uses Dropzone.js in Laravel 5.3

An error occurred after "Adding Image" or "Drag and Drop" an image. Also, it's not uploaded into the destination folder.
Upload Error Code:
<html> <head> <meta charset="UTF-8"/> <meta name="robots" content="noindex,nofollow"/> <style> /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui... */ html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;} html { background: #eee; padding: 10px } img { border: 0; } #sf-resetcontent { width:970px; margin:0 auto; } .sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 } .sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; } .sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; } .sf-reset .clear_fix { display:inline-block; } .sf-reset * html .clear_fix { height:1%; } .sf-reset .clear_fix { display:block; } .sf-reset, .sf-reset .block { margin: auto } .sf-reset abbr { border-bottom: 1px dotted #000; cursor: help; } .sf-reset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px } .sf-reset strong { font-weight:bold; } .sf-reset a { color:#6c6159; cursor: default; } .sf-reset a img { border:none; } .sf-reset a:hover { text-decoration:underline; } .sf-reset em { font-style:italic; } .sf-reset h1, .sf-reset h2 { font: 20px Georgia, "Times New Roman", Times, serif } .sf-reset .exception_counter { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; float: left; display: block; } .sf-reset .exception_title { margin-left: 3em; margin-bottom: 0.7em; display: block; } .sf-reset .exception_message { margin-left: 3em; display: block; } .sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; } .sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px; -webkit-border-bottom-right-radius: 16px; -webkit-border-bottom-left-radius: 16px; -moz-border-radius-bottomright: 16px; -moz-border-radius-bottomleft: 16px; border-bottom-right-radius: 16px; border-bottom-left-radius: 16px; border-bottom:1px solid #ccc; border-right:1px solid #ccc; border-left:1px solid #ccc; word-wrap: break-word; } .sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px; -webkit-border-top-left-radius: 16px; -webkit-border-top-right-radius: 16px; -moz-border-radius-topleft: 16px; -moz-border-radius-topright: 16px; border-top-left-radius: 16px; border-top-right-radius: 16px; border-top:1px solid #ccc; border-right:1px solid #ccc; border-left:1px solid #ccc; overflow: hidden; word-wrap: break-word; } .sf-reset a { background:none; color:#868686; text-decoration:none; } .sf-reset a:hover { background:none; color:#313131; text-decoration:underline; } .sf-reset ol { padding: 10px 0; } .sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px; -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; border: 1px solid #ccc; } </style> </head> <body> <div id="sf-resetcontent" class="sf-reset"> <h1>Whoops, looks like something went wrong.</h1> <h2 class="block_exception clear_fix"> 1/1 <abbr title="Symfony\Component\Debug\Exception\FatalThrowableError">FatalThrowableError</abbr> in ImageRepository.php line 18: Access to undeclared static property: App\Image::$rules </h2> <div class="block"> <ol class="traces list_exception"> <li> in ImageRepository.php line 18</li> <li>at <abbr title="App\Logic\Image\ImageRepository">ImageRepository</abbr>->upload(array('_token' => '0tyWiynSc7MLXoUKIdFsUGRlGEJONb4DmPuTxIBJ', 'file' => object(<abbr title="Illuminate\Http\UploadedFile">UploadedFile</abbr>))) in ImageController.php line 25</li> <li>at <abbr title="App\Http\Controllers\ImageController">ImageController</abbr>->postUpload()</li> <li>at <abbr title=""></abbr>call_user_func_array(array(object(<abbr title="App\Http\Controllers\ImageController">ImageController</abbr>), 'postUpload'), array()) in Controller.php line 55</li> <li>at <abbr title="Illuminate\Routing\Controller">Controller</abbr>->callAction('postUpload', array()) in ControllerDispatcher.php line 44</li> <li>at <abbr title="Illuminate\Routing\ControllerDispatcher">ControllerDispatcher</abbr>->dispatch(object(<abbr title="Illuminate\Routing\Route">Route</abbr>), object(<abbr title="App\Http\Controllers\ImageController">ImageController</abbr>), 'postUpload') in Route.php line 189</li> <li>at <abbr title="Illuminate\Routing\Route">Route</abbr>->runController() in Route.php line 144</li> <li>at <abbr title="Illuminate\Routing\Route">Route</abbr>->run(object(<abbr title="Illuminate\Http\Request">Request</abbr>)) in Router.php line 642</li> <li>at <abbr title="Illuminate\Routing\Router">Router</abbr>->Illuminate\Routing\{closure}(object(<abbr title="Illuminate\Http\Request">Request</abbr>)) in Pipeline.php line 53</li> <li>at <abbr title="Illuminate\Routing\Pipeline">Pipeline</abbr>->Illuminate\Routing\{closure}(object(<abbr title="Illuminate\Http\Request">Request</abbr>)) in SubstituteBindings.php line 41</li> <li>at <abbr title="Illuminate\Routing\Middleware\SubstituteBindings">SubstituteBindings</abbr>->handle(object(<abbr title="Illuminate\Http\Request">Request</abbr>), object(<abbr title="Closure">Closure</abbr>)) in Pipeline.php line 137</li> <li>at <abbr title="Illuminate\Pipeline\Pipeline">Pipeline</abbr>->Illuminate\Pipeline\{closure}(object(<abbr title="Illuminate\Http\Request">Request</abbr>)) in Pipeline.php line 33</li> <li>at <abbr title="Illuminate\Routing\Pipeline">Pipeline</abbr>->Illuminate\Routing\{closure}(object(<abbr title="Illuminate\Http\Request">Request</abbr>)) in VerifyCsrfToken.php line 65</li> <li>at <abbr title="Illuminate\Foundation\Http\Middleware\VerifyCsrfToken">VerifyCsrfToken</abbr>->handle(object(<abbr title="Illuminate\Http\Request">Request</abbr>), object(<abbr title="Closure">Closure</abbr>)) in Pipeline.php line 137</li> <li>at <abbr title="Illuminate\Pipeline\Pipeline">Pipeline</abbr>->Illuminate\Pipeline\{closure}(object(<abbr title="Illuminate\Http\Request">Request</abbr>)) in Pipeline.php line 33</li> <li>at <abbr title="Illuminate\Routing\Pipeline">Pipeline</abbr>->Illuminate\Routing\{closure}(object(<abbr title="Illuminate\Http\Request">Request</abbr>)) in ShareErrorsFromSession.php line 49</li> <li>at <abbr title="Illuminate\View\Middleware\ShareErrorsFromSession">ShareErrorsFromSession</abbr>->handle(object(<abbr title="Illuminate\Http\Request">Request</abbr>), object(<abbr title="Closure">Closure</abbr>)) in Pipeline.php line 137</li> <li>at <abbr title="Illuminate\Pipeline\Pipeline">Pipeline</abbr>->Illuminate\Pipeline\{closure}(object(<abbr title="Illuminate\Http\Request">Request</abbr>)) in Pipeline.php line 33</li> <li>at <abbr title="Illuminate\Routing\Pipeline">Pipeline</abbr>->Illuminate\Routing\{closure}(object(<abbr title="Illuminate\Http\Request">Request</abbr>)) in StartSession.php line 64</li> <li>at <abbr title="Illuminate\Session\Middleware\StartSession">StartSession</abbr>->handle(object(<abbr title="Illuminate\Http\Request">Request</abbr>), object(<abbr title="Closure">Closure</abbr>)) in Pipeline.php line 137</li> <li>at <abbr title="Illuminate\Pipeline\Pipeline">Pipeline</abbr>->Illuminate\Pipeline\{closure}(object(<abbr title="Illuminate\Http\Request">Request</abbr>)) in Pipeline.php line 33</li> <li>at <abbr title="Illuminate\Routing\Pipeline">Pipeline</abbr>->Illuminate\Routing\{closure}(object(<abbr title="Illuminate\Http\Request">Request</abbr>)) in AddQueuedCookiesToResponse.php line 37</li> <li>at <abbr title="Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse">AddQueuedCookiesToResponse</abbr>->handle(object(<abbr title="Illuminate\Http\Request">Request</abbr>), object(<abbr title="Closure">Closure</abbr>)) in Pipeline.php line 137</li> <li>at <abbr title="Illuminate\Pipeline\Pipeline">Pipeline</abbr>->Illuminate\Pipeline\{closure}(object(<abbr title="Illuminate\Http\Request">Request</abbr>)) in Pipeline.php line 33</li> <li>at <abbr title="Illuminate\Routing\Pipeline">Pipeline</abbr>->Illuminate\Routing\{closure}(object(<abbr title="Illuminate\Http\Request">Request</abbr>)) in EncryptCookies.php line 59</li> <li>at <abbr title="Illuminate\Cookie\Middleware\EncryptCookies">EncryptCookies</abbr>->handle(object(<abbr title="Illuminate\Http\Request">Request</abbr>), object(<abbr title="Closure">Closure</abbr>)) in Pipeline.php line 137</li> <li>at <abbr title="Illuminate\Pipeline\Pipeline">Pipeline</abbr>->Illuminate\Pipeline\{closure}(object(<abbr title="Illuminate\Http\Request">Request</abbr>)) in Pipeline.php line 33</li> <li>at <abbr title="Illuminate\Routing\Pipeline">Pipeline</abbr>->Illuminate\Routing\{closure}(object(<abbr title="Illuminate\Http\Request">Request</abbr>)) in Pipeline.php line 104</li> <li>at <abbr title="Illuminate\Pipeline\Pipeline">Pipeline</abbr>->then(object(<abbr title="Closure">Closure</abbr>)) in Router.php line 644</li> <li>at <abbr title="Illuminate\Routing\Router">Router</abbr>->runRouteWithinStack(object(<abbr title="Illuminate\Routing\Route">Route</abbr>), object(<abbr title="Illuminate\Http\Request">Request</abbr>)) in Router.php line 618</li> <li>at <abbr title="Illuminate\Routing\Router">Router</abbr>->dispatchToRoute(object(<abbr title="Illuminate\Http\Request">Request</abbr>)) in Router.php line 596</li> <li>at <abbr title="Illuminate\Routing\Router">Router</abbr>->dispatch(object(<abbr title="Illuminate\Http\Request">Request</abbr>)) in Kernel.php line 268</li> <li>at <abbr title="Illuminate\Foundation\Http\Kernel">Kernel</abbr>->Illuminate\Foundation\Http\{closure}(object(<abbr title="Illuminate\Http\Request">Request</abbr>)) in Pipeline.php line 53</li> <li>at <abbr title="Illuminate\Routing\Pipeline">Pipeline</abbr>->Illuminate\Routing\{closure}(object(<abbr title="Illuminate\Http\Request">Request</abbr>)) in CheckForMaintenanceMode.php line 46</li> <li>at <abbr title="Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode">CheckForMaintenanceMode</abbr>->handle(object(<abbr title="Illuminate\Http\Request">Request</abbr>), object(<abbr title="Closure">Closure</abbr>)) in Pipeline.php line 137</li> <li>at <abbr title="Illuminate\Pipeline\Pipeline">Pipeline</abbr>->Illuminate\Pipeline\{closure}(object(<abbr title="Illuminate\Http\Request">Request</abbr>)) in Pipeline.php line 33</li> <li>at <abbr title="Illuminate\Routing\Pipeline">Pipeline</abbr>->Illuminate\Routing\{closure}(object(<abbr title="Illuminate\Http\Request">Request</abbr>)) in Pipeline.php line 104</li> <li>at <abbr title="Illuminate\Pipeline\Pipeline">Pipeline</abbr>->then(object(<abbr title="Closure">Closure</abbr>)) in Kernel.php line 150</li> <li>at <abbr title="Illuminate\Foundation\Http\Kernel">Kernel</abbr>->sendRequestThroughRouter(object(<abbr title="Illuminate\Http\Request">Request</abbr>)) in Kernel.php line 117</li> <li>at <abbr title="Illuminate\Foundation\Http\Kernel">Kernel</abbr>->handle(object(<abbr title="Illuminate\Http\Request">Request</abbr>)) in index.php line 53</li> <li>at <abbr title=""></abbr>require_once('G:\Laravel-Xampp7\htdocs\ecommerce\public\index.php') in server.php line 21</li> </ol> </div> </div> </body> </html>
your error says you are using rules undeclared static property of your model App\Image
if its static property you need to declare it in your model App\Image using
public static $rules = ['image' => 'required'];

Laravel 5 Ajax Internal Server Error 500

I am using this to get my Ajax post call to work in a Laravel 5 app:
<meta name="csrf-token" content="<?= csrf_token() ?>">
$.ajaxSetup({
headers: {
'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
}
});
request = $.ajax({
url: "/user",
type: "post", success:function(data){
},
data: {'email': email} ,beforeSend: function(data){console.log(data);}
});
I can see the token rendering correctly in the page source, but I still get the Internal Server Error 500 and the Ajax call fails. Any idea what is happening?
EDIT:
Ajax Output:
POST http://vidvalize.dev/user 500 (Internal Server Error)n.ajaxTransport.k.cors.a.crossDomain.send # jquery-2.1.4.min.js:4n.extend.ajax # jquery-2.1.4.min.js:4React.createClass.saveAndContinue # script.js:37u # react.min.js:12_.executeDispatch # react.min.js:16a # react.min.js:12s # react.min.js:12c # react.min.js:12r # react.min.js:16d.processEventQueue # react.min.js:12r # react.min.js:15i.handleTopLevel # react.min.js:15i # react.min.js:15o.perform # react.min.js:16d.batchedUpdates # react.min.js:13i # react.min.js:15v.dispatchEvent # react.min.js:15
Object {readyState: 0}abort: (a){var b=a||u;return c&&c.abort(b),x(0,b),this}always: (){return e.done(arguments).fail(arguments),this}complete: (){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this}done: (){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this}error: (){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this}fail: (){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this}getAllResponseHeaders: (){return 2===t?e:null}getResponseHeader: (a){var b;if(2===t){if(!f){f={};while(b=gb.exec(e))f[b[1].toLowerCase()]=b[2]}b=f[a.toLowerCase()]}return null==b?null:b}overrideMimeType: (a){return t||(k.mimeType=a),this}pipe: (){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()}progress: (){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this}promise: (a){return null!=a?n.extend(a,d):d}readyState: 4responseText: "<!DOCTYPE html>↵<html>↵ <head>↵ <meta charset="UTF-8" />↵ <meta name="robots" content="noindex,nofollow" />↵ <style>↵ /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */↵ html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}↵↵ html { background: #eee; padding: 10px }↵ img { border: 0; }↵ #sf-resetcontent { width:970px; margin:0 auto; }↵ .sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 }↵ .sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; }↵ .sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }↵ .sf-reset .clear_fix { display:inline-block; }↵ .sf-reset * html .clear_fix { height:1%; }↵ .sf-reset .clear_fix { display:block; }↵ .sf-reset, .sf-reset .block { margin: auto }↵ .sf-reset abbr { border-bottom: 1px dotted #000; cursor: help; }↵ .sf-reset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }↵ .sf-reset strong { font-weight:bold; }↵ .sf-reset a { color:#6c6159; cursor: default; }↵ .sf-reset a img { border:none; }↵ .sf-reset a:hover { text-decoration:underline; }↵ .sf-reset em { font-style:italic; }↵ .sf-reset h1, .sf-reset h2 { font: 20px Georgia, "Times New Roman", Times, serif }↵ .sf-reset .exception_counter { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; float: left; display: block; }↵ .sf-reset .exception_title { margin-left: 3em; margin-bottom: 0.7em; display: block; }↵ .sf-reset .exception_message { margin-left: 3em; display: block; }↵ .sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }↵ .sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;↵ -webkit-border-bottom-right-radius: 16px;↵ -webkit-border-bottom-left-radius: 16px;↵ -moz-border-radius-bottomright: 16px;↵ -moz-border-radius-bottomleft: 16px;↵ border-bottom-right-radius: 16px;↵ border-bottom-left-radius: 16px;↵ border-bottom:1px solid #ccc;↵ border-right:1px solid #ccc;↵ border-left:1px solid #ccc;↵ }↵ .sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px;↵ -webkit-border-top-left-radius: 16px;↵ -webkit-border-top-right-radius: 16px;↵ -moz-border-radius-topleft: 16px;↵ -moz-border-radius-topright: 16px;↵ border-top-left-radius: 16px;↵ border-top-right-radius: 16px;↵ border-top:1px solid #ccc;↵ border-right:1px solid #ccc;↵ border-left:1px solid #ccc;↵ overflow: hidden;↵ word-wrap: break-word;↵ }↵ .sf-reset a { background:none; color:#868686; text-decoration:none; }↵ .sf-reset a:hover { background:none; color:#313131; text-decoration:underline; }↵ .sf-reset ol { padding: 10px 0; }↵ .sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px;↵ -webkit-border-radius: 10px;↵ -moz-border-radius: 10px;↵ border-radius: 10px;↵ border: 1px solid #ccc;↵ }↵ </style>↵ </head>↵ <body>↵ <div id="sf-resetcontent" class="sf-reset">↵ <h1>Whoops, looks like something went wrong.</h1>↵ <h2 class="block_exception clear_fix">↵ <span class="exception_counter">1/1</span>↵ <span class="exception_title"><abbr title="Symfony\Component\Debug\Exception\FatalErrorException">FatalErrorException</abbr> in <a title="/home/vagrant/code/vidvalize/app/Http/Controllers/UserController.php line 5" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">UserController.php line 5</a>:</span>↵ <sp…>Illuminate\Pipeline\{closure}() in <a title="/home/vagrant/code/vidvalize/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php line 37" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">AddQueuedCookiesToResponse.php line 37</a></li>↵ <li>at <abbr title="Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse">AddQueuedCookiesToResponse</abbr>->handle() in <a title="/home/vagrant/code/vidvalize/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php line 124" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">Pipeline.php line 124</a></li>↵ <li>at <abbr title=""></abbr>call_user_func_array:{/home/vagrant/code/vidvalize/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124}() in <a title="/home/vagrant/code/vidvalize/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php line 124" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">Pipeline.php line 124</a></li>↵ <li>at <abbr title="Illuminate\Pipeline\Pipeline">Pipeline</abbr>->Illuminate\Pipeline\{closure}() in <a title="/home/vagrant/code/vidvalize/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php line 59" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">EncryptCookies.php line 59</a></li>↵ <li>at <abbr title="Illuminate\Cookie\Middleware\EncryptCookies">EncryptCookies</abbr>->handle() in <a title="/home/vagrant/code/vidvalize/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php line 124" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">Pipeline.php line 124</a></li>↵ <li>at <abbr title=""></abbr>call_user_func_array:{/home/vagrant/code/vidvalize/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124}() in <a title="/home/vagrant/code/vidvalize/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php line 124" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">Pipeline.php line 124</a></li>↵ <li>at <abbr title="Illuminate\Pipeline\Pipeline">Pipeline</abbr>->Illuminate\Pipeline\{closure}() in <a title="/home/vagrant/code/vidvalize/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php line 42" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">CheckForMaintenanceMode.php line 42</a></li>↵ <li>at <abbr title="Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode">CheckForMaintenanceMode</abbr>->handle() in <a title="/home/vagrant/code/vidvalize/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php line 124" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">Pipeline.php line 124</a></li>↵ <li>at <abbr title=""></abbr>call_user_func_array:{/home/vagrant/code/vidvalize/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:124}() in <a title="/home/vagrant/code/vidvalize/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php line 124" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">Pipeline.php line 124</a></li>↵ <li>at <abbr title="Illuminate\Pipeline\Pipeline">Pipeline</abbr>->Illuminate\Pipeline\{closure}() in <a title="/home/vagrant/code/vidvalize/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php line 103" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">Pipeline.php line 103</a></li>↵ <li>at <abbr title=""></abbr>call_user_func:{/home/vagrant/code/vidvalize/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103}() in <a title="/home/vagrant/code/vidvalize/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php line 103" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">Pipeline.php line 103</a></li>↵ <li>at <abbr title="Illuminate\Pipeline\Pipeline">Pipeline</abbr>->then() in <a title="/home/vagrant/code/vidvalize/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php line 118" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">Kernel.php line 118</a></li>↵ <li>at <abbr title="Illuminate\Foundation\Http\Kernel">Kernel</abbr>->sendRequestThroughRouter() in <a title="/home/vagrant/code/vidvalize/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php line 86" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">Kernel.php line 86</a></li>↵ <li>at <abbr title="Illuminate\Foundation\Http\Kernel">Kernel</abbr>->handle() in <a title="/home/vagrant/code/vidvalize/public/index.php line 54" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">index.php line 54</a></li>↵ <li>at <abbr title=""></abbr>{main}() in <a title="/home/vagrant/code/vidvalize/public/index.php line 0" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">index.php line 0</a></li>↵ </ol>↵</div>↵↵ </div>↵ </body>↵</html>"setRequestHeader: (a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this}state: (){return c}status: 500statusCode: (a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this}statusText: "Internal Server Error"success: (){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this}then: (){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()}__proto__: Object
There can be many reasons for internal server error. It would be helpful to narrow down the problem, if you can post entire ajax response.
But if you think, it has to do with csrf_token try sending it as a request data like below,
request = $.ajax({
url: "/user",
type: "post",
data: 'email=' + email + '&_token={{ csrf_token() }}',
beforeSend: function(data){console.log(data);},
success:function(data){}
});
Are there POST parameters you need to be sending?

Issue previewing pdf document created with Laravel DOM pdf

I am using barryvdh's library DOMPdf to generate pdf documents from html. My goal is to make it possible for users to preview their invoices as pdf before they submit the form. I am using Ajax to pass the data from the form to the controller. The controller receives the data from the form, but it returns an encoded string which I cannot decode and display. I would like to display the invoice on the same page in a pop-up, but it could also be made into a new window.
Any suggestions would be appreciated:
Javascript code:
$(document).on("click", ".viewAsPdf", function(){
var formID = $(this).closest("form").attr("id");
var formHTML = document.getElementById(formID).innerHTML;
var nettoTotal = "";
var vatTotal = "";
var bruttoTotal ="";
var formData = "";
var url="";
switch(formID){
case "demandOfferForm":
nettoTotal = $(formHTML).find("#demandOfferTotalNetto").text();
vatTotal = $(formHTML).find("#demandOfferTotalVat").text();
bruttoTotal = $(formHTML).find("#demandOfferTotalBrutto").text();
formData ="nettoTotal="+nettoTotal+"&vatTotal="+vatTotal+"&bruttoTotal="+bruttoTotal;
console.log(formData);
url ="../buy/newOffer/pdfOffer";
var pdf = doAjaxCall(url, formData);
break;
}
});
Ajax call
function doAjaxCall(url, formData){
$.ajax({
type : 'GET',
url: url,
data : formData,
})
.done(function(data) {
console.log(data);
$('#demandOfferForm').fadeOut();
$('#buyNewOffer').html(data);
})
// If the data hasn't beed received correct.
.fail(function(data) {
console.log(data);
});
}
Controller code
public function previewPDF(){
$nettoTotal = Input::get("nettoTotal");
$vatTotal = Input::get("vatTotal");
$grossTotal = Input::get("bruttoTotal");
$pdf = App::make('dompdf');
$pdfContent ='';
$pdfContent .='<DOCTYPE HTML><html>';
$pdfContent .='<head></head><body>';
// $pdfContent .='<head><link rel="stylesheet" href="http://localhost/freesoft_front/public/css/pdf.css" type="text/css"></head><body>';
$pdfContent .='<div class="pdfContent" style="position:absolute;">';
$pdfContent .='<div class="companyInfo" style="position:absolute;">';
$pdfContent .='<h4 style="padding:0; margin:0; text-align: right; line-height: 10px;">Faktura</h4>';
$pdfContent .='<div class="header">';
$pdfContent .='<div class="headerLeft" style="display: inline-block; width:50%; text-align: left;">';
$pdfContent .='<div class="logoContainer" style="height: 50px; border: 1px solid blue;"><p>Company logo goes here</p></div>';
$pdfContent .='<p>Hr. Hansen</p>';
$pdfContent .='<p>Strømvej 2</p>';
$pdfContent .='<br/> <p>5700 Svandeborg</p>';
$pdfContent .='</div>';
$pdfContent .='<div class="headerRight" style="display: inline-block; width:50%; text-align: right;"><p>DEMO Firma</p>';
$pdfContent .='<p> 9560 Hadslund</p>';
$pdfContent .='<p> Tlf: 44 55 90 17</p>';
$pdfContent .='<p> <strong> FAKTURA NR. : 18540 </strong></p>';
$pdfContent .='<br/> <p class="smallInput" style="font-size: 15px; line-height: 5px;">Dato: 15-09-2014</p>';
$pdfContent .='<p class="smallInput" style="font-size: 15px; line-height: 5px;">Forfaldsdato: 23-09-2014</p>';
$pdfContent .='</div>';
$pdfContent .='</div>';
// ------------end of header
$pdfContent .= '<div class="paymentDetails">';
$pdfContent .='<div class="detailsLeft" style="display: inline-block; width:50%; text-align: left;">';
$pdfContent .='<p class="smallInput" style="font-size: 15px; line-height: 5px;"> Kundenr.: 358</p><br/>';
$pdfContent .='<p class="smallInput" style="font-size: 15px; line-height: 5px;"> Betailngsbet.: 8 dage</p>';
$pdfContent .='<p class="smallInput" style="font-size: 15px; line-height: 5px;"> Rentebet.: 1,3% rente pr. påb. måned</p>';
$pdfContent .='</div>';
$pdfContent .='<div class="detailsRight" style="bottom:0px; display: inline-block; width:50%; text-align: right;">';
$pdfContent .='<p class="smallInput" style="font-size: 15px; line-height: 5px;"> Bank</p>';
$pdfContent .='<p class="smallInput" style="font-size: 15px; line-height: 5px;">Kontonr.: 9999 0001234567</p>';
$pdfContent .='</div>';
$pdfContent .= '</div>';
// ------------end of paymentDetails
$pdfContent .='<div class="invoiceLines">';
$pdfContent .='<div class="linesHeading" style="border-top:1px solid black; border-bottom: 1px solid black;">';
$pdfContent .='<p style="line-height:5px;">Tekst <span style="margin:0px 0px 0px 350px;">Antal</span> <span style="margin:0px 0px 0px 75px;"> A pris</span> <span style="margin:0px 0px 0px 75px;">Nettobeløb</span></p>';
$pdfContent .='</div>';
// foreach ($lines as $index => $line) {
// $pdfContent .='<p class="line"><span style="display: inline-block; width:55%;">'.$line -> ItemName_Line .'</span> <span style="display: inline-block; width:15%;">'. $line -> Quantity_Line .'</span> <span style="display: inline-block; width:17%;">'.$line -> Price_Line.'</span> <span style="display:inline-block; width:10%; text-align:right;">'.$line -> Netto_Total_Line.'</span></p>';
// }
$pdfContent .='</div>';
// --------------end of invoice lines
$pdfContent .='<div style="border-top:1px solid black; border-bottom: 1px solid black; position:absolute; bottom:0;">';
$pdfContent .='<p style="line-height:8px;"> <span style="display:inline-block;width:41%;"> Nettobeløb </span> <span style="display:inline-block; width:43.5%;"> Momsbeløb </span> <span style="text-align:right; display:inline-block; width:14%;"> Totalbeløb</span></p>';
$pdfContent .='<p style="line-height:2px;"> <span style="display:inline-block;width:41.5%;"> '.$nettoTotal.' </span> <span style="display:inline-block; width:43%;"> '.$vatTotal.' </span> <strong> <span style="text-align:right; display:inline-block; width:13.5%;">'.$grossTotal.'</span></strong></p>';
$pdfContent .='</div>';
$pdfContent .='</div>';
$pdfContent .='</div>';
$pdfContent .='</html></body>';
$pdf->loadHTML($pdfContent);
return $pdf->stream();
}
Output snippet:
stream x����N�#��y����J�t�v�%E�R)�+�')ű�m�����'������9�����gc0�V��I�{F�c�T�d�e��d���?.һ��J?�#r��l��w��w2Z ��9\��C6� ��` G'#�Yҡ��>�U�e�k �/��������y�)aS�~����%' Rf&qV!��E��9Z�"�US=o��X�\��-���1-��*�͐U^Q�ek'B�v��',n�m:���s�M���a�cV�E6F���V(��x�|}��੥vDK��0��&6����r�K�c�N+c��!c����?Gѥ�6%����#���J-�P�R��(�u�gu�S2�ҵLH��ED.�h����vR���"�Ih�ۼ�ԫ�� K7����O��E�4�,?�Ơ5����?

jQuery function jumping up 10px if previously fired?

I have two jQuery functions that I've built and in testing them, I noticed that if the tabs are clicked while they have already been fired, they jump up about 10px, then jump back down to normal.
I have searched everywhere, and can't seem to find a solution that works.
I have the following code:
<div id="zoe">
<div class="floating-rim-container">
<a href="#">
<img src="images/rim-middle.png" class="floating-rim-wrapper-zoe" id="rim-7">
</a>
<a href="#">
<img src="images/rim-middle.png" class="floating-rim-wrapper-zoe" id="rim-8">
</a>
<a href="#">
<img src="images/rim-middle.png" class="floating-rim-wrapper-zoe" id="rim-9">
</a>
<a href="#">
<img src="images/rim-middle.png" class="floating-rim-wrapper-zoe" id="rim-10">
</a>
<a href="#">
<img src="images/rim-middle.png" class="floating-rim-wrapper-zoe" id="rim-11">
</a>
<a href="#">
<img src="images/rim-middle.png" class="floating-rim-wrapper-zoe" id="rim-12">
</a>
<div class="shadow-container">
<img src="images/shadow.png" class="shadow-zoe">
<img src="images/shadow.png" class="shadow-zoe">
<img src="images/shadow.png" class="shadow-zoe">
<img src="images/shadow.png" class="shadow-zoe">
<img src="images/shadow.png" class="shadow-zoe">
<img src="images/shadow.png" class="shadow-zoe">
</div>
</div>
</div>
I have this CSS:
.floating-rim-container {
width:960px;
height:300px;
margin:-295px auto;
vertical-align:top;
}
.floating-rim-wrapper-black,
.floating-rim-wrapper-zoe {
margin: 50px 0px;
padding: 0px 23px;
position:relative;
left:0;
}
.shadow-black, .shadow-zoe {
position:relative;
padding: 0px 8px;
}
#tab-container {
width:960px;
margin:0 auto;
font-family:'helvetica-light',Helvetica,Arial,sans-serif;
}
#blabel-tab {
background:#3d3d3d;
border-radius:0 0 15px 15px;
-webkit-border-radius:0 0 15px 15px;
border:1px solid rgba(0,0,0,0.6);
border-top:none;
padding:6px;
letter-spacing:2px;
position:relative;
z-index:100;
box-shadow:-2px 2px 4px 1px rgba(0,0,0,0.3);
-webkit-box-shadow:-2px 2px 4px 1px rgba(0,0,0,0.3);
}
#zoe-tab {
background:#3d3d3d;
margin:0px 15px;
border-radius:0 0 15px 15px;
-moz-border-radius:0 0 15px 15px;
-o-border-radius:0 0 15px 15px;
border:1px solid rgba(0,0,0,0.6);
border-top:none;
padding:6px;
position:relative;
z-index:15;
box-shadow:-2px 2px 4px 1px rgba(0,0,0,0.3);
-webkit-box-shadow:-2px 2px 4px 1px rgba(0,0,0,0.3);
}
#blabel-tab:hover, #zoe-tab:hover {
background:rgba(0,0,0,0.9);
}
#folder-placeholder {
width:960px;
height:275px;
margin:-26px auto;
background:#000;
position:absolute;
z-index:-1;
}
#folder-black {
width:960px;
background:#eee;
margin:-30px auto;
border-radius:0 0 10px 10px;
-webkit-border-radius:0 0 10px 10px;
}
#folder-zoe {
width:960px;
margin:0 auto;
background:#ccc;
position:relative;
top:4px;
z-index:1;
border-radius:0 0 10px 10px;
-webkit-border-radius:0 0 10px 10px;
}
#zoe {
position:relative;
z-index:20;
}
And this jQuery:
function blabel_init() {
$("#folder-black").show().animate({
"height" : "300px"
},600);
$("#blabel-tab").animate({
"top" : "295px"
},{
duration: 600,
complete: function() {
$("#blacklabel").fadeIn();
}
});
}
function blabel_switch() {
$("#zoe-tab").click(function() {
$("#blacklabel").fadeOut().promise().done(function() {
$("#folder-black").animate({
"height" : "0"
});
$("#blabel-tab").animate({
"top" : "0"
}).promise().done(function() {
$("#folder-zoe").animate({
"height" : "300px"
});
$("#zoe-tab").animate({
"top" : "300px"
},{
complete:function() {
$("#zoe").fadeIn();
}
});
});
});
return false;
});
}
function zoe_switch() {
$("#blabel-tab").click(function() {
$("#zoe").fadeOut().promise().done(function() {
$("#folder-zoe").animate({
"height" : "0"
});
$("#zoe-tab").animate({
"top" : "0"
}).promise().done(function() {
$("#folder-black").animate({
"height" : "300px"
});
$("#blabel-tab").animate({
"top" : "295px"
},{
complete:function() {
$("#blacklabel").fadeIn();
}
});
});
});
return false;
});
}
Any help would be hugely appreciated!
It can be seen at zoewheels.com/beta.
i think it is because of href="#"
try replacing with href="javascript:void(0)" . Also if href is not needed remove it

Multiple images per transition in jquery Cycle

I have the following HTML code:
<section class="gallery">
prev
next
<div class="holder">
<ul id="slider">
<li>
<img src="" alt="#" width="306" height="240" />
<span>Picture Title</span>
</li>
<li>
<img src="" alt="#" width="306" height="240" />
<span>Picture Title</span>
</li>
<li>
<img src="" alt="#" width="306" height="240" />
<span>Picture Title</span>
</li>
<li>
<img src="" alt="#" width="306" height="240" />
<span>Picture Title</span>
</li>
</ul>
</div>
</section>
And the following js:
$(document).ready(function(){
$('#slider').cycle({
fx:'scrollHorz',
timeout: 5000,
prev:'#link-prev',
next: '#link-next'
})
//$(".form-contact form").validate();
})
This works fine, but it shows just one picture, and if I want to see the following I click next, and if I want to see the previous, I click prev. How can I show more than one picture per transition?
Basically, like this example: scroll, but showing more than one picture per transition...
EDIT: The actual HTML I have when trying to have two pictures in each slide is this one:
<section class="gallery">
prev
next
<div class="holder">
<ul id="slider">
<div>
<img src="assets/content/pages/carrousell/UrbanFlame.jpg" alt="#" width="306" height="240" />
<img src="assets/content/pages/carrousell/TannourineRestaurant.jpg" alt="#" width="306" height="240" />
</div>
<div>
<img src="assets/content/pages/carrousell/PanchoVillaTaqueria.jpg" alt="#" width="306" height="240" />
<img src="assets/content/pages/carrousell/LaLanterna.jpg" alt="#" width="306" height="240" />
</div>
</ul>
</div>
</section>
And the CSS is this one:
.gallery .holder{
border-radius: 10px;
position:relative;
padding:4px 0 4px 0px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
}
.gallery #link-prev,
.gallery #link-next{
position:absolute;
width:47px;
height:83px;
text-indent:-9999px;
overflow:hidden;
top:75px;
z-index:99999;
background:url(navigati.png) no-repeat;
}
.gallery #link-prev{left:-19px;}
.gallery #link-next{right:-19px;}
.gallery #link-next{background-position:-48px 0;}
.gallery h3{
color:#33638b;
font-size:18px;
line-height:21px;
margin:0 0 1px;
text-align:center;
}
#slider{
padding:0;
width:306px;
margin: 0 auto;
}
#slider li{
list-style:none;
text-align:center;
color:#FFFFFF;
font-size:14px;
line-height:17px;
padding:0px 0 0;
width:306px;
}
#slider img{
position:relative;
}
#slider span{
width:286px;
display:block;
padding:20px 10px;
background:url(../images/slider_span_bg.jpg) repeat-x left top; height:18px;}
#slider a{color:#33638b; font-family:Arial, Helvetica, sans-serif; color:#fff; font-size:18px;}
What's inside your <!-- picture link !--> blocks?
According to the Cycle documentation (and samples) the markup should be like this:
<div id="slider">
<img src="image1.jpg" />
<img src="image2.jpg" />
<img src="image3.jpg" />
<!-- ... -->
</div>
EDIT:
Two pictures in one transition
var curElement = null;
$('#s1').cycle({
fx: 'scrollHorz',
prev: '#prev1',
next: '#next1',
timeout: 0,
after: function(currSlideElement, nextSlideElement, options, forwardFlag)
{
if (forwardFlag === 1 && (currSlideElement != curElement || curElement == null))
{
curElement = nextSlideElement;
$("#next1").trigger('click');
}
else if ( forwardFlag === 0 && (currSlideElement != curElement || curElement == null))
{
curElement = nextSlideElement;
$("#prev1").trigger('click');
}
}
});
EDIT 2
The problem is a #slider style. Set its width to f.e. 620px
#slider{
padding:0;
width:620px;
margin: 0 auto;
}
I'm not sure that the Cycle plug-in will handle that without editing the source.
It looks like this option could be useful though:
onPrevNextEvent: null,// callback fn for prev/next events: function(isNext, zeroBasedSlideIndex, slideElement)
It seems like you should be able to trigger a next or prev click onPrevNextEvent.
Something like this:
$('#slider').cycle({
fx:'scrollHorz',
timeout: 5000,
prev:'#link-prev',
next: '#link-next',
onPrevNextEvent: function(isNext) {
if(isNext) {
$('#link-next').trigger('click');
} else {
$('#link-prev').trigger('click');
}
}
})

Resources