SerhiiNuzhnyi

Experience

190

0 Best Reply Awards

  • Member Since 2 Weeks Ago
  • 0 Lessons Completed
  • 0 Favorites

26th May, 2017

SerhiiNuzhnyi left a reply on UpdateOrCreate Doesn't Work • 2 days ago

Thank you, everything work now. I've got MassAssignmentException.

SerhiiNuzhnyi started a new conversation UpdateOrCreate Doesn't Work • 2 days ago

I have this code to update or create new row in table 'roles'. I receive $data and use App\Role but code doesn't work

$role = Role::updateOrCreate(
            ['id' => $data['id']],
            ['name' => $data['val']]
        );

14th May, 2017

SerhiiNuzhnyi left a reply on Single Page For Editing Small Table • 2 weeks ago

Is it some plugin?

SerhiiNuzhnyi started a new conversation Single Page For Editing Small Table • 2 weeks ago

I get all data from a small table and want to edit data at frontend and save changed rows back to database without reload page. What is the easiest way to do that?

13th May, 2017

SerhiiNuzhnyi left a reply on Cannot Use Object Of Type StdClass As Array • 2 weeks ago

@Snapey thank you. I guessed what you mean. It works in such way

<?php foreach ($roles as $role):?>
              <li>
                  <?php echo $role->name; ?><br>
              
              </li>
                          <?php endforeach; ?>

SerhiiNuzhnyi left a reply on Cannot Use Object Of Type StdClass As Array • 2 weeks ago

MaverickChan: your code cause the same error. Snapey: Laravel Framework 5.4.21. I use it in blade as

<?php foreach ($roles as $role):?>
              <li>
                  <?php echo $role['name']; ?><br>
              
              </li>
                          <?php endforeach; ?>

12th May, 2017

SerhiiNuzhnyi started a new conversation Cannot Use Object Of Type StdClass As Array • 2 weeks ago

I have a function in my controller. Here are three ways to get all data from database table. All work fine but I can pass to View only first. Other two which are commented cause error Cannot use object of type stdClass as array public function roles_list(){ $roles = Role::all(); //$roles = DB::select('SELECT * FROM roles'); //$roles = DB::table('roles')->get(); return view('admin.role')->with(['roles'=>$roles]);; }

Edit Your Profile
Update

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