public function editAction($id)
    {
        $profile = Profiles::findFirstById($id);
        if (!$profile) {
            $this->flash->error("Profile was not found");
            return $this->dispatcher->forward([
                'action' => 'index'
            ]);
        }

        if ($this->request->isPost()) {

            $profile->assign([
                'name' => $this->request->getPost('name', 'striptags'),
                'active' => $this->request->getPost('active')
            ]);

            if (!$profile->save()) {
                $this->flash->error($profile->getMessages());
            } else {
                $this->flash->success("Profile was updated successfully");
            }

            Tag::resetInput();
        }

        $this->view->form = new ProfilesForm($profile, [
            'edit' => true
        ]);

        $this->view->profile = $profile;
    }
public function editAction($id)
    {
        $profile = Profiles::findFirstById($id);
        if (!$profile) {
            $this->flash->error("Profile was not found");
            return $this->dispatcher->forward([
                'action' => 'index'
            ]);
        }

        if ($this->request->isPost()) {

            $profile->assign([
                'name' => $this->request->getPost('name', 'striptags'),
                'active' => $this->request->getPost('active')
            ]);

            if (!$profile->save()) {
                $this->flash->error($profile->getMessages());
            } else {
                $this->flash->success("Profile was updated successfully");
            }

            Tag::resetInput();
        }

        $this->view->form = new ProfilesForm($profile, [
            'edit' => true
        ]);

        $this->view->profile = $profile;
    }
public function editAction ( $ id ) { $ profile = Profiles :: findFirstById ( $ id ) ; if ( ! $ profile ) { $ this -> flash -> error ( "Profile was not found" ) ; return $ this -> dispatcher -> forward ( [ 'action' => 'index' ] ) ; } if ( $ this -> request -> isPost ( ) ) { $ profile -> assign ( [ 'name' => $ this -> request -> getPost ( 'name' , 'striptags' ) , 'active' => $ this -> request -> getPost ( 'active' ) ] ) ; if ( ! $ profile -> save ( ) ) { $ this -> flash -> error ( $ profile -> getMessages ( ) ) ; } else { $ this -> flash -> success ( "Profile was updated successfully" ) ; } Tag :: resetInput ( ) ; } $ this -> view -> form = new ProfilesForm ( $ profile , [ 'edit' => true ] ) ; $ this -> view -> profile = $ profile ; }
Edits an existing Profile

@param int $id
Edits an existing Profile