src/Repository/Repository.php
public function getNotificationContents($type = null)
    {
        return NotificationContents::select(['title', 'id'])
                        ->whereHas('lang', function($query) {
                            $query->where('code', locale());
                        })
                        ->whereHas('notification', function($query) use($type) {
                            if (is_null($type)) {
                                $query->whereHas('type', function($subquery) {
                                    $subquery->whereIn('name', ['sms', 'email']);
                                });
                            } elseif (is_numeric($type)) {
                                $query->where('type_id', $type);
                            } elseif (is_string($type)) {
                                $query->whereHas('type', function($subquery) use($type) {
                                    $subquery->where('name', $type);
                                });
                            }
                        })->get();
    }
public function getNotificationContents($type = null)
    {
        return NotificationContents::select(['title', 'id'])
                        ->whereHas('lang', function($query) {
                            $query->where('code', locale());
                        })
                        ->whereHas('notification', function($query) use($type) {
                            if (is_null($type)) {
                                $query->whereHas('type', function($subquery) {
                                    $subquery->whereIn('name', ['sms', 'email']);
                                });
                            } elseif (is_numeric($type)) {
                                $query->where('type_id', $type);
                            } elseif (is_string($type)) {
                                $query->whereHas('type', function($subquery) use($type) {
                                    $subquery->where('name', $type);
                                });
                            }
                        })->get();
    }
public function getNotificationContents ( $ type = null ) { return NotificationContents :: select ( [ 'title' , 'id' ] ) -> whereHas ( 'lang' , function ( $ query ) { $ query -> where ( 'code' , locale ( ) ) ; } ) -> whereHas ( 'notification' , function ( $ query ) use ( $ type ) { if ( is_null ( $ type ) ) { $ query -> whereHas ( 'type' , function ( $ subquery ) { $ subquery -> whereIn ( 'name' , [ 'sms' , 'email' ] ) ; } ) ; } elseif ( is_numeric ( $ type ) ) { $ query -> where ( 'type_id' , $ type ) ; } elseif ( is_string ( $ type ) ) { $ query -> whereHas ( 'type' , function ( $ subquery ) use ( $ type ) { $ subquery -> where ( 'name' , $ type ) ; } ) ; } } ) -> get ( ) ; }
Gets notification contents

@param String $type
@return \Antares\Support\Collection
Gets notification contents