wick12c

Experience

3,090

0 Best Reply Awards

  • Member Since 6 Months Ago
  • 29 Lessons Completed
  • 0 Favorites

16th May, 2018

wick12c left a reply on Vuejs2 @click Not Working In Blade Foreach Loop • 3 months ago

Also to note, there are no console errors

wick12c started a new conversation Vuejs2 @click Not Working In Blade Foreach Loop • 3 months ago

First time Vue user, moderate in Laravel and good with PHP. A simple blade view containing compact data created by heavy DB queries. Using a foreach loop on the compact data will show one to several results depending on what the user has searched for. The foreach is fine and data is presented in typical blade view fashion. I want to introduce Vue2 and just starting with a simple button creating a @click event (eventually to just show a preloader (no AJAX at this point) to wait for the next page to load.

I am sure there are many ways to do this but this is just a simple understanding of the following:

Button contains:

<button @click="loadPropertyPage('test')">test</button>

Linked to app.js compiled using Laravel-mix:

import Vue from 'vue';


new Vue({

    el: '#root',

    methods: {

        loadPropertyPage(link) {
            alert('test');
        }

    }

})

Works fine.

However, in a blade foreach loop adding the same button does not work:

<table id="bootstrap-table" class="table">
                                <thead>
                                    <tr>
                                        <th data-field="rentalid" class="text-center">Rental ID</th>
                                        <th data-field="brand">Brand</th>
                                        <th data-field="rentalname">Rental Name</th>
                                        <th data-field="accountmanager">SF AM Name</th>
                                        <th data-field="companyname">Company Name</th>
                                        <th></th>
                                        <th></th>
                                    </tr>
                                </thead>
                                <tbody>

                                    @foreach($search_data as $results)

                                        <tr>
                                            <td class="text-center"> {{ $results->RentalNumber }} </td>
                                            <td> {{ $results->brandname }} </td>
                                            <td> {{ $results->RentalName }} </td>
                                            <td> {{ $results->AccountManagerName }} </td>
                                            <td> {{ $results->CompanyName }} </td>
                                            <td> <button @click="loadPropertyPage('{{ url('search/property/'.$results->ListingId) }}')" class="btn btn-round btn-info btn-sm">View Property</button> </td>
                                            <td> Another link</td>
                                        </tr>

                                    @endforeach

                                </tbody>
                            </table>

I have replaced the above button with the simple button above and will not work. but if you place the simple button outside of the foreach the button and alert will work.

I am using Laravel 5.6 on Mac OS X.

Just to clarify, not looking for workarounds, just the simple understanding (more education purposes) as to why a vue @click conflicts with a blade foreach loop.

Thank you!

18th February, 2018

wick12c left a reply on Connect To Company MSSQL Server Using A Domain • 6 months ago

This issue has been resolved. The ODBC Driver 13 within the odbc.ini files driver didn't recognise mac's windows credentials. I then installed FreeTDS with unix ODBC which created the necessary library that recognised the credentials which created a successful connection.

For those who are in this scenario, the username should be DOMAINGROUP\username. Use a double backslash so when the connection is made to the server it will tell the server a domain is in use and will remove one backslash. The second backslash is for the server itself which will then separate the two for a domain login. Not sure why but this is the only solution I found that worked.

Hope this helps anyone in need.

8th February, 2018

wick12c left a reply on Connect To Company MSSQL Server Using A Domain • 6 months ago

Further to this, developers in the office are using

$resource = odbc_connect('Driver={ODBC Driver 13 for SQL Server};Server={WORKSERVERNAME}:1433;Trusted_Connection=yes;ApplicationIntent=ReadOnly', null,null);

and now coming up with:

odbc_connect(): SQL error: [Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired, SQL state S1T00 in SQLConnect

I have looked into ODBC packages however none seem to have a relationship to Laravel 5.6.

Any help please?

7th February, 2018

wick12c started a new conversation Connect To Company MSSQL Server Using A Domain • 6 months ago

Currently, using native SQL GUIs e.g. RazorSQL I can connect to the company's server for reporting which is setup to use a windows authentication, however, I am wanting to hook up laravel to automate my reporting.

I have tried within the .env _HOST = MYGROUP\hostname and then adding my username and password (used for windows authentication) which produces:

SQLSTATE[HYT00]: [Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired

When using _HOST = hostname and my username = MYGROUP\username it produces:

SQLSTATE[28000]: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user 

Database config is using the default setup for sqlsrv:

'sqlsrv' => [
            'driver' => 'sqlsrv',
            'host' => env('HADB_HOST', 'localhost'),
            'port' => env('HADB_PORT', '1433'),
            'database' => env('HADB_DATABASE', 'forge'),
            'username' => env('HADB_USERNAME', 'forge'),
            'password' => env('HADB_PASSWORD', ''),
            'prefix' => '',
        ],

does sqlsrv accept domain as a field? am I using the wrong driver? any help would be much apprieciated.

Oh and the query I am running to test this is:

$haquery = DB::connection('sqlsrv')->table( etc etc

wick12c left a reply on Merge Two Collections Into One With Unique Array • 6 months ago

Thank you for your help guys. Yes I managed to put the first query into an array then used array_search to obtain the key to then manually merge the results which did the trick.

3rd February, 2018

wick12c started a new conversation Merge Two Collections Into One With Unique Array • 6 months ago

I am new to Laravel and having some difficulty trying to find the answer to my problem. I have one DB query in a collection and another collection from a different DB query (each query is from a separate DB connection).

The example is Collection A has multiple fields with a unique field known as propertyid, Collection B also contains the same propertyid with additional fields and I need to merge them into a single collection and/or array.

When attempting to merge, Collection B is only added to the tail of Collection A. My desired result is to have the one propertyid containing all fields from Collection A and B in the one array. The collection will have a couple of thousand propertyids so instead of looping through each collection and searching for array keys etc I want to see if a simple merge (or similar) can do this.

Thank you so much for any help that would be appreciated.

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.