Friday, 13 July 2018

array_push() merging multiple array

That's because you're adding a non-object to the last element of the array.
Here i suppose you get an array of objects with the name property
$competition_all = Competition::all();
Here you add a key=>value pair to the last element of the objects array
$newCompete = array('name'=>'Others');
array_push($competition_all, $newCompete);
Here you walk through the array of objects and when it comes to the last element the "$competition_games->name" has no name property
foreach ($competition_all as $competition_games) {
            $this->competition_games[$competition_games->name] = $competition_games->name;
        }
Try something like including a stdclass for it like :
$newCompete = new StdClass();
$newCompete->name = 'Others';
array_push($competition_all, $newCompete);

Merging into New Laravel Collection



resources :

https://stackoverflow.com/questions/23599584/how-to-manually-create-a-new-empty-eloquent-collection-in-laravel-4

Wednesday, 11 July 2018

Interview Training

connect mysql from cli :

cd  "C:\wamp64\bin\mysql\mysql5.7.21\bin"

C:\wamp64\bin\mysql\mysql5.7.21\bin > mysql.exe -u root


Microsoft .Net  utilities :

1. Entity Framework
2. LinQ .(Net Integrated Query)

Wednesday, 4 July 2018