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 MoneyException ( 'Could not execute YahooFinanceRatioProvider query to endpoint ' . $ endpoint ) ; } curl_close ( $ ch ) ; return $ responseContent ; }
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 ( $ curlHandle , CURLOPT_URL , "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml" ) ; $ curlResponse = curl_exec ( $ curlHandle ) ; curl_close ( $ curlHandle ) ; $ this -> fetchedData = $ curlResponse ; $ this -> fetchedTimestamp = time ( ) ; return $ this -> fetchedData ; }
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 $ numberFormatter -> formatCurrency ( $ this -> asFloat ( $ money ) , $ money -> getCurrency ( ) -> getCode ( ) ) ; }
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 -> created_at -> format ( 'l d F' ) ; } ) -> all ( ) ; $ response = [ 'labels' => [ ] , 'total' => 0 ] ; $ line = [ ] ; foreach ( $ days as $ date => $ items ) { $ response [ 'total' ] += $ items -> count ( ) ; $ response [ 'labels' ] [ ] = $ date ; $ line [ ] = $ items -> count ( ) ; } $ response [ 'datasets' ] [ ] = $ this -> getDataSet ( 'Total' , $ line ) ; return json_encode ( $ response ) ; }
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 ( ) ; return DataTables :: of ( $ items ) -> addColumn ( 'fullname' , function ( $ row ) { return $ row -> fullname ; } ) -> addColumn ( 'date' , function ( $ row ) { return $ row -> created_at -> format ( 'd M Y' ) ; } ) -> make ( true ) ; }
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 ; $ model -> setSlugAttribute ( $ model -> { $ column } ) ; } } ) ; } }
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 -> generateSuffix ( $ slug , $ list ) ; }
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_resource ( ) ; }
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' , $ setting ) ; return redirect_to_resource ( ) ; }
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 ( $ photo ) { $ attributes [ 'image' ] = $ photo ; unset ( $ attributes [ 'photo' ] ) ; $ banner = $ this -> createEntry ( Banner :: class , $ attributes ) ; } return redirect_to_resource ( ) ; }
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 , PageContent :: $ messages ) ; $ media = $ this -> moveAndCreatePhoto ( $ attributes [ 'media' ] ) ; if ( $ media ) { $ attributes [ 'media' ] = $ media ; } } unset ( $ attributes [ 'page_id' ] ) ; $ item = $ this -> updateEntry ( $ content , $ attributes ) ; return redirect_to_resource ( ) ; }
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" ] , 'last_month' => [ 'value' => $ lastMonth , 'color' => "#00a65a" , 'highlight' => "#008d4c" , 'label' => "Previous" ] ] ) ; }
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 :: createFromFormat ( 'Y-m-d' , $ end ) ; } return Period :: create ( $ start , $ end ) ; }
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' ] [ $ k ] = $ code ; } return new JsonResponse ( $ errors , 422 ) ; }
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 -> checkIfReservedWordInUrl ( ) ) { $ this -> addBreadcrumbLink ( ucfirst ( $ word ) ) ; } }
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 -> icon ) ; } if ( $ word = $ this -> checkIfReservedWordInUrl ( ) ) { $ this -> addPagecrumbLink ( ucfirst ( $ word ) ) ; } }
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 ( $ slug , $ keywords ) ) { return $ slug ; } } if ( $ last >= 1 ) { return 'show' ; } return false ; }
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' , 'DESC' ) -> orderBy ( 'list_order' ) -> get ( ) -> last ( ) ; } if ( ! $ nav && strlen ( $ url ) > 2 ) { foreach ( $ sections as $ key => $ slug ) { $ url = substr ( $ url , 0 , strripos ( $ url , '/' ) ) ; $ nav = NavigationAdmin :: whereUrl ( $ url ) -> get ( ) -> last ( ) ; if ( $ nav ) { break ; } } } if ( config ( 'app.env' ) == 'local' && ! $ nav ) { dump ( $ url ) ; dd ( 'Whoops. Navigation not found - please see if url is in database (navigation_admin)' ) ; } $ this -> selectedNavigation = $ nav ; $ this -> parentNavs = $ nav -> getParentsAndYou ( ) ; $ this -> urlParentNavs = $ nav -> getUrlParentsAndYou ( ) ; $ this -> resource = str_singular ( $ nav -> title ) ; $ mode = $ this -> checkIfReservedWordInUrl ( ) ; $ this -> selectedNavigation -> mode = $ mode == false ? 'index' : $ mode ; return $ this -> selectedNavigation ; }
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->table INNER JOIN image_tag ON image_tag.subject_id = $this->table.id INNER JOIN images ON images.id = image_tag.image_id WHERE images.deleted_at IS NULL AND $this->table.id = ? AND image_tag.subject_type LIKE ? GROUP BY images.id ORDER BY image_tag.is_cover DESC, images.updated_at DESC LIMIT $limit" , [ $ this -> id , '%' . $ parent ] ) ; $ images = collect ( ) ; foreach ( $ rows as $ k => $ row ) { $ item = $ row ; $ item -> thumb = substr_replace ( $ row -> name , Image :: $ thumbAppend , strpos ( $ row -> name , '.' ) , 0 ) ; $ item -> original = substr_replace ( $ row -> name , Image :: $ originalAppend , strpos ( $ row -> name , '.' ) , 0 ) ; $ images -> push ( $ item ) ; } $ this -> imagesTagged = $ images ; return $ this -> imagesTagged ; return $ this -> hasMany ( ImageTag :: class , 'subject_id' , 'id' ) -> where ( 'subject_type' , get_class ( $ this ) ) -> with ( 'image' ) -> orderBy ( 'created_at' , 'DESC' ) ; }
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 -> confirmation_token = null ; $ user -> confirmed_at = Carbon :: now ( ) ; $ user -> update ( ) ; $ user -> notify ( new UserConfirmedAccount ( ) ) ; alert ( ) -> success ( 'Success' , '<br/>Congratulations, your account has been activated. Please Sign In below.' ) ; log_activity ( 'User Confirmed' , $ user -> fullname . ' confirmed their account' , $ user ) ; } } else { alert ( ) -> error ( 'Whoops!' , 'Sorry, the token does not exist.' ) ; log_activity ( 'User Confirmed' , 'INVALID TOKEN' ) ; } return redirect ( route ( 'login' ) ) ; }
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 ( [ 'firstname' => $ attributes [ 'firstname' ] , 'lastname' => $ attributes [ 'lastname' ] , 'email' => $ attributes [ 'email' ] , 'cellphone' => $ attributes [ 'cellphone' ] , ] ) ; $ message = '' ; if ( $ attributes [ 'password' ] && strlen ( $ attributes [ 'password' ] ) >= 2 ) { $ message = " and <strong>Password</strong> " ; user ( ) -> update ( [ 'password' => bcrypt ( $ attributes [ 'password' ] ) , ] ) ; } alert ( ) -> success ( 'Updated!' , "Your personal information {$message} was successfully updated." ) ; return redirect ( ) -> back ( ) ; }
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 ( ) ; } return $ builder -> limit ( $ limit ) -> get ( ) ; }
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 -> created_at -> format ( 'l d F H:i' ) , 'type' => $ notification -> type , 'message' => $ notification -> data [ 'message' ] , 'read_at' => $ notification -> read_at , 'user_id' => $ user -> id , ] ; } return json_response ( $ notifications ) ; }
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 ( $ items as $ k => $ item ) { $ items [ $ k ] [ 1 ] = intval ( $ items [ $ k ] [ 1 ] ) ; } return json_response ( $ items ) ; }
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' ) ) ; $ attributes [ 'is_featured' ] = boolval ( input ( 'is_featured' ) ) ; $ attributes [ 'url_parent_id' ] = ( $ attributes [ 'url_parent_id' ] == 0 ? $ attributes [ 'parent_id' ] : $ attributes [ 'url_parent_id' ] ) ; $ page = $ this -> createEntry ( Page :: class , $ attributes ) ; if ( $ page ) { $ page -> updateUrl ( ) -> save ( ) ; $ page -> banners ( ) -> sync ( input ( 'banners' ) ) ; } return redirect_to_resource ( ) ; }
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' ) ) ; $ attributes [ 'is_featured' ] = boolval ( input ( 'is_featured' ) ) ; $ page = $ this -> updateEntry ( $ page , $ attributes ) ; $ page -> updateUrl ( ) -> save ( ) ; $ page -> banners ( ) -> sync ( input ( 'banners' ) ) ; return redirect_to_resource ( ) ; }
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 redirect ( $ this -> URLPrefix ) ; } if ( ! $ this -> request -> ajax ( ) ) { $ this -> title = $ category -> title ; $ category -> increment ( 'total_views' ) ; if ( $ category -> getTable ( ) == 'categories' ) { $ category -> increment ( "views_" . $ eloquent -> getTable ( ) ) ; } } $ builder -> where ( 'category_id' , $ category -> id ) ; } $ items = $ builder -> orderBy ( 'active_from' , 'DESC' ) -> paginate ( $ this -> paginate ) ; if ( $ this -> request -> ajax ( ) ) { $ view = "website.partials.content.pagination" ; if ( $ this -> view == 'photographies' ) { $ view = "website.partials.$this->view.pagination" ; } return response ( ) -> json ( view ( ) -> make ( $ view , compact ( 'items' ) ) -> render ( ) ) ; } $ categories = $ this -> categoriesHTML ( $ category ) ; if ( $ category ) { $ this -> addBreadcrumbLink ( $ category -> title , '/content/' . $ category -> url ) ; } return $ this -> view ( "content.$this->view" , compact ( 'categories' , 'items' ) ) ; }
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 :: with ( 'category' ) -> where ( 'url' , $ url ) -> first ( ) ; if ( ! $ item ) { return redirect ( $ this -> URLPrefix ) ; } $ item -> increment ( 'total_views' ) ; return $ item ; }
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 -> addBreadcrumbLink ( $ resource -> category -> title , $ this -> URLPrefix . $ resource -> category -> url ) ; $ this -> addBreadcrumbLink ( $ resource -> title , $ resource -> url ) ; $ this -> setBanners ( $ resource -> image , $ resource -> title , $ resource -> summary ) ; }
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 . ')</span>' ; $ html = '<li><a href="' . $ this -> URLPrefix . '" class="' . ( $ categoryId == 0 ? 'active' : '' ) . '">' . $ title . '</a></li>' ; foreach ( $ categories as $ k => $ category ) { $ total = $ category -> { $ relationship } ( ) -> count ( ) ; if ( $ total > 0 ) { $ active = $ category -> id == $ categoryId ? 'active' : '' ; $ title = $ category -> title . ' <span>(' . $ total . ')</span>' ; $ html .= '<li><a href="' . $ this -> URLPrefix . $ category -> url . '" class="' . $ active . '">' . $ title . ' </a></li>' ; } } return $ html ; }
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 :: createFromFormat ( 'Y-m-d' , $ end ) ; } return compact ( 'start' , 'end' ) ; }
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' , $ item ) ; }
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 ( ) -> diffInMinutes ( $ from , false ) < 0 ) { $ title = 'Active' ; $ class = 'success' ; } } return "<span class='label label-{$class}'>{$title}</span>" ; }
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_title' , 'help_edit_content' , 'parent_id' , 'url_parent_id' ] ) ; $ inputs [ 'is_hidden' ] = boolval ( $ request -> has ( 'is_hidden' ) ) ; $ inputs [ 'url_parent_id' ] = ( $ inputs [ 'url_parent_id' ] == 0 ? $ inputs [ 'parent_id' ] : $ inputs [ 'url_parent_id' ] ) ; $ row = $ this -> createEntry ( NavigationAdmin :: class , $ inputs ) ; if ( $ row ) { $ row -> updateUrl ( ) -> save ( ) ; $ row -> roles ( ) -> attach ( input ( 'roles' ) ) ; } return redirect_to_resource ( ) ; }
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' , 'help_edit_title' , 'help_edit_content' , 'parent_id' , 'url_parent_id' ] ) ; $ inputs [ 'is_hidden' ] = boolval ( $ request -> has ( 'is_hidden' ) ) ; $ navigation = NavigationAdmin :: findOrFail ( $ id ) ; $ navigation = $ this -> updateEntry ( $ navigation , $ inputs ) ; $ navigation -> updateUrl ( ) -> save ( ) ; $ navigation -> roles ( ) -> sync ( input ( 'roles' ) ) ; return redirect_to_resource ( ) ; }
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' => user ( ) -> id , ] ) ; }
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->table.id INNER JOIN news ON news.id = news_tag.news_id WHERE $this->table.id = ? AND news_tag.subject_type LIKE ? GROUP BY news.id ORDER BY news.created_at DESC" , [ $ this -> id , '%' . $ parent ] ) ; $ news = collect ( ) ; foreach ( $ rows as $ k => $ row ) { $ item = News :: where ( 'id' , $ row -> id ) -> active ( ) -> first ( ) ; if ( $ item ) { $ item -> images ; $ news -> push ( $ item ) ; } } $ this -> newsLatest = $ news -> take ( $ limit ) ; return $ this -> newsLatest ; return $ this -> hasMany ( NewsTag :: class , 'subject_id' , 'id' ) -> where ( 'subject_type' , get_class ( $ this ) ) -> with ( 'news' ) -> orderBy ( 'created_at' , 'DESC' ) ; }
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 ) ? ' - ' : '' ) ; } return trim ( $ this -> title . ( strlen ( $ this -> title ) < 2 ? '' : ' | ' ) . config ( 'app.name' ) ) ; }
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 ( 'url_parent_id' ) -> orderBy ( 'header_order' ) -> get ( ) -> last ( ) ; } if ( ! $ page && strlen ( $ url ) > 2 ) { foreach ( $ sections as $ key => $ slug ) { $ url = substr ( $ url , 0 , strripos ( $ url , '/' ) ) ; $ page = Page :: whereUrl ( $ url ) -> get ( ) -> last ( ) ; if ( $ page ) { break ; } } } if ( ! $ page ) { $ page = Page :: find ( 1 ) ; if ( config ( 'app.env' ) == 'local' && ! $ page ) { dd ( 'Whoops. Page not found - please see if url is in the pages table' ) ; } } $ this -> page = $ page ; $ this -> parentPages = $ page -> getParentsAndYou ( ) ; $ this -> urlParentPages = $ page -> getUrlParentsAndYou ( ) ; $ this -> page -> increment ( 'views' ) ; return $ this -> page ; }
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 -> updateNavigationListOrder ( $ nav [ 'id' ] , ( $ key + 1 ) , $ idd ) ; $ this -> updateIfNavHasChildren ( $ nav ) ; } return [ 'result' => 'success' ] ; }
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' => $ name , 'filename' => $ filename , ] ) ; } } }
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 ; $ thumbSize = $ photoable :: $ THUMB_SIZE ; } else { $ largeSize = $ this -> LARGE_SIZE ; $ thumbSize = $ this -> THUMB_SIZE ; } $ path = upload_path ( 'photos' ) ; $ originalImage = Image :: make ( $ photo -> original_url ) ; $ x = intval ( input ( 'x' ) ) ; $ y = intval ( input ( 'y' ) ) ; $ width = intval ( input ( 'width' ) ) ; $ height = intval ( input ( 'height' ) ) ; $ photo -> update ( [ 'filename' => token ( ) . "{$photo->extension}" ] ) ; $ originalImage -> save ( $ path . $ photo -> original_filename ) ; $ imageTmp = $ originalImage -> crop ( $ width , $ height , $ x , $ y ) ; $ imageTmp -> resize ( $ largeSize [ 0 ] , null , function ( $ constraint ) { $ constraint -> aspectRatio ( ) ; } ) -> save ( $ path . $ photo -> filename ) ; $ imageTmp -> resize ( $ thumbSize [ 0 ] , null , function ( $ constraint ) { $ constraint -> aspectRatio ( ) ; } ) -> save ( $ path . $ photo -> thumb ) ; return json_response ( 'success' ) ; }
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->ds}website.blade.php" ; $ destination = resource_path ( "views{$this->ds}layouts" ) ; $ this -> copyFilesFromSource ( $ source , $ destination ) ; $ source = "{$this->basePath}resources{$this->ds}views{$this->ds}partials" ; $ destination = resource_path ( "views{$this->ds}partials" ) ; $ this -> copyFilesFromSource ( $ source , $ destination ) ; $ source = "{$this->appPath}Controllers{$this->ds}Website" ; $ destination = app_path ( "Http{$this->ds}Controllers{$this->ds}Website" ) ; $ this -> copyFilesFromSource ( $ source , $ destination , 'namespace_views' ) ; $ search = "{$this->baseNamespace}\Seeds;" ; $ source = "{$this->basePath}database{$this->ds}seeds{$this->ds}UsersTableSeeder.php" ; $ destination = database_path ( "seeds" ) ; $ this -> copyFilesFromSource ( $ source , $ destination , $ search , "" ) ; $ base = $ source = $ this -> basePath . "resources" . $ this -> ds . "assets_setup" . $ this -> ds ; $ source = [ $ base . "webpack.mix.js" , $ base . "package.json" , $ base . "package-lock.json" , ] ; $ this -> copyFilesFromSource ( $ source , base_path ( ) , false ) ; $ source = "{$this->basePath}resources{$this->ds}assets{$this->ds}" ; $ destination = resource_path ( "assets{$this->ds}" ) ; $ this -> copyFilesFromSource ( "{$source}css" , "{$destination}css" , false ) ; $ this -> copyFilesFromSource ( "{$source}fonts" , "{$destination}fonts" , false ) ; $ this -> copyFilesFromSource ( "{$source}images" , "{$destination}images" , false ) ; $ this -> copyFilesFromSource ( "{$source}js" , "{$destination}js" , false ) ; $ this -> copyFilesFromSource ( "{$source}sass" , "{$destination}sass" , false ) ; $ this -> copyFilesFromSource ( $ this -> basePath . 'public' , base_path ( 'public' ) ) ; }
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 . "Controllers" , app_path ( "Http{$this->ds}Controllers" ) ) ; $ this -> copyRoutesAndProvider ( ) ; }
Copy the app files Copy all controllers models and views and routes