Showing posts with label laravel exception. Show all posts
Showing posts with label laravel exception. Show all posts

Saturday, February 11, 2017

Laravel throw/return custom exception/response

In Laravel it is very simple to handle exception and return custom error codes to view. Below is a example how you can return custom http header code.


<?php
namespace App\Http\Controllers;

use Request;

class TestController extends Controller { 
   public function test_function(Request $request) {
       return response("content", 430)->header('Content-Type', "text/html");
   }
}
?>