Laravel returns json string on local machine but integer on beanstalk excavator instance

I had a strange problem with aws, mysql, laravel and angular.

I have a vagrant instance running locally with both of my applications and databases running on it.

I use angular in the interface, so when loading a view, angular makes a request to get a list of all the "goals" entered by the user. One of the goals is the goal of Status. it is either 0 or 1 stored as an integer in the mysql table.

angular checks to see if it has a value of 0 or 1 and displays another table cell depending on a result like

<th ng-if="goal.goalStatus === '0'"><p class="text-danger">In Progress</p></th>
<th ng-if="goal.goalStatus === '1'"><p class="text-success">Achieved</p></th>

in chrome dev tools, when I look at the response result for this request, I see that returnStatus is returned this way

"goalStatus":"0"

angular if .

, beanstalk, mysql rds, , dev tools Status,

"goalStatus":0

angular, ,

, , beanstalk , . , mysql, laravel - .

? laravel

  

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateGoalsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goals', function(Blueprint $table) {
            $table->increments('id');
            $table->integer('userId');
            $table->string('title');
            $table->string('goalDesc');
            $table->integer('goalStatus')->nullable();
            $table->integer('bodyGoalId')->nullable();
            $table->integer('strengthGoalId')->nullable();
            $table->integer('distanceGoalId')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('goals');
    }

}

<?php

class GoalsTableSeeder extends Seeder
{
    public function run()
    {
        // Uncomment the below to wipe the table clean before populating
        DB::table('goals')->truncate();

        $now = date('Y-m-d H:i:s');

        $goals = array(array(
            'userId' => 1,
            'title' => 'first goal title',
            'goalDesc' => 'This should describe my goal in text form',
            'goalStatus' => 0,
            'bodyGoalId' => null,
            'strengthGoalId' => null,
            'distanceGoalId' => 1,
            'created_at' => $now,
            'updated_at' => $now),
            array(
                'userId' => 1,
                'title' => 'strength goal title',
                'goalDesc' => 'This should describe my strngth goal in text form',
                'goalStatus' => 0,
                'bodyGoalId' => null,
                'strengthGoalId' => 1,
                'distanceGoalId' => null,
                'created_at' => $now,
                'updated_at' => $now),
            array(
                'userId' => 1,
                'title' => 'body goal title',
                'goalDesc' => 'This should describe my body goal in text form',
                'goalStatus' => 0,
                'bodyGoalId' => 1,
                'strengthGoalId' => null,
                'distanceGoalId' => null,
                'created_at' => $now,
                'updated_at' => $now)
        );

        // Uncomment the below to run the seeder
        DB::table('goals')->insert($goals);
    }

}
+3
1

, , -, php mysql, .

awas- beanstalk, , , ints ints, php5_mysqlnd , ,

+7

All Articles