https://cscheng.info/2018/08/19/trying-out-aws-cloud9-ide-for-django-development.html
Instead To run: python3 manage.py runserver 8080
https://cscheng.info/2018/08/19/trying-out-aws-cloud9-ide-for-django-development.html
Instead To run: python3 manage.py runserver 8080
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Order Form</title> |
<?php | |
Validator::extend('combinedUnder3', function ($attribute, $value, $parameters, $validator) | |
{ | |
$data = $validator->getData(); | |
return ($data->number1 + $data->number2) < 3; | |
}); | |
?> |
**STATIC TABLE SEEDS** | |
problem | |
There's no elegant way for seeding application data that you want versioned and mirrored on all our servers. You can create traditional seeds but you end up reseeding all your application data each time (which is annoying with large tables) or you have to do some wonky work arounds for each server. | |
characteristics of STATIC tables | |
- table data should match per server, the same way file data does | |
- data should never be added by users | |
- code data is dependent upon | |
- there should not be any coupling based on this data, e.g., it should not send any alerts/messages that would depend upon “create” events etc |
<?php | |
//USAGE | |
//in your model | |
public function scopeGlobal($query) | |
{ | |
//todo: there may be a bug where you can't use nested wheres..try with ->where(function($query){return MyModel::noEasyGlobal();} | |
return MyModel::noEasyGlobal()->where('is_published',1); //replace this with whatever criteria you ahve |