idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
51,800 | public function addBlockTop ( Request $ request ) { $ contents = File :: get ( $ request [ 'location' ] ) ; $ page = $ this -> page -> getById ( $ request [ 'page_id' ] ) ; $ this -> pageblock -> addBlockTop ( $ contents , $ page , $ request [ 'name' ] ) ; return 'success' ; } | Add Block From Location To Top of Page and Store to Database |
51,801 | public function edit ( User $ user ) { $ roles = Role :: all ( ) ; $ permissions = Permission :: all ( ) ; return view ( 'chuckcms::backend.users.edit' , compact ( 'user' , 'roles' , 'permissions' ) ) ; } | Show the edit user page . |
51,802 | public function index ( ) { $ templates = $ this -> template -> where ( 'active' , 1 ) -> where ( 'type' , 'default' ) -> get ( ) ; $ pages = $ this -> page -> get ( ) ; return view ( 'chuckcms::backend.templates.index' , compact ( 'templates' , 'pages' ) ) ; } | Show the dashboard - > templates > index |
51,803 | public function settings ( ) { $ pages = $ this -> page -> get ( ) ; $ site = $ this -> site -> first ( ) ; return view ( 'chuckcms::backend.settings.index' , compact ( 'pages' , 'site' ) ) ; } | Show the dashboard - > pages . |
51,804 | public function delete ( Request $ request ) { $ status = $ this -> form -> deleteById ( $ request -> get ( 'form_id' ) ) ; return $ status ; } | Delete the form . |
51,805 | public function entries ( $ slug ) { $ form = $ this -> form -> getBySlug ( $ slug ) ; $ entries = $ this -> formEntry -> getBySlug ( $ slug ) ; return view ( 'chuckcms::backend.forms.entries' , compact ( 'form' , 'entries' ) ) ; } | Show the form entries . |
51,806 | public function entry ( $ slug , $ id ) { $ form = $ this -> form -> getBySlug ( $ slug ) ; $ entry = $ this -> formEntry -> getById ( $ id ) ; return view ( 'chuckcms::backend.forms.entries.index' , compact ( 'form' , 'entry' ) ) ; } | Show the form entry . |
51,807 | protected function executeQuery ( $ endpoint ) { $ ch = curl_init ( $ endpoint ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , true ) ; $ responseContent = curl_exec ( $ ch ) ; $ httpStatus = curl_getinfo ( $ ch , CURLINFO_HTTP_CODE ) ; if ( $ responseContent === false || $ httpStatus != 200 ) { throw new MoneyExcept... | Executes the query to the API endpoint . |
51,808 | protected function getXML ( ) { if ( $ this -> fetchedTimestamp !== null && ( time ( ) < $ this -> fetchedTimestamp + self :: FETCH_CACHE_TIME ) && $ this -> fetchedData !== null ) { return $ this -> fetchedData ; } $ curlHandle = curl_init ( ) ; curl_setopt ( $ curlHandle , CURLOPT_RETURNTRANSFER , 1 ) ; curl_setopt (... | Get the XML from ECB website - and cache it for some time |
51,809 | public function localizedFormatMoney ( Money $ money , $ locale = null , \ NumberFormatter $ numberFormatter = null ) { if ( ! ( $ numberFormatter instanceof \ NumberFormatter ) ) { $ numberFormatter = $ this -> getDefaultNumberFormatter ( $ money -> getCurrency ( ) -> getCode ( ) , $ locale ) ; } return $ numberFormat... | Format money with the NumberFormatter class |
51,810 | public function asFloat ( Money $ money ) { $ amount = $ money -> getAmount ( ) ; $ amount = ( float ) $ amount ; $ amount = $ amount / pow ( 10 , $ this -> decimals ) ; return $ amount ; } | Returns the amount for the given Money object as simple float |
51,811 | public function getChartData ( ) { $ rows = FeedbackContactUs :: where ( 'created_at' , '>=' , $ this -> inputDateFrom ( ) . '%' ) -> where ( 'created_at' , '<=' , $ this -> inputDateTo ( ) . ' 23:59:59' ) -> orderBy ( 'created_at' ) -> get ( ) ; $ days = $ rows -> groupBy ( function ( $ row ) { return $ row -> create... | Return the data formatted for chart |
51,812 | public function getTableData ( ) { $ items = FeedbackContactUs :: selectRaw ( '*, DATE_FORMAT(created_at, "%d %b, %Y ") as date' ) -> where ( 'created_at' , '>=' , $ this -> inputDateFrom ( ) . '%' ) -> where ( 'created_at' , '<=' , $ this -> inputDateTo ( ) . ' 23:59:59' ) -> orderBy ( 'created_at' ) -> get ( ) ; ret... | Get the data - datatables |
51,813 | public function toDatabase ( $ notifiable ) { return [ 'message' => $ this -> contactUs -> fullname . ' submitted contact us.' , 'id' => $ this -> contactUs -> id , 'type' => get_class ( $ this -> contactUs ) , ] ; } | Notify via Database |
51,814 | protected static function bootSlugUniqueModels ( ) { foreach ( [ 'creating' , 'updating' ] as $ event ) { static :: $ event ( function ( $ model ) use ( $ event ) { if ( ! property_exists ( $ model , 'buildSlugFrom' ) ) { $ model -> setSlugAttribute ( $ model -> title ) ; } else { $ column = $ model -> buildSlugFrom ; ... | On create and update set the slug |
51,815 | private function makeSlugUnique ( $ slug ) { $ slug = str_slug ( $ slug ) ; $ slugUpdate = $ this -> checkUpdatingSlug ( $ slug ) ; if ( $ slugUpdate !== false ) { return $ slugUpdate ; } $ list = $ this -> getExistingSlugs ( $ slug ) ; if ( $ list -> count ( ) === 0 ) { return $ slug ; } return $ this -> generateSuffi... | Make Slug Unique in same table |
51,816 | private function generateSuffix ( $ slug , $ list ) { $ index = $ list -> map ( function ( $ s ) use ( $ slug ) { return intval ( str_replace ( $ slug . '-' , '' , $ s ) ) ; } ) -> sort ( ) -> last ( ) ; return $ slug . '-' . ( $ index + 1 ) ; } | Suffix unique index to slug |
51,817 | public function socialMedia ( Request $ request ) { $ url = substr ( input ( 'url' ) , strlen ( config ( 'app.url' ) ) ) ; $ page = Page :: where ( 'url' , $ url ) -> first ( ) ; if ( $ page ) { $ page -> increment ( 'social_shares' ) ; } return json_response ( ) ; } | Logs the social media clicks |
51,818 | private function addAllRolesToUser ( $ user ) { $ roles = Role :: whereBetween ( 'id' , [ 2 , 7 ] ) -> pluck ( 'keyword' , 'id' ) -> values ( ) ; $ user -> syncRoles ( $ roles ) ; } | Add all the roles to the user |
51,819 | public function store ( Request $ request ) { $ attributes = request ( ) -> validate ( Settings :: $ rules , Settings :: $ messages ) ; $ setting = $ this -> createEntry ( Settings :: class , $ attributes ) ; log_activity ( 'Setting Created' , 'A Setting was successfully created' , $ setting ) ; return redirect_to_reso... | Store a newly created setting in storage . |
51,820 | public function update ( Settings $ setting , Request $ request ) { $ attributes = request ( ) -> validate ( Settings :: $ rules , Settings :: $ messages ) ; $ setting = $ this -> updateEntry ( $ setting , $ attributes ) ; settings ( true ) ; log_activity ( 'Setting Updated' , 'A Setting was successfully updated' , $ s... | Update the specified setting in storage . |
51,821 | public function destroy ( Settings $ setting , Request $ request ) { $ this -> deleteEntry ( $ setting , $ request ) ; log_activity ( 'Setting Deleted' , 'A Setting was successfully deleted' , $ setting ) ; return redirect_to_resource ( ) ; } | Remove the specified setting from storage . |
51,822 | public function store ( ) { $ attributes = request ( ) -> validate ( Banner :: $ rules , Banner :: $ messages ) ; $ attributes [ 'hide_name' ] = boolval ( input ( 'hide_name' ) ) ; $ attributes [ 'is_website' ] = boolval ( input ( 'is_website' ) ) ; $ photo = $ this -> uploadBanner ( $ attributes [ 'photo' ] ) ; if ( $... | Store a newly created banner in storage . |
51,823 | public function destroy ( Banner $ banner , Request $ request ) { $ banner -> update ( [ 'list_order' => 999 ] ) ; $ this -> deleteEntry ( $ banner , $ request ) ; return redirect_to_resource ( ) ; } | Remove the specified banner from storage . |
51,824 | static public function mainNavigation ( $ hidden = 0 ) { $ builder = self :: where ( 'parent_id' , 0 ) -> where ( 'is_main' , 1 ) ; if ( $ hidden != 1 ) { $ builder -> where ( 'is_hidden' , $ hidden ) ; } return $ builder -> orderBy ( 'list_main_order' ) -> get ( ) ; } | Get the top main level menu |
51,825 | public function update ( Request $ request ) { $ items = json_decode ( $ request -> get ( 'list' ) , true ) ; foreach ( $ items as $ key => $ item ) { Banner :: find ( $ item [ 'id' ] ) -> update ( [ 'list_order' => ( $ key + 1 ) ] ) ; } return [ 'result' => 'success' ] ; } | Update the order |
51,826 | public function index ( Page $ page ) { save_resource_url ( ) ; $ page -> load ( 'sections' ) ; return $ this -> view ( 'titan::pages.components.page_components' ) -> with ( 'page' , $ page ) ; } | Display a listing of content . |
51,827 | public function edit ( Page $ page , PageContent $ content ) { return $ this -> view ( 'titan::pages.components.content' ) -> with ( 'page' , $ page ) -> with ( 'item' , $ content ) ; } | Show the form for editing the specified content . |
51,828 | public function update ( Page $ page , PageContent $ content ) { if ( is_null ( request ( ) -> file ( 'media' ) ) ) { $ attributes = request ( ) -> validate ( array_except ( PageContent :: $ rules , 'media' ) , PageContent :: $ messages ) ; } else { $ attributes = request ( ) -> validate ( PageContent :: $ rules , Page... | Update the specified content in storage . |
51,829 | public function destroy ( Page $ page , PageContent $ section ) { $ this -> deleteEntry ( $ section , request ( ) ) ; log_activity ( 'Page Component Deleted' , 'A Page Content was successfully removed from the Page' , $ section ) ; return redirect_to_resource ( ) ; } | Remove the specified content from storage . |
51,830 | private function monthlyComparison ( $ metrics = 'ga:users' ) { $ thisMonth = $ this -> monthlySummary ( $ metrics ) ; $ lastMonth = $ this -> monthlySummary ( $ metrics , '-month_1' ) ; return json_response ( [ 'month' => [ 'value' => $ thisMonth , 'color' => "#00c0ef" , 'highlight' => "#00a7d0" , 'label' => "Current"... | Get this and last month of the metrics for a comparison |
51,831 | private function analyticsDuration ( ) { $ start = input ( 'start' , date ( 'Y-m-d' , strtotime ( '-29 days' ) ) ) ; $ end = input ( 'end' , date ( 'Y-m-d' ) ) ; if ( is_string ( $ start ) ) { $ start = \ DateTime :: createFromFormat ( 'Y-m-d' , $ start ) ; } if ( is_string ( $ end ) ) { $ end = \ DateTime :: createFro... | Get the duration for the analytics |
51,832 | private function getDataSet ( $ label , $ data , $ index = 0 ) { $ set = $ this -> datasets [ $ index ] ; $ set [ 'label' ] = $ label ; $ set [ 'data' ] = $ data ; return $ set ; } | Get the line dataset opbject |
51,833 | private function getPieDataSet ( $ label , $ data , $ index = - 1 ) { if ( $ index < 0 ) { $ index = rand ( 0 , count ( $ this -> pieData ) - 1 ) ; } $ set = $ this -> pieData [ $ index ] ; $ set [ 'label' ] = $ label ; $ set [ 'value' ] = $ data ; return $ set ; } | Get the pie chart data |
51,834 | private function captchaResponse ( $ response ) { $ errors = [ 'g-recaptcha-response' => [ 'Oops, something went wrong' ] ] ; foreach ( $ response -> getErrorCodes ( ) as $ k => $ code ) { if ( $ code == 'missing-input-response' ) { $ code = 'Please confirm you are not a robot.' ; } $ errors [ 'g-recaptcha-response' ] ... | Get the captcha json responses |
51,835 | protected function setBreadcrumb ( ) { $ url = config ( 'app.url' ) ; $ navItems = $ this -> urlParentNavs ; $ this -> breadcrumbItems = collect ( ) ; foreach ( $ navItems as $ k => $ page ) { $ this -> addBreadcrumbLink ( $ page -> title , $ page -> url , $ page -> icon ) ; } if ( $ word = $ this -> checkIfReservedWor... | Generate the breadcrumbs |
51,836 | public function addBreadcrumbLink ( $ name , $ url = '' , $ icon = '' ) { $ this -> breadcrumbItems -> push ( ( object ) [ 'name' => $ name , 'url' => $ url , 'icon' => $ icon ] ) ; } | Add bread crumb items |
51,837 | public function setPagecrumb ( ) { $ url = config ( 'app.url' ) ; $ navItems = $ this -> urlParentNavs ; $ this -> pagecrumbItems = collect ( ) ; if ( $ this -> selectedNavigation ) { $ this -> addPagecrumbLink ( $ this -> selectedNavigation -> title , $ this -> selectedNavigation -> url , $ this -> selectedNavigation ... | Set page crumbs |
51,838 | public function addPagecrumbLink ( $ name , $ url = '' , $ icon = '' ) { $ this -> pagecrumbItems -> push ( ( object ) [ 'name' => $ name , 'url' => $ url , 'icon' => $ icon ] ) ; } | Add page crumb items |
51,839 | protected function checkIfReservedWordInUrl ( $ url = false ) { $ sections = $ this -> getCurrentUrlSections ( ) ; if ( count ( $ sections ) >= 1 ) { $ last = intval ( $ sections [ count ( $ sections ) - 1 ] ) ; } $ keywords = [ 'show' , 'create' , 'edit' , ] ; foreach ( $ sections as $ key => $ slug ) { if ( in_array ... | Check if one of the keywords are in the url |
51,840 | protected function setSelectedNavigation ( ) { $ url = $ this -> getCurrentUrl ( ) ; $ sections = $ this -> getCurrentUrlSections ( ) ; if ( $ url === false ) { $ nav = NavigationAdmin :: whereSlug ( '/' ) -> get ( ) -> last ( ) ; } else { $ nav = NavigationAdmin :: where ( 'url' , '=' , $ url ) -> orderBy ( 'is_hidden... | Set the Current Navigation Find the navigations parents and url parents |
51,841 | protected function showIndex ( $ view = '' ) { $ items = $ this -> getTableRows ( ) ; $ ajax = count ( $ items ) > 150 ? 'true' : 'false' ; return $ this -> view ( $ view , compact ( 'ajax' ) ) -> with ( 'items' , $ ajax == 'true' ? [ ] : $ items ) ; } | Get the items check if we use ajax or send items to view Return the index view |
51,842 | public function store ( Request $ request ) { $ this -> validate ( $ request , ArticleCategory :: $ rules , ArticleCategory :: $ messages ) ; $ this -> createEntry ( ArticleCategory :: class , $ request -> only ( 'name' ) ) ; return redirect_to_resource ( ) ; } | Store a newly created article_category in storage . |
51,843 | public function update ( ArticleCategory $ category , Request $ request ) { $ this -> validate ( $ request , ArticleCategory :: $ rules , ArticleCategory :: $ messages ) ; $ this -> updateEntry ( $ category , $ request -> only ( 'name' ) ) ; return redirect_to_resource ( ) ; } | Update the specified article_category in storage . |
51,844 | public function destroy ( ArticleCategory $ category , Request $ request ) { $ this -> deleteEntry ( $ category , $ request ) ; return redirect_to_resource ( ) ; } | Remove the specified article_category from storage . |
51,845 | public function getTitleUrlAttribute ( ) { $ name = $ this -> attributes [ 'title' ] . ' ( ' . $ this -> attributes [ 'url' ] . ' )' ; if ( $ this -> parent ) { $ name .= " - {$this->parent->title}" ; } return $ name ; } | Get a the title + url concatenated |
51,846 | public function getSummaryAttribute ( ) { $ value = $ this -> attributes [ 'summary' ] ; return strip_tags ( strlen ( $ value ) > 5 ? $ value : substr ( $ this -> attributes [ 'content' ] , 0 , 200 ) ) ; } | Get the summary text |
51,847 | public function store ( ) { $ attributes = request ( ) -> validate ( NewsletterSubscriber :: $ rules , NewsletterSubscriber :: $ messages ) ; $ subscriber = $ this -> createEntry ( NewsletterSubscriber :: class , $ attributes ) ; return redirect_to_resource ( ) ; } | Store a newly created newsletter_user in storage . |
51,848 | public function update ( NewsletterSubscriber $ subscriber ) { $ attributes = request ( ) -> validate ( NewsletterSubscriber :: $ rules , NewsletterSubscriber :: $ messages ) ; $ subscriber = $ this -> updateEntry ( $ subscriber , $ attributes ) ; return redirect_to_resource ( ) ; } | Update the specified newsletter_user in storage . |
51,849 | public function index ( ) { save_resource_url ( ) ; $ items = Photo :: with ( 'photoable' ) -> get ( ) ; return $ this -> view ( 'titan::photos.index' ) -> with ( 'items' , $ items ) ; } | Display a listing of photo . |
51,850 | public function updatePhotoCover ( Photo $ photo ) { Photo :: where ( 'photoable_id' , input ( 'photoable_id' ) ) -> where ( 'photoable_type' , input ( 'photoable_type' ) ) -> update ( [ 'is_cover' => false ] ) ; $ photo -> update ( [ 'is_cover' => true ] ) ; return json_response ( ) ; } | Update the album s cover image |
51,851 | public function destroy ( Photo $ photo ) { $ this -> deleteEntry ( $ photo , request ( ) ) ; log_activity ( 'Photo Deleted' , 'A Photo was successfully deleted' , $ photo ) ; return redirect_to_resource ( ) ; } | Remove the specified photo from storage . |
51,852 | public function images ( $ limit = 50 ) { if ( count ( $ this -> imagesTagged ) >= 1 ) { return $ this -> imagesTagged ; } $ parent = str_replace ( 'AppModels' , '' , stripslashes ( static :: class ) ) ; $ rows = DB :: select ( "SELECT images.*, image_tag.id as image_tag_id, image_tag.is_cover FROM $this->ta... | Get the images tagged to this model |
51,853 | public function index ( ) { save_resource_url ( ) ; $ items = Document :: with ( 'documentable' ) -> get ( ) ; return $ this -> view ( 'titan::documents.index' ) -> with ( 'items' , $ items ) ; } | Display a listing of document . |
51,854 | public function showCategory ( DocumentCategory $ category ) { $ documents = $ category -> documents ; return $ this -> showDocumentable ( $ category , $ documents ) ; } | Show the category s documents |
51,855 | public function edit ( $ user ) { $ user = User :: find ( $ user ) ; if ( ! $ user ) { return redirect_to_resource ( ) ; } $ roles = Role :: getAllLists ( ) ; return $ this -> view ( 'titan::clients.create_edit' ) -> with ( 'item' , $ user ) -> with ( 'roles' , $ roles ) ; } | Show the form for editing the specified client . |
51,856 | public function destroy ( $ user ) { $ user = User :: find ( $ user ) ; if ( ! $ user ) { return redirect_to_resource ( ) ; } $ this -> deleteEntry ( $ user , request ( ) ) ; return redirect_to_resource ( ) ; } | Remove the specified client from storage . |
51,857 | public function confirmAccount ( $ token ) { $ user = User :: where ( 'confirmation_token' , $ token ) -> first ( ) ; if ( $ user ) { if ( $ user -> confirmed_at && strlen ( $ user -> confirmed_at ) > 6 ) { alert ( ) -> info ( 'Account is Active' , 'Your account is already active, please try to sign in.' ) ; } else { $... | User click on register confirmation link in mail |
51,858 | public function update ( ) { $ attributes = request ( ) -> validate ( [ 'firstname' => 'required' , 'lastname' => 'required' , 'email' => 'required|email|' . Rule :: unique ( 'users' ) -> ignore ( user ( ) -> id ) , 'password' => 'nullable|min:4|confirmed' , 'cellphone' => 'nullable' , ] ) ; user ( ) -> update ( [ 'fir... | Update the user s profile info |
51,859 | private function getPopupEloquentEntry ( $ resource , $ limit = 1 , $ offset = 0 ) { $ eloquent = $ this -> eloqent ( $ resource ) ; $ builder = $ eloquent :: active ( ) -> where ( 'is_popup' , 1 ) -> orderBy ( 'active_from' , 'DESC' ) -> offset ( $ offset ) ; if ( $ limit == 1 ) { return $ builder -> first ( ) ; } ret... | Get a featured item |
51,860 | public function getCoverPhotoAttribute ( ) { $ photos = $ this -> photos ; if ( $ photos -> count ( ) >= 1 ) { $ photo = $ photos -> where ( 'is_cover' , true ) -> first ( ) ; if ( $ photo ) { return $ photo ; } return $ photos -> first ( ) ; } return false ; } | Get the cover photo attribute |
51,861 | public function edit ( News $ news ) { $ categories = NewsCategory :: getAllList ( ) ; return $ this -> view ( 'titan::news_events.create_edit' , compact ( 'categories' ) ) -> with ( 'item' , $ news ) ; } | Show the form for editing the specified news . |
51,862 | public function update ( News $ news , Request $ request ) { $ attributes = request ( ) -> validate ( News :: $ rules , News :: $ messages ) ; $ news = $ this -> updateEntry ( $ news , $ attributes ) ; return redirect_to_resource ( ) ; } | Update the specified news in storage . |
51,863 | public function destroy ( News $ news , Request $ request ) { $ this -> deleteEntry ( $ news , $ request ) ; return redirect_to_resource ( ) ; } | Remove the specified news from storage . |
51,864 | public function index ( User $ user , $ unread = false ) { $ notifications = [ ] ; $ rows = $ user -> notifications ; if ( $ unread ) { $ rows = $ user -> unreadNotifications ; } foreach ( $ rows as $ k => $ notification ) { $ notifications [ ] = [ 'id' => $ notification -> id , 'created_at' => $ notification -> create... | Get all the notifications for a user |
51,865 | public function getVisitorsLocations ( ) { $ period = $ this -> analyticsDuration ( ) ; $ data = Analytics :: performQuery ( $ period , 'ga:sessions' , [ 'dimensions' => 'ga:country' , 'sort' => '-ga:sessions' , 'max-results' => 50 ] ) ; $ items = [ ] ; if ( $ data -> rows ) { $ items = $ data -> rows ; } foreach ( $ i... | Get the sessions grouped by country |
51,866 | public function store ( ) { $ attributes = request ( ) -> validate ( Page :: $ rules , Page :: $ messages ) ; $ attributes [ 'is_header' ] = boolval ( input ( 'is_header' ) ) ; $ attributes [ 'is_hidden' ] = boolval ( input ( 'is_hidden' ) ) ; $ attributes [ 'is_footer' ] = boolval ( input ( 'is_footer' ) ) ; $ attribu... | Store a newly created page in storage . |
51,867 | public function update ( Page $ page ) { $ attributes = request ( ) -> validate ( Page :: $ rules , Page :: $ messages ) ; $ attributes [ 'is_header' ] = boolval ( input ( 'is_header' ) ) ; $ attributes [ 'is_hidden' ] = boolval ( input ( 'is_hidden' ) ) ; $ attributes [ 'is_footer' ] = boolval ( input ( 'is_footer' ) ... | Update the specified page in storage . |
51,868 | public function setConfirmationTokenAttribute ( $ value ) { if ( is_null ( $ value ) ) { $ this -> attributes [ 'confirmation_token' ] = null ; } else { $ this -> attributes [ 'confirmation_token' ] = $ this -> getUniqueConfirmationToken ( ) ; } } | Set the unique confirmation_token |
51,869 | private function showList ( $ category = null ) { $ eloquent = $ this -> eloqent ( ) ; $ builder = $ eloquent :: with ( 'category' ) -> active ( ) ; if ( $ category && strlen ( $ category ) > 2 ) { $ category = $ this -> eloqentCategory ( ) -> where ( 'slug' , $ category ) -> first ( ) ; if ( ! $ category ) { return re... | Display all the active resources |
51,870 | private function getResource ( $ category ) { $ category = $ this -> eloqentCategory ( ) -> where ( 'slug' , $ category ) -> first ( ) ; if ( ! $ category ) { return redirect ( $ this -> URLPrefix ) ; } $ eloquent = $ this -> eloqent ( ) ; $ url = '/' . ltrim ( $ this -> getCurrentUrl ( ) , '/' ) ; $ item = $ eloquent ... | Get the current resource |
51,871 | private function setPageHeaders ( $ resource ) { $ this -> title = $ resource -> title ; $ this -> pageTitle = $ resource -> category -> title ; $ this -> description = $ resource -> title . ' ' . $ resource -> summary ; $ this -> image = ltrim ( uploaded_images_url ( $ resource -> image ) , '/' ) ; $ this -> addBreadc... | Set HTML Page Headers |
51,872 | private function categoriesHTML ( $ category = null ) { $ categories = $ this -> eloqentCategory ( ) -> all ( ) ; $ total = $ this -> eloqent ( ) -> active ( ) -> count ( ) ; $ categoryId = 0 ; if ( $ category ) { $ categoryId = $ category -> id ; } $ relationship = $ this -> view ; $ title = 'All <span>(' . $ total . ... | Get the categories HTML |
51,873 | public function getReferrers ( ) { $ dates = $ this -> getStartEndDate ( ) ; $ items = LaravelAnalytics :: getTopReferrersForPeriod ( $ dates [ 'start' ] , $ dates [ 'end' ] , 30 ) ; return $ items ; } | Get the top referrers for duration |
51,874 | public function getVisitedPages ( ) { $ dates = $ this -> getStartEndDate ( ) ; $ items = LaravelAnalytics :: getMostVisitedPagesForPeriod ( $ dates [ 'start' ] , $ dates [ 'end' ] ) ; return $ items ; } | Get the most visited pages for duration |
51,875 | private function getStartEndDate ( ) { $ start = input ( 'start' , date ( 'Y-m-d' , strtotime ( '-29 days' ) ) ) ; $ end = input ( 'end' , date ( 'Y-m-d' ) ) ; if ( is_string ( $ start ) ) { $ start = \ DateTime :: createFromFormat ( 'Y-m-d' , $ start ) ; } if ( is_string ( $ end ) ) { $ end = \ DateTime :: createFromF... | Get the start and end duration |
51,876 | public function store ( Request $ request ) { $ attributes = request ( ) -> validate ( NewsCategory :: $ rules , NewsCategory :: $ messages ) ; $ category = $ this -> createEntry ( NewsCategory :: class , $ attributes ) ; return redirect_to_resource ( ) ; } | Store a newly created news_category in storage . |
51,877 | public function update ( NewsCategory $ category , Request $ request ) { $ attributes = request ( ) -> validate ( NewsCategory :: $ rules , NewsCategory :: $ messages ) ; $ category = $ this -> updateEntry ( $ category , $ attributes ) ; return redirect_to_resource ( ) ; } | Update the specified news_category in storage . |
51,878 | public function destroy ( NewsCategory $ category , Request $ request ) { $ this -> deleteEntry ( $ category , $ request ) ; return redirect_to_resource ( ) ; } | Remove the specified news_category from storage . |
51,879 | public function show ( $ newsSlug ) { $ item = News :: with ( 'photos' ) -> where ( 'slug' , $ newsSlug ) -> first ( ) ; if ( ! $ item ) { return redirect ( '/news-and-events' ) ; } $ this -> addBreadcrumbLink ( $ item -> title , false ) ; return $ this -> view ( 'titan::news_events.news_event_show' ) -> with ( 'news' ... | Show News and Events |
51,880 | public function getIsActiveLabelAttribute ( ) { $ title = 'Not Active' ; $ class = 'danger' ; $ from = Carbon :: parse ( $ this -> active_from ) ; $ to = Carbon :: parse ( $ this -> active_to ) ; if ( ! $ this -> active_to || Carbon :: now ( ) -> diffInMinutes ( $ to , false ) > 0 ) { if ( Carbon :: now ( ) -> diffInMi... | Get the is active label attribute |
51,881 | public function create ( ) { $ roles = Role :: getAllLists ( ) ; $ parents = NavigationAdmin :: getAllLists ( ) ; return $ this -> view ( 'titan::settings.navigation.add_edit' ) -> with ( 'roles' , $ roles ) -> with ( 'parents' , $ parents ) ; } | Show the form for creating a new navigation . |
51,882 | public function store ( Request $ request ) { $ this -> validate ( $ request , NavigationAdmin :: $ rules , NavigationAdmin :: $ messages ) ; $ inputs = $ request -> only ( [ 'icon' , 'title' , 'slug' , 'description' , 'help_index_title' , 'help_index_content' , 'help_create_title' , 'help_create_content' , 'help_edit_... | Store a newly created navigation in storage . |
51,883 | public function show ( $ id ) { $ navigation = NavigationAdmin :: findOrFail ( $ id ) ; return $ this -> view ( 'titan::settings.navigation.show' ) -> with ( 'item' , $ navigation ) ; } | Display the specified navigation . |
51,884 | public function edit ( $ id ) { $ roles = Role :: getAllLists ( ) ; $ navigation = NavigationAdmin :: findOrFail ( $ id ) ; return $ this -> view ( 'titan::settings.navigation.add_edit' ) -> with ( 'item' , $ navigation ) -> with ( 'roles' , $ roles ) -> with ( 'parents' , NavigationAdmin :: getAllLists ( ) ) ; } | Show the form for editing the specified navigation . |
51,885 | public function update ( $ id , Request $ request ) { $ this -> validate ( $ request , NavigationAdmin :: $ rules , NavigationAdmin :: $ messages ) ; $ inputs = $ request -> only ( [ 'icon' , 'title' , 'slug' , 'description' , 'help_index_title' , 'help_index_content' , 'help_create_title' , 'help_create_content' , 'he... | Update the specified navigation in storage . |
51,886 | public function destroy ( $ id , Request $ request ) { $ navigation = NavigationAdmin :: findOrFail ( $ id ) ; $ this -> deleteEntry ( $ navigation , $ request ) ; return redirect_to_resource ( ) ; } | Remove the specified navigation from storage . |
51,887 | public function logActivity ( $ event ) { if ( user ( ) -> id <= 0 ) { return ; } LogAdminActivity :: create ( [ 'subject_id' => $ this -> id , 'subject_type' => get_class ( $ this ) , 'name' => $ this -> getActivityName ( $ this , $ event ) , 'before' => $ this -> before , 'after' => $ this -> after , 'user_id' => use... | Record activity for the model . |
51,888 | public function news ( $ limit = 5 ) { if ( count ( $ this -> newsLatest ) >= 1 ) { return $ this -> newsLatest ; } $ parent = str_replace ( 'AppModels' , '' , stripslashes ( static :: class ) ) ; $ rows = DB :: select ( "SELECT news.* FROM $this->table INNER JOIN news_tag ON news_tag.subject_id = $this->tab... | Get the news entries tagged to me |
51,889 | protected function getTitle ( ) { $ navigation = array_reverse ( $ this -> urlParentPages ) ; $ this -> title = strlen ( $ this -> title ) > 5 ? $ this -> title . ' - ' : '' ; foreach ( $ navigation as $ key => $ nav ) { $ this -> title .= $ nav [ 'title' ] . ( $ key + 1 < count ( $ navigation ) ? ' - ' : '' ) ; } retu... | Get the HTML Title |
51,890 | protected function getDescription ( ) { if ( strlen ( $ this -> description ) <= 5 ) { $ this -> description = $ this -> page [ 'description' ] ; } return trim ( $ this -> description . ( strlen ( $ this -> description ) < 2 ? '' : ' | ' ) . config ( 'app.description' ) ) ; } | Get the HTML Description |
51,891 | protected function findCurrentPage ( ) { $ url = $ this -> getCurrentUrl ( ) ; $ sections = $ this -> getCurrentUrlSections ( ) ; if ( $ url === false ) { $ page = Page :: where ( 'slug' , '/' ) -> get ( ) -> first ( ) ; } else { $ page = Page :: where ( 'url' , $ url ) -> orderBy ( 'is_hidden' , 'DESC' ) -> orderBy ( ... | Get the selected navigation |
51,892 | public function updateOrder ( Request $ request , $ type = 'list' ) { $ this -> updateNavType ( $ type ) ; $ navigation = json_decode ( $ request -> get ( 'list' ) , true ) ; foreach ( $ navigation as $ key => $ nav ) { $ idd = $ this -> defaultParent ? $ this -> defaultParent -> id : 0 ; $ row = $ this -> updateNaviga... | Update the order of navigation |
51,893 | public function edit ( Article $ article ) { $ categories = ArticleCategory :: getAllList ( ) ; return $ this -> view ( 'titan::blog.create_edit' , compact ( 'categories' ) ) -> with ( 'item' , $ article ) ; } | Show the form for editing the specified article . |
51,894 | public function destroy ( Article $ article , Request $ request ) { $ this -> deleteEntry ( $ article , $ request ) ; return redirect_to_resource ( ) ; } | Remove the specified article from storage . |
51,895 | public function index ( ) { $ items = News :: active ( ) -> orderBy ( 'created_at' , 'DESC' ) -> get ( ) -> take ( 6 ) ; return $ this -> view ( 'titan::home' ) -> with ( 'news' , $ items ) -> with ( 'hidePageFooter' , true ) ; } | Show the home page |
51,896 | protected function createOrUpdateDocument ( $ resource , $ name , $ filename ) { if ( request ( ) -> hasFile ( 'file' ) ) { if ( is_null ( $ resource -> document ) ) { $ resource -> documents ( ) -> create ( [ 'name' => $ name , 'filename' => $ filename , ] ) ; } else { $ resource -> document -> update ( [ 'name' => $ ... | Upload and save the document to resource |
51,897 | public function cropPhoto ( Photo $ photo ) { $ photoable = input ( 'photoable_type' ) :: find ( input ( 'photoable_id' ) ) ; if ( ! $ photoable ) { return json_response_error ( 'Whoops' , 'We could not find the photoable.' ) ; } if ( isset ( $ photoable :: $ LARGE_SIZE ) ) { $ largeSize = $ photoable :: $ LARGE_SIZE ;... | Crop a photo |
51,898 | private function copyAllWebsiteFiles ( ) { $ source = "{$this->basePath}resources{$this->ds}views{$this->ds}website" ; $ destination = resource_path ( "views{$this->ds}website" ) ; $ this -> copyFilesFromSource ( $ source , $ destination ) ; $ source = "{$this->basePath}resources{$this->ds}views{$this->ds}layouts{$this... | Cope all front end related files Website routes controllers views assets webpack |
51,899 | private function copyApp ( ) { $ this -> copyFilesFromSource ( $ this -> appPath . 'Models' , app_path ( 'Models' ) ) ; $ source = $ this -> basePath . "resources" . $ this -> ds . "views" ; $ this -> copyFilesFromSource ( $ source , resource_path ( "views" ) ) ; $ this -> copyFilesFromSource ( $ this -> appPath . "Con... | Copy the app files Copy all controllers models and views and routes |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.