本文整理汇总了PHP中License::where方法的典型用法代码示例。如果您正苦于以下问题:PHP License::where方法的具体用法?PHP License::where怎么用?PHP License::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类License
的用法示例。
在下文中一共展示了License::where方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postGenerateLicense
/**
* Generate license
*/
public function postGenerateLicense()
{
$rules = array('transaction_id' => 'required');
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::to('admin/utilities/generate-license')->withErrors($validator)->withInput();
} else {
$transaction_id = Input::get('transaction_id');
if ($transaction = Transaction::where('id', '=', $transaction_id)->first()) {
if ($license = License::where('transaction_id', '=', $transaction_id)->first()) {
Session::flash('alert_error', '<strong>Ooops!</strong> License for given transaction already exists.');
return Redirect::to('admin/licenses?q=' . $license->license_key . '¶m=key');
}
$plan = Plan::where('id', '=', $transaction->plan_id)->first();
if ($plan->has_license) {
$product = Product::where('id', '=', $plan->product_id)->first();
$license_key = License::generate($product->code);
// Save license
$license = new License();
$license->license_key = $license_key;
$license->transaction_id = $transaction_id;
$license->allowed_usage = $plan->license_allowed_usage;
$license->save();
Session::flash('alert_message', '<strong>Well done!</strong> You successfully have generated license key.');
return Redirect::to('admin/licenses?q=' . $license_key . '¶m=key');
} else {
Session::flash('alert_error', '<strong>Ooops!</strong> This plan does not allow to generate a license key.');
return Redirect::to('admin/utilities/generate-license');
}
} else {
Session::flash('alert_error', '<strong>Ooops!</strong> Transaction was not found.');
return Redirect::to('admin/utilities/generate-license');
}
}
}
示例2: getByTitle
/**
* Fetch a License by its title (=id)
*/
public function getByTitle($title)
{
$license = \License::where('title', '=', $title)->first();
if (!empty($license)) {
return $license->toArray();
}
return $license;
}
示例3: profile
public function profile()
{
$neighbor_id = Auth::user()->id;
$colonia = Session::get("colonia");
$urbanismUsers = Urbanism::where('colony_id', '=', $colonia)->first();
$neighbor = Neighbors::with('NeighborProperty')->where('user_id', '=', $neighbor_id)->first();
$role = AssigmentRole::where('user_id', '=', $neighbor_id)->where('colony_id', '=', $colonia)->first();
$neighbor_role = ucfirst($role->Role->name);
$licencia = License::where('colony_id', '=', $colonia)->first();
$expiration_license = LicenseExpiration::where('colony_id', '=', $colonia)->first();
$photo_user = UserPhoto::where('user_id', '=', $neighbor_id)->where('colony_id', '=', $colonia)->pluck('filename');
return View::make('dashboard.neighbors.profile', ['neighbor' => $neighbor, 'colonia_nombre' => $urbanismUsers->Colony->name, 'urbanism' => $urbanismUsers->Colony->name, 'role' => $neighbor_role, 'licencia' => $licencia, 'photo_user' => $photo_user, 'expiration_license' => $expiration_license]);
}
示例4: license_store
public function license_store()
{
$data = Input::all();
$colonia = Input::get('colony_id');
$code = Input::get('code');
$license_colonia = License::where('colony_id', '=', $colonia)->get();
$code_exist = 0;
foreach ($license_colonia as $lic) {
if ($code == Crypt::decrypt($lic->code)) {
$code_exist = 1;
$code_id = $lic->id;
$lic_status = $lic->status;
}
}
if ($code_exist == 1) {
if ($lic_status == 0) {
$license = License::where('id', '=', $code_id)->first();
$license->status = 1;
if ($license->update(['id'])) {
$expiration = Expiration::where('colony_id', '=', $colonia)->first();
$expiration->status = 2;
$expiration->update(['id']);
Session::put('days_expiration', 0);
$expiration_lic = LicenseExpiration::where('colony_id', '=', $colonia)->first();
if ($expiration_lic->expiration == null) {
$expiration_old = date('Y-m-j');
} else {
$expiration_old = date('Y-m-j', strtotime($expiration_lic->expiration));
}
$newExpiration = strtotime('+' . $license->months . ' month', strtotime($expiration_old));
$newExpiration = date('Y-m-j', $newExpiration);
$expiration_lic->expiration = $newExpiration;
$expiration_lic->update(['id']);
$datetime2 = new DateTime($expiration_lic->expiration);
$datetime1 = new DateTime(date('Y-m-d'));
$interval = $datetime1->diff($datetime2);
$days_expiration = $interval->format('%a');
Session::put('lic_fecha_expiration', $expiration_lic->expiration);
Session::put('lic_expiration', $days_expiration);
$notice_msg = 'Código de la licencia activado';
return Redirect::route('home')->with('notice_modal', $notice_msg);
}
} else {
$error_msg = 'Este Código de licencia ya se fue utilizado';
return Redirect::back()->with('error_modal', $error_msg);
}
} else {
$error_msg = 'Código de la licencia inválido';
return Redirect::back()->with('error_modal', $error_msg);
}
}
示例5: generate
/**
* Generate unique license key
*/
static function generate($product_code = NULL)
{
if (!$product_code) {
return FALSE;
}
do {
$license_key = strtoupper($product_code . '-' . str_random(4) . '-' . str_random(4) . '-' . str_random(4) . '-' . str_random(4));
$unique = TRUE;
$license = License::where('license_key', '=', $license_key)->first();
if ($license) {
$unique = FALSE;
}
} while (!$unique);
return $license_key;
}
示例6: send_cupon
public function send_cupon($id)
{
$license = License::where('id', '=', $id)->first();
$user_id = AssigmentRoleHab::where('role_id', '=', 2)->where('colony_id', '=', $license->colony_id)->pluck('user_id');
$admin_user = DB::connection('habitaria_dev')->select('select email from users where id = ? ', [$user_id]);
foreach ($admin_user as $user) {
$admin_email = $user->email;
}
$admin_neighbor = Neighbors::where('user_id', '=', $user_id)->first();
$colony_data = Colony::where('id', '=', $license->colony_id)->first();
$colony_name = $colony_data->name;
$data = array('email' => $admin_email, 'months' => $license->months, 'code' => Crypt::decrypt($license->code), 'colony' => $colony_name, 'admin' => $admin_neighbor->name . ' ' . $admin_neighbor->last_name);
Mail::send('emails.cupon_license', $data, function ($message) use($admin_email) {
$message->subject('Licencia para HABITARIA');
$message->to($admin_email);
});
$notice_msg = 'Licencia enviada al administrador de la Colonia: ' . $colony_name;
return Redirect::back()->with('error', false)->with('msg', $notice_msg)->with('class', 'info');
}
示例7: activate
public function activate()
{
$inputs = Input::all();
//dd($inputs);
if (Input::has('license') && Input::has('domain')) {
//verify new licenses
$license = License::available($inputs['license'])->first();
if ($license) {
$license->activate($inputs['domain']);
return Response::json(["status" => 'active', "condition" => 'new']);
} else {
//verify used licenses
$license = License::where('domain', $inputs['domain'])->first();
if ($license) {
if ($license->license == $inputs['license']) {
return Response::json(["status" => 'active', "condition" => 'reactivated']);
}
}
}
}
return Response::json(["status" => 'invalid']);
}
示例8: claim_license
public function claim_license()
{
$license = License::where('license_key', '=', Input::get('license_key'))->where('is_claimed', '=', false)->first();
if ($license) {
if ($license->transaction_reference != 'TEST_MODE') {
$license->is_claimed = true;
$license->save();
}
return 'valid';
} else {
return 'invalid';
}
}
示例9: License
function update_license($nations) {
$comic_id = $this->id;
log_message('error', 'updatecomic');
$licenses = new License();
$licenses->where('comic_id', $comic_id)->get();
$removeme = array();
foreach ($licenses->all as $key => $license) {
$removeme[$key] = $license->nation;
}
$temp_nations = $nations;
foreach ($nations as $key => $nation) {
$found = false;
foreach ($licenses->all as $subkey => $license) {
if ($nation == $license->nation) {
unset($removeme[$subkey]);
$found = true;
}
}
if (!$found && $nation != "") {
$new_license = new License();
$new_license->comic_id = $comic_id;
$new_license->nation = $nation;
$new_license->save();
}
}
foreach ($removeme as $key => $nation) {
$remove = new License();
$remove->where('comic_id', $comic_id)->where('nation', $nation)->get()->remove();
}
}
示例10: claim_license
public function claim_license()
{
$licenseKey = Input::get('license_key');
$productId = Input::get('product_id', PRODUCT_ONE_CLICK_INSTALL);
$license = License::where('license_key', '=', $licenseKey)->where('is_claimed', '=', false)->where('product_id', '=', $productId)->first();
if ($license) {
if ($license->transaction_reference != 'TEST_MODE') {
$license->is_claimed = true;
$license->save();
}
return $productId == PRODUCT_INVOICE_DESIGNS ? $_ENV['INVOICE_DESIGNS'] : 'valid';
} else {
return 'invalid';
}
}
示例11: postGenerateLicense
/**
* Generate License
*
* Generate license of any product
*/
public function postGenerateLicense()
{
//if($this->_isValidRequest())
//{
$prefix = Input::get('code');
$transaction_id = Input::get('transaction_id');
$allowed_usage = Input::get('allowed_usage');
if (!$transaction_id) {
$this->_invalidRequest("Transaction ID parameter is required");
}
if (!$allowed_usage) {
$this->_invalidRequest("Allowed Usage parameter is required");
}
// Check if license is already created for given transaction
if (License::where('transaction_id', '=', $transaction_id)->first()) {
$this->_invalidRequest("License already exists for transaction with ID: {$transaction_id}");
}
$license_key = License::generate($prefix);
// Save license
$license = new License();
$license->license_key = $license_key;
$license->transaction_id = $transaction_id;
$license->allowed_usage = $allowed_usage;
$license->save();
$data = array('license_key' => $license_key);
die(json_encode(array('data' => $data)));
//}
}
示例12: getActivate
public function getActivate($license_key)
{
$license = License::where('license_key', '=', $license_key)->first();
// Update License
$license->status = 1;
$license->save();
Session::flash('alert_message', "<strong>Done!</strong> You successfully have re-activated the access of a license ({$license->license_key}).");
return Redirect::to("admin/licenses");
}