<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
use App\Models\Comment;
use App\Observers\CommentObserver;
class AppServiceProvider extends ServiceProvider
{
public function boot()
{
\Carbon\Carbon::setLocale('zh');
Schema::defaultStringLength(191);
Comment::observe(CommentObserver::class);
}
public function register()
{
\API::error(function (\Illuminate\Database\Eloquent\ModelNotFoundException $exception) {
abort(404);
});
\API::error(function (\Illuminate\Auth\Access\AuthorizationException $exception) {
abort(403, $exception->getMessage());
});
}
}