1 month ago


Laravel class

Laravel class AjaxController extends Controller { public function index(){ $msg = "This is a simple message."; return response()->json(array('msg'=> $msg), 200); } } Step 5: Add the following lines in app/Http/routes.php. app/Http/routes.php Route::get('ajax',function(){ return view('message'); }); Route::post('/getmsg','AjaxController@index'); Step 6: Visit the following URL to test the Ajax functionality. http://localhost:8000/ajax Step 7: You will be redirected to a page where you will see a message as shown in the following image. Step 8: The output will appear as shown in the following image after clicking the button. 110

22. Laravel – Error Handling Laravel In Laravel all the exceptions are handled by app\Exceptions\Handler class. This class contains two methods — report and render. report() method report() method is used to report or log exception. It is also used to send log exceptions to external services like Sentry, Bugsnag etc. render() method render() method is used to render an exception into an HTTP response which will be sent back to browser. Beside these two methods, the app\Exceptions\Handler class contains an important property called “$dontReport”. This property takes an array of exception types that will not be logged. HTTP Exceptions Some exceptions describe HTTP error codes like 404, 500 etc. To generate such response anywhere in an application, you can use abort() method as follows. abort(404) Custom Error pages Laravel makes it very easy for us to use the custom error pages for each separate error codes. For example, if you want to design custom page for error code 404, you can create a view at resources/views/errors/404.blade.php. Same way, if you want to design error page for error code 500, it should be stored at resources/views/errors/500.blade.php. Example Step 1: Add the following lines in app/Http/routes.php. app/Http/routes.php Route::get('/error',function(){ abort(404); }); 111

Laravel Starter - PHP User Group (Myanmar)
090-056 Exam BrainDumps are Out - Download and Prepare
Download C# Tutorial (PDF Version) - Tutorials Point
IXP Manager Workshop V4 Deep Dive
CLAD Exam BrainDumps are Out - Download and Prepare
PHP 5 Recipes: A Problem-Solution Approach
Twitter Application Development For Dummies pdf
Overview of the workshop - Internet2 Middleware Initiative
Boost Test Library
PHPUnit and Drupal 8 - Bay Area Drupal Camp
Up-to-Date 102-400 Exam BrainDumps for Guaranteed Success