New answer
So after updating your question, now we know, you want to simply return JSON value when the news is not found. In this case, I would use route fallback method, which is executed when Laravel catches 404 exceptions. Good thing is, you need to implement this only once, and it will work for news/comments/users and all other things you have in your API. Add this code to your routes file:
Route::fallback(function(){
return response()->json(['message' => 'Not Found!'], 404);
});
More info - https://themsaid.com/laravel-55-better-404-response-20170921
===========================================================
Previous answer
Since you didn't specify what exactly you want to do, here are a couple of options:
Option 1 - custom error page
https://laravel.com/docs/5.5/errors#custom-http-error-pages
Option 2 - display default item
It will pass another object of News
type to your controller
<?php
namespace App\Providers;
use App\News;
use Illuminate\Support\Facades\Route;
class AppServiceProvider extends ServiceProvider
{
public function boot()
{
// 'news' comes from your route param name
Route::bind('news', function ($value) {
$news = News::where('id', $value)->first();
if ( ! $news) {
//assuming here the first item is the default one
$news = News::first();
}
return $news;
});
}
}
Option 3 - catch all 404s
You can catch all 404 errors and return whatever you want as described here How do I catch exceptions / missing pages in Laravel 5?