コード例 #1
0
ファイル: RestTest.php プロジェクト: dezvell/mm.local
 /**
  * Drop `test` table after the last test
  */
 public static function tearDownAfterClass()
 {
     Db::delete('test')->where('id IN (?)', [1, 2, 3, 4])->execute();
     Db::delete('test')->where('email = ?', '*****@*****.**')->execute();
     self::resetGlobals();
     self::resetApp();
 }
コード例 #2
0
ファイル: Table.php プロジェクト: dezvell/skeleton
 /**
  * generate action with token
  *
  * @param int $userId
  * @param string $action
  * @param int $expired in days
  * @param array $params
  * @return Row
  */
 public function generate($userId, $action, $expired = 5, $params = [])
 {
     // remove previously generated tokens
     Db::delete($this->table)->where('userId = ?', $userId)->andWhere('action = ?', $action)->execute();
     // create new row
     $actionRow = new Row();
     $actionRow->userId = $userId;
     $actionRow->action = $action;
     $random = range('a', 'z', rand(1, 5));
     shuffle($random);
     $actionRow->code = md5($userId . $action . join('', $random) . time());
     $actionRow->expired = date('Y-m-d H:i:s', strtotime("+{$expired} day"));
     $actionRow->params = $params;
     $actionRow->save();
     return $actionRow;
 }
コード例 #3
0
ファイル: QueryTest.php プロジェクト: dezvell/mm.local
 /**
  * tearDown
  */
 public function tearDown()
 {
     parent::tearDown();
     Proxy\Db::delete('test')->where('email = ?', '*****@*****.**')->execute();
 }
コード例 #4
0
ファイル: AuthProviderTest.php プロジェクト: dezvell/skeleton
 protected function tearDown()
 {
     Db::delete('users')->where('id IN (?)', [1, 2])->execute();
     Messages::popAll();
 }
コード例 #5
0
ファイル: delete.php プロジェクト: dezvell/skeleton
<?php

/**
 * Delete image from redactor
 *
 * @author   Anton Shevchuk
 * @created  19.06.13 18:18
 */
/**
 * @namespace
 */
namespace Application;

use Bluz\Proxy\Db;
return function ($path) {
    $this->useJson();
    /**
     * @var Users\Row $user
     */
    if (!$this->user()) {
        throw new Exception('User not found');
    }
    $userId = $this->user()->id;
    $result = Db::delete('media')->where('type LIKE (?)', 'image/%')->andWhere('file = ?', $path)->andWhere('userId = ?', $userId)->execute();
    return $result;
};
コード例 #6
0
ファイル: CrudTest.php プロジェクト: Kit-kat1/bluz
 /**
  * Drop photo after the test
  */
 public static function tearDownAfterClass()
 {
     Db::delete('media')->where('userId', [1])->execute();
     $path = Config::getModuleData('media', 'upload_path') . '/1';
     Tools\Cleaner::delete($path);
 }
コード例 #7
0
ファイル: user.php プロジェクト: bluzphp/skeleton
 * @accept HTML
 * @accept JSON
 * @privilege Management
 *
 * @param int $id
 * @return bool
 * @throws Exception
 */
return function ($id) {
    /**
     * @var Controller $this
     */
    $user = Users\Table::findRow($id);
    if (!$user) {
        throw new Exception('User ID is incorrect');
    }
    if (Request::isPost()) {
        $roles = Request::getParam('roles');
        // update roles
        Db::delete('acl_users_roles')->where('userId = ?', $user->id)->execute();
        foreach ($roles as $role) {
            Db::insert('acl_users_roles')->set('userId', $user->id)->set('roleId', $role)->execute();
        }
        // clean cache
        Cache::delete('user:'******'User roles was updated');
        return false;
    }
    $this->assign('user', $user);
    $this->assign('roles', Roles\Table::getInstance()->getRoles());
};
コード例 #8
0
ファイル: CrudTest.php プロジェクト: bobrofor/menuProject
 /**
  * delete dish
  */
 private function deleteTestDish()
 {
     Db::delete('dishes')->where('title=?', $this->validData['title'])->execute();
 }
コード例 #9
0
ファイル: CrudTest.php プロジェクト: Kit-kat1/bluz
 /**
  * Drop `test` table after the last test
  */
 public static function tearDownAfterClass()
 {
     Db::delete('musician')->execute();
 }