spacedog4

spacedog4

Member Since 1 Year Ago

Umuarama - PR, Brazil

Experience Points 54,630
Experience Level 11

370 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 516
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

16 Sep
3 days ago

spacedog4 left a reply on Overwrite Magic _get Method For A Custom Request Class

Hey @slev1n thanks for your reply, worked for me, I'll explain what I'm doing, sorry if it becomes hard to understand, english is not my native language

In my API i can pass a json to export multiple data (in this case a person) and inside each person in the json can have multiples relations, addresses, users, etc... So I need to extract each person of the json, test if this person already exists or not (so I need to update or create a new one), and create a new request based on that person data retrieved from the request, so I can use the same create method from the PersonsController to create a new person, address, etc, if I pass the normal request() don't work

So I have a PersonRequest class, I instantiate it with the data from the request, It was working perfect in my tests, $new_request->key returned the correct data, but for requests with a content-type of application/json works differently, it doesn't look for the key in $resquest->request->key it gets from $request->json->key and I don't know how to overwrite this json data

spacedog4 started a new conversation Overwrite Magic _get Method For A Custom Request Class

I have a custom request class PersonRequest where I use for an exporting project where I manipulate the original request and create new ones, I need to overwrite the default magic get method for Request

I can call $request->get($key) and I already overwrited that method in my PersonRequest, but:

How do I overwrite $request->key?

05 Sep
2 weeks ago

spacedog4 commented on Ignition Is Laravel's Amazing New Error Page

That's a reaaaally wonderful improve

02 Sep
2 weeks ago

spacedog4 commented on Explain How A Facade Works Under The Hood

I would like to know what is that PizzaController hahaha

22 Aug
4 weeks ago

spacedog4 commented on Reduce A Query From 12 Seconds To 1 Millisecond

I started search for it after have a page that took 30 seconds to load

21 Aug
4 weeks ago

spacedog4 started a new conversation Pass Props To A Programmatically Component

I'm making a sidebar that can have dynamic content, using vuex

So, for exaple, I have this app with a Sidebar.vue that can loads a DynamicContent.vue, how do I pass a prop to that DynamicContent.vue inside

app.js

import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

import store from './store'
import Sidebar from './components/Sidebar'
import DynamicContent from './components/DynamicContent.vue'

Vue.component('sidebar', Sidebar)

const app = new Vue({
    el: '#app',
    store,
    
    data() {
        return {
            dynamicContent: DynamicContent
        }
    },

    methods: {
        toggleSidebar() {
            this.$store.commit('toggleSidebar', dynamicContent)
        }
    }
})

Sidebar.vue

Notice: I can't pass my props throught that component tag cause the components can have differents props

<template>
    <div>
        <component :is="component" />
    </div>
</template>

<script>
    export default {
        computed: {
            component() {
                return this.$store.state.sidebarComponent
            }
        }
    }
</script>

store.js

import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        sidebarOpen: false,
        sidebarComponent: null
    },

    mutations: {
        toggleSidebar(state, component) {
                state.sidebarOpen = ! state.sidebarOpen
        state.sidebarComponent = component
        },
    }
})
16 Aug
1 month ago

spacedog4 left a reply on Bug Saying That I Already Completed The Series When I Don't

Really? If it is true, I don't think is a good choice, cause to see if has new episodes to watch I go to the "Series" page and at the section of "Recently Updated" and look for a serie that isn't completed, in this case, MySQL Database Design" was completed

spacedog4 started a new conversation Bug Saying That I Already Completed The Series When I Don't

I watched all the episodes from MySQL Database Design, completed, but when you realesed news episodes it confused me cause it was still saying that I has completed 100% the series

http://prntscr.com/otmzko

14 Aug
1 month ago

spacedog4 commented on Filtering Aggregated Data

If I use limit, the "having" will be affected?

12 Aug
1 month ago

spacedog4 commented on Series Chapters

Love that course, it is a patch note integrated with a lesson

spacedog4 started a new conversation How Do I Create A New Request Overwriting Json()->all()

I'm developing an exporter, when I'm exporting data to an table I pass all the data trought post, inside a records parameter and the server discover if it needs to update or create a new row.

{
    "records" => "[{\"foo\":\"bar\"}]"
}

I get this records parameter and create another Request cause inside it can have child relationships, so I create another request to pass trought the validation.

$created_request = new NewRequest(
    [], // query
    ["foo" => "bar"], // request
    [] // attributes
);

The problem is, if I make a normal request, when I call $created_request->all() it will return me ["foo" => "bar"], correct, but if I make a json request, it will return me the old data "records" => "[{\"foo\":\"bar\"}]"

Basic, doing my research, I discovered that in a normal request, $created_request->all() will return $created_request->query->all() and $created_request->request->all(), on the other hand in a json request, $created_request->all() will return $created_request->json()->all() that always return the old data, how do I create a new request overwriting json()->all()

03 Jun
3 months ago

spacedog4 started a new conversation How To Use Laravel Echo And Pusher In Laravel 5.8 With API Authentication

I'm trying to build a real-time chat app, but I'm having problem with laravel echo in vue js

This chat needs an api authentication, so in my broadcast it need to

this next code is in my main app.js file

window.Echo = new Echo({
    broadcaster: 'pusher',
    key: process.env.MIX_PUSHER_APP_KEY,
    cluster: process.env.MIX_PUSHER_APP_CLUSTER,
    logToConsole: true,
    encrypted: true,
    auth: {
        headers: {
            Authorization: `Bearer TOKEN`
        },
    },
    authEndpoint: "/api/broadcasting/auth",
})

How can I get this Beare Token (that I pass on the URL) and use it in my app.js file, dinamyc since It could be any user

22 Apr
4 months ago

spacedog4 left a reply on GetColumnListing Return Empty Array When It Shoulnd't

@SNAPEY - Yeah, sorry for that, I should review it better before post, ends up that I discovered by my own, this is a messy project, but thank you anyway

spacedog4 left a reply on GetColumnListing Return Empty Array When It Shoulnd't

Okay I discovered it

How I use multiple databases, I have a connection where I get what database should this client connect to and connect using a class and calling the method on my provider

<?php

namespace App\Helpers;

use Illuminate\Support\Facades\DB;

class DatabaseConnection {

    public static function setConnection($env_connection)
    {
        $env_connection = strtoupper($env_connection);

        config(['database.connections.mysql' => [
            'driver'   => 'mysql',
            'host'     => env("DB_{$env_connection}_HOST"),
            'database' => env("DB_{$env_connection}_DATABASE"),
            'username' => env("DB_{$env_connection}_USERNAME"),
            'password' => env("DB_{$env_connection}_PASSWORD"),
            'strict' => false,
        ]]);

        DB::reconnect('mysql');
    }
}

I can't just DB::connect(database_name) cause I'd need to store it on a variable and call it on every connection, this way I can continue using DB::table(), Model::all() that it will get the correct connection

The problem is that is some point, the schema stopped to get the correct connection and I need now to specify it like this Schema::connection(connection_name)->getColumnListing($model->getTable())

It wasn't working before cause I didn't have the database configured correctly on my database.php file

spacedog4 left a reply on GetColumnListing Return Empty Array When It Shoulnd't

@SNAPEY - Sorry, its out of context, I store the model in the class

spacedog4 started a new conversation GetColumnListing Return Empty Array When It Shoulnd't

I need to get all column names from a table

doing

$model->getConnection()->getSchemaBuilder()->getColumnListing($model->getTable())

or

Schema::getColumnListing($model->getTable())

even

\DB::select("select column_name as `column_name` from information_schema.columns where table_schema = 'gestor and table_name = 'controleexportacao'") // this sql works in database softwares

it returns me an empty array $model->getConnection() returns me the connection where I can see the table is there and with the columns

Debuging the getColumnListing method I got this sql select column_name as `column_name` from information_schema.columns where table_schema = ? and table_name = ? so I used it on another database software and it returned me all columns

So why getColumnListing dont return it?

Is important to notice that I'm using multiple database, that's why I checked the connections config

17 Apr
5 months ago

spacedog4 started a new conversation Bug On A Discussion

Hey @JeffreyWay I just found a bug

Navigating in your profile, I clicked on your latest contribution for the laracast dicussions where you answer a question, but the link takes me to the page 68 where there is no reply, i think some people may deleted theirs replies and this happened

Heres the links https://laracasts.com/discuss/channels/general-discussion/where-are-you-all-from?page=68#reply-504396

And heres an screenshot

http://prntscr.com/ndbn1j

I think a good solution to that is like I saw in others foruns, create the link to the first page and bring the answer to the top

13 Apr
5 months ago

spacedog4 left a reply on Dealing With Huge Tables And Pagination

I've made some research and how my query is constantly searched by codigoempresa, codigofilial, codigopedidoproducao and status creating an index of these three columns and another for pedidoproducaoetapas improved 10x my query, now, it takes 1.3 seconds, thank you guys

ALTER TABLE `pedidoproducao` ADD INDEX `pedidoproducao_idx_codigoe_codigof_status_codigop` (`codigoempresa`,`codigofilial`,`status`,`codigopedidoproducao`);

ALTER TABLE `pedidoproducaoetapas` ADD INDEX `pedidoproducaoetapas_idx_codigoempresa_codigopedidopro` (`codigoempresa`,`codigopedidoproducao`);
12 Apr
5 months ago

spacedog4 left a reply on Dealing With Huge Tables And Pagination

I made it in a different way with google sql, but it worked, now, I made same research and I dont see what can I improve in my sql, how you can see above a posted a link to the results of the explain, and all the rows are with a key and potencial key, just two of then has too many rows, but how can I decrease it?

spacedog4 left a reply on Dealing With Huge Tables And Pagination

@SNAPEY - I searched about the errors, but I could find any similar errors, it wasnt rendering when I'm logged, I tried to render by my self, but it didn't work neither, and was giving a simple error in log file "Array to string conversion" in debug bar, but It didn't say the line, nothing

spacedog4 left a reply on Dealing With Huge Tables And Pagination

I used explain, and that is the results http://prntscr.com/nb63ti I don't know what I can improve here

I'm doing some research about how to analyze and improve the sql with explain

spacedog4 left a reply on Dealing With Huge Tables And Pagination

@JLRDW - I configured this in google cloud sql and worked, I'll see the results and analyze, thanks

spacedog4 left a reply on Dealing With Huge Tables And Pagination

@SNAPEY - I tried, but it crashs with my application, I'm using different databases, guards, providers, multiple primary keys

spacedog4 left a reply on Dealing With Huge Tables And Pagination

@JLRDW - Researching about google cloud sql I found don't a post and configured like this http://prntscr.com/nb610b but it keeps giving me errors

spacedog4 left a reply on Dealing With Huge Tables And Pagination

@JLRDW - I manage multiple database, it is already setted to false

class DatabaseConnection {

    public static function setConnection($env_connection)
    {
        $env_connection = strtoupper($env_connection);

        config(['database.connections.mysql' => [
            'driver'   => 'mysql',
            'host'     => env("DB_{$env_connection}_HOST"),
            'database' => env("DB_{$env_connection}_DATABASE"),
            'username' => env("DB_{$env_connection}_USERNAME"),
            'password' => env("DB_{$env_connection}_PASSWORD"),
            'strict' => false,
        ]]);

        DB::reconnect('mysql');
    }
}

my issue is running this code in sql softwares, I can't find a way to set strict in phpstorm or navicat

spacedog4 left a reply on Dealing With Huge Tables And Pagination

@JLRDW - That's a list of a production history, http://prntscr.com/nb5mnz

And its also slow in the production screen http://prntscr.com/nb5npi

I need to bring somethings in the query, like that date_add where I get the date of the production and sum with the prediction days so I can order by that sum, and others things

spacedog4 left a reply on Dealing With Huge Tables And Pagination

@SNAPEY - I tried that but the SQL that Laravel generates gives me this error in PHPStorm database manager and Navicat

1055 - Expression #10 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'maxinutri.pedidoproducaoetapas.previsao' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

spacedog4 left a reply on Dealing With Huge Tables And Pagination

@JLRDW - I'll try that, acctualy, in this particular case, I'm dealing with 16000 records, an relationships, I forgot to mension that, each record can have at least 6 realations that I'm making join so, it can be 100.000 records, even so I think it's not so much

I updated my question with the sql

spacedog4 left a reply on Dealing With Huge Tables And Pagination

@MARTINBEAN - i tried to use the laravel debugbar, but it bugs with my project, I have differents guards and providers, also this database wasn't design by me, it's poor, have many primary keys, some tables has 4 or 5 primary keys, so I needed to use comboships for relation

but maybe this 15 seconds its caused by this poorly database than, any advice that I could improve without rebuilding everything?

spacedog4 left a reply on Dealing With Huge Tables And Pagination

@PAPA - I don't know what would be Database plugin, but yes I use ajax calls

spacedog4 started a new conversation Dealing With Huge Tables And Pagination

I have a table with more then 16000 records (see the update), I need to show it on a list and paginate, but even with simplePagination it takes 15s to query it, is there a better way to paginate it?

Important thing is that I cant select the first 100 and page 2 the next 100 cause I have filters

I'm using a google compute engine and sql with 1vCPU and 3,7GB ram

Update

I forgot to mention that I'm making some relationships, each record can have 6 to 9 relations, so I might be selectiong 100.000 to 200.000 records

My SQL

Here is my sql, the tables are in portuguese so it might be difficult to read

I'm dealing with 4 tables

pedidoproducao has 17567 records

pedidoproducaoetapas has 19360 records

pedidoproducaoocorrencia has just 1 record

pedidoproducaoderivado has 17559 records

produtos has 2301 records

I don't know why the laravel don't built it on sql but I'm making some relationships with with that are not in sql, like etapa_producao and ocorrencia

$query->with('etapas');
$query->with(['etapas.etapa_producao' => function ($q) {
    $q->select('codigoempresa', 'codigoetapasproducao', 'etapa');
}]);
$query->with('etapas.ocorrencias.ocorrencia');
SELECT `pedidoproducao`.*,
  `pedidoproducao`.`hora` AS `hora_previsao`,
  `pedidoproducaoetapas`.`previsao`,
  DATE_ADD(pedidoproducao.data, INTERVAL SUM(pedidoproducaoetapas.previsao) DAY) AS data_previsao,

  (SELECT SUM(previsao) AS previsao
   FROM `pedidoproducaoetapas`
   WHERE `pedidoproducao`.`codigoempresa` = `pedidoproducaoetapas`.`codigoempresa`
         AND `pedidoproducao`.`codigofilial` = `pedidoproducaoetapas`.`codigofilial`
         AND `pedidoproducao`.`codigopedidoproducao` = `pedidoproducaoetapas`.`codigopedidoproducao`) AS `previsao`,

  (SELECT count(*)
   FROM `pedidoproducaoocorrencia`
   WHERE `pedidoproducao`.`codigoempresa` = `pedidoproducaoocorrencia`.`codigoempresa`
         AND `pedidoproducao`.`codigofilial` = `pedidoproducaoocorrencia`.`codigofilial`
         AND `pedidoproducao`.`codigopedidoproducao` = `pedidoproducaoocorrencia`.`codigopedidoproducao`) AS `ocorrencia`
FROM `pedidoproducao`
  INNER JOIN `pedidoproducaoderivado` ON (`pedidoproducaoderivado`.`codigoempresa` = `pedidoproducao`.`codigoempresa`
                                          AND `pedidoproducaoderivado`.`codigofilial` = `pedidoproducao`.`codigofilial`
                                          AND `pedidoproducaoderivado`.`codigopedidoproducao` = `pedidoproducao`.`codigopedidoproducao`)
  INNER JOIN `produtos` ON (`produtos`.`codigoempresa` = `pedidoproducaoderivado`.`codigoempresa`
                            AND `produtos`.`codigopro` = `pedidoproducaoderivado`.`codigopro`)
  LEFT JOIN `pedidoproducaoetapas` ON (`pedidoproducao`.`codigoempresa` = `pedidoproducaoetapas`.`codigoempresa`
                                       AND `pedidoproducao`.`codigopedidoproducao` = `pedidoproducaoetapas`.`codigopedidoproducao`)
WHERE EXISTS
      (SELECT *
       FROM `pedidoproducaoetapas`
       WHERE `pedidoproducao`.`codigoempresa` = `pedidoproducaoetapas`.`codigoempresa`
             AND `pedidoproducao`.`codigofilial` = `pedidoproducaoetapas`.`codigofilial`
             AND `pedidoproducao`.`codigopedidoproducao` = `pedidoproducaoetapas`.`codigopedidoproducao`)
      AND `pedidoproducao`.`codigoempresa` = ?
      AND `pedidoproducao`.`codigofilial` = ?
      AND `pedidoproducao`.`status` = ?
GROUP BY `pedidoproducao`.`codigopedidoproducao`
ORDER BY `pedidoproducao`.`updated_at` DESC,
  `pedidoproducao`.`codigopedidoproducao` ASC

Notice

If is there a way I can do this with cache, cause this page is an history of items that was completed, but I don't know how cache works, I can cache the query and update the cache every time a new item is completed?

20 Feb
6 months ago

spacedog4 left a reply on Factory Manual Incrementing

@ADAMPRICKETT - No, the same issue :( but thank you for trying, for now I'm doing this

for ($i = 0; $i < 2; $i++) {
    factory('App\Controleexportacao')->create([
        'tipo' => 'I'
    ]);
}
19 Feb
7 months ago

spacedog4 started a new conversation Factory Manual Incrementing

I need to set the primary key for my table manually, so I created a function to get the last record and return it +1 (cause my table has "multiple primary keys")

But the problem is that I can't use the multiple method from the factory cause it returns all the same key

<?php

use Faker\Generator as Faker;

$factory->define(\App\Controleexportacao::class, function (Faker $faker, $overrides) {

    $faker->locale('pt_BR');

    if (!$empresa = \App\Empresa::inRandomOrder()->first()) {
        $empresa = factory('App\Empresa')->create(array_only($overrides, \App\Empresa::getPrimaryKeyGroup()));
    }

    return [
        'codigoempresa' => $empresa->codigoempresa,
        'codigoce'      => \App\Controleexportacao::generateKey(), // Here I get the last record key + 1
        'nometabela'    => $faker->word,
        'data'          => $faker->date(),
        'hora'          => $faker->time(),
        'tipo'          => $faker->randomElement(\App\Controleexportacao::tipos()->all()),
        'exportado'     => array_random(['S', 'N']),
    ];
});

I've found this solution https://stackoverflow.com/questions/44983693/laravel-factory-manual-increment-of-column but in my case this doesn't work, cause I can't do something like this

static $codigoce = \App\Controleexportacao::generateKey();
18 Feb
7 months ago

spacedog4 left a reply on A Simpler Way To Get All Attributes From A Model Including Timestamp

Oh guys, sorry, STUPID mistake, this table doesn't have the timestap columns and a class that I created confused me, getColumnListing works

spacedog4 started a new conversation A Simpler Way To Get All Attributes From A Model Including Timestamp

I need to get all my model's table fields so I can remap it to another name

I tryied to use both codes

\Schema::getColumnListing($model->getTable());

// or

$model->getAttributes();

Both of then don't return me the created_at and updated_at fields

I need a simpler way to do this

public function($model) 
{
    return array_merge(array_keys($model->getAttributes()), $model->getDates());
}
15 Feb
7 months ago

spacedog4 left a reply on OrderBy Works, Even Though Column Does Not Exist

Try to clean all the cache in the storage folder

14 Feb
7 months ago

spacedog4 left a reply on String With A "b" Prefix On Records With Accent

@CRONIX - Yes, I created a new view just to make sure

spacedog4 left a reply on String With A "b" Prefix On Records With Accent

@S4MUEL - With the first code it's inverting, in my controller it returns "André" instead in my view it returns "André"

spacedog4 left a reply on Problem With Latin Words

@VILFAGO - I changed everything to utf8mb4 and nothing works

spacedog4 left a reply on Problem With Latin Words

@VILFAGO - I'll convert all to utf8_mb4 and utf8mb4_unicode_ci and say here if it works

spacedog4 left a reply on String With A "b" Prefix On Records With Accent

@S4MUEL - Ohh, almost the same example, but this wouldn't make the "b" appears also on my route file? Cause when I dump it there it doesn't show the "b"

Also I'm from Brazil, I make multiples sites with accents on database and this is the first time that this occurs, the utf8_general_ci support latin words

So what should I do? Cause this "b" is preventing me to create my json response

13 Feb
7 months ago

spacedog4 left a reply on Relationship Maximum Execution Time Of 60 Seconds Exceeded

This was an error in my code, I validade the user using the filial relationship that tries to validate again and results in a infinite loop

I just removed the middleware authentication and solved my problem

spacedog4 started a new conversation Attribute Returns Binary String On Controller But Not On Route

I NEED A NORMAL STRING

If I try to get my product name with the following code in my VendaitensController it returns

b"André"
dd(\App\Vendasitem::where('codigovi', 112685)->first()->produto->nomeproduto);

PS: the same occurs in my VendasitemRequest, etc, I've tested in multiples files and all of them return the binary string

BUT in my routes file

web.php

the same code returns a normal string

"André"
Route::get('/', function () {
    dd(App\Vendasitem::where('codigovi', 112685)->first()->produto->nomeproduto);
});

spacedog4 left a reply on String With A "b" Prefix On Records With Accent

@S4MUEL - I've updated my question, take a look if it helps, and about the unpack, it just returns me an array with one value of 65

array:1 [
  1 => 65
]

spacedog4 started a new conversation String With A "b" Prefix On Records With Accent

When I dump the property of my model and it has an accent it returns with this "b" prefix

dump($venda_item->produto->nomeproduto); // b"teste téste"

My database is setted to utf8 and utf8_general_ci collation

This causes me the following error Malformed UTF-8 characters, possibly incorrectly encoded when I'm returning the response in json, at this line

$json_response = Response::json($response, $this->getStatusCode(), $headers);

#Update

I discovered that if I die and dump the record on the web route it shows normal teste tést

Route::get('/', function () {
    dd(App\Vendasitem::where('codigovi', 112685)->first()->produto->nomeproduto);
});

otherwise if I do the same in the controller or request and other files that I tryied it keeps returning me with the "b" prefix

spacedog4 started a new conversation Problem With Latin Words

My database is with the following config

'charset'     => 'utf8',
'collation'   => 'utf8_general_ci',

my table too, my record has the following value at the nomeproduto column teste tésetand when I die and dump it on screen it shows me this `teste tï¿?

What have I made?

I already used some codes that I found

SET NAMES 'utf8';
SET character_set_connection=utf8;
SET character_set_client=utf8;
SET character_set_results=utf8;

dd(utf8_encode($produto->nomeproduto));

my file is in UTF-8 encoding

nothing works

11 Feb
7 months ago

spacedog4 started a new conversation Returns Unauthenticated But Keeps Running Request

I have an API that I can export multiple data with relations, but I just buy a new server, and in this server when I make request with a big json it reachs the route file twice and returns Unauthenticated (it should'nt cause its just one request and I don't make any redirects), with a smaller json it doesn't happens.

But even return unauthenticated I can see in my logs that the request keeps runing

http://prntscr.com/mjiru1

That is my server configs

memory_limit = 200M
max_execution_time = 600
max_input_time = 600
post_max_size = 200M
upload_max_filesize = 200M
display_errors = On
display_startup_errors = On
default_socket_timeout = 600
max_user_connections = 1000
20 Nov
9 months ago

spacedog4 left a reply on Shared Hosting Uploading Images

@SNAPEY - It worked, yaaay, but instead of ../www I used /../www, but now, every time I update a file in the public folder I should update the public folder of outside the project (~/www) and the other files in the normal folder (~/laravel) is it right?

spacedog4 left a reply on Shared Hosting Uploading Images

@SNAPEY - The problem is, my public_path aims to the laravel/public folder on root, and the asset generate an URL and this URL aims to www so the problem is when I hit http://engenhariamrc.com.br/upload it should be hitting laravel/public/upload but it hits www/upload