jlanzas

Experience

1,430

0 Best Reply Awards

  • Member Since 5 Months Ago
  • 10 Lessons Completed
  • 0 Favorites

25th April, 2018

jlanzas left a reply on B"string" Error • 1 month ago

I got it working, I can't remember where I found an example of a MSSQL database connection. But it turns out i had 'characterset' => 'utf8'

'local' => [
    'driver'    => 'sqlsrv',
    'host'      => env('DB_HOST'),
    'database'  => 'localhost',
    'username'  => env('DB_USERNAME'),
    'password'  => env('DB_PASSWORD'),
    'charset'   => 'utf8',
    'collation' => 'SQL_Latin1_General_CP1_CI_AS',
    'prefix'    => '',
],

Just changed that property and everything is working fine.

jlanzas left a reply on B"string" Error • 1 month ago

I have the following response

array:3 [▼
  0 => {#1156 ▼
    +"observaciones": b"Some text"
  }
  1 => {#1157 ▼
    +"observaciones": "Text"
  }
  2 => {#1158 ▼
    +"observaciones": "Test"
  }
]

And I get the following error: (1/1) InvalidArgumentException Malformed UTF-8 characters, possibly incorrectly encoded

23rd April, 2018

jlanzas left a reply on B"string" Error • 1 month ago

has anyone run into this problem?

20th April, 2018

jlanzas left a reply on B"string" Error • 2 months ago

@lostdreamer_nl it does affect when I want to return a JSON response. I get

jlanzas left a reply on B"string" Error • 2 months ago

Everything seems to work on my production environment which is Linux.

jlanzas started a new conversation B"string" Error • 2 months ago

Laravel is returning some strings as binary. I have found that it happens on string that contain the following character ñ This doesn't happen with other special characters like `é í ?d it only happens on my MacOS which is running High Sierra.

I'm working with SQL SERVER 2016 and the oficial Microsoft PDO libraries for PHP.

12th April, 2018

jlanzas left a reply on Tinker - Could Not Find Driver • 2 months ago

Thank you @Helmchen the drivers were missing. I don't know why my extensions got disabled.

11th April, 2018

jlanzas left a reply on Tinker - Could Not Find Driver • 2 months ago

@rumm.an Im working on a Mac. The weird thing is that it used to worked. I dont know it doesnt anymore.

jlanzas left a reply on Tinker - Could Not Find Driver • 2 months ago

@Cronix my app works just fine. My tinker is not.

jlanzas left a reply on Tinker - Could Not Find Driver • 2 months ago

@Cronix a simple search

Psy Shell v0.8.18 (PHP 7.1.14 — cli) by Justin Hileman
>>> $user = App\User::find(1)
Illuminate\Database\QueryException with message 'could not find driver (SQL: select top 1 * from [users] where [users].[id] = 1)'
>>>

jlanzas started a new conversation Tinker - Could Not Find Driver • 2 months ago

I'm trying to interact with my mssql server from tinker but I'm getting the following error:

Illuminate\Database\QueryException with message 'could not find driver

My application works ok, only tinker is giving me that error

27th March, 2018

jlanzas left a reply on Filter Results • 2 months ago

thank you @lostdreamer_nl and @tykus both your answers helped me get where I need it.

jlanzas left a reply on Filter Results • 2 months ago

The filtering will only be based on $unit instance.

jlanzas started a new conversation Filter Results • 2 months ago

I have the following data:

Unit::with('products')->get();

Based on that initial collection I need to filtered it. I need a way to search all columns without naming each one in a

->where
->orWhere

So, I was trying the following:

$filtered = $this->units->filter(function ($unit) use ($filter) {
    return $unit->contains($filter);
});

But I keep getting:

BadMethodCallException
Call to undefined method Illuminate\Database\Query\Builder::contains()

Can anyone help me out.

27th February, 2018

jlanzas left a reply on Boolean Field Returns Empty When Set To False In Blade • 3 months ago

Thank you very much @sutherland appreciate the time.

jlanzas started a new conversation Boolean Field Returns Empty When Set To False In Blade • 3 months ago

Is there a reason why my boolean field returns an empty string when I used in in blade? When I use the following code:

var xxx = "{{ Auth::user()->alertConfigs->progress_bar }}"

and it sets to true (1) I get a 1 in my blade view. I get:

var xxx = "1"

However, when I changed its value to False (0) I'm getting and empty string.

var xxx = ""

Can anyone help me out.

17th February, 2018

jlanzas left a reply on Pass Variable To Api Resource Collections • 4 months ago

Thank you for the answers guys... @skliche I'm working with datatables and pagination. So I need to send back, the page number, total pages, item count, per-page amount, sort field and sort order.

I can get a few fields like the item count, total pages, but the page number is send on a variable the same goes for the per-page amount and the sorting field and order.

So thats the reason I want to send those fields to the ResourceCollection.

jlanzas started a new conversation Pass Variable To Api Resource Collections • 4 months ago

Is there anyway I can pass variable to a resource collection? I have been looking around but can't figure it out.

Any help will be greatly appreciated.

8th February, 2018

jlanzas started a new conversation Permissions Optimization In Blade • 4 months ago

I'm currently working on a system which uses Roles & Permissions to control its security. I have implemented Bouncer successfully. However, there are times where an user will have access to only one "report" inside the reports submodule of a bigger module. Instead of creating a role with a single permission I have added that permission directly onto the user. And everything works ok. No problem there.

Here is my question. Lets say I have a module call Purchases. Inside Purchases I have Products, Orders, Suppliers, Reports, etc. In my blade I have the following syntax:

@if( $user->isAn('role1', 'role2', 'etc'))
<h1>Purchases</h1>
<ul>
    @can('view-orders')
    <li>
        Icon - Orders
    </li>
    @endcan

    @can('view-suppliers')
    <li>
        Icon - Suppliers
    </li>
    @endcan

    @can('view-reports')
    <li>
        Icon - Reports
        <ul>
            <li>Report 1</li>
            <li>Report 2</li>
            <li>Report 3</li>
        </ul>
    </li>
    @endcan
</ul
@endif

The problem now is that my user may only have access to reports directly without needing to be assign to a role. Looking for roles assigned to an user is no longer the best approach.

I found a solution but its to search every single permission at the begging just to paint the main module and the search the submodule individually.

Any ideas will be greatly appreciated and I hope I have explain myself.

Edit Your Profile
Update

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