Input/Output Stream
In the previous chapter, we covered the basics to create a write event and a read event. Most of the time, an application needs to perform buffered data operations in addition to responding to events. Read events are normally passive while write events are proactive. When we want to read data, the control flow looks like:
- Register a read callback.
- Wait for the device to become readable.
- Read as much as data from the kernel buffer to our data buffer.
On the other hand, the control flow to write data has the following pattern:
- Write data to our write buffer.
- Wait for the device to become writable.
- Flush the data from our data buffer to the kernel buffer in the write callback.
InputStream
and OutputStream
for them.
DtCraft currently suppors only stream-oriented protocols such as pipe and TCP socket.
We may add support for datagram-oriented protocols like UDP in the future.
The source code can be found in include/dtc/ipc/ipc.hpp
and
src/ipc/ipc.cpp
.
Input Stream
InputStream
is a class derived from ReadEvent
and has an input buffer
InputStreamBuffer
in charge of read-related operations.
The structure of InputStream
is very similar to ReadEvent
.
When the associated device becomes readable, the reactor dispatches it to a worker thread to invoke
the callback.
There are many ways to read data from InputStream
.
First, you could get its raw file descriptor and stick with POSIX
read.
Second, you could use read operations defined in its public member isbuf
.
Third, you could call its thread-safe operator ()
to deserialize data in binary format.
We will discuss our built-in deserialization library in later section.
Example: Create an Input Stream Event
The example below creates an input stream event and synchronize its input buffer with the underlying device in its callback.
auto is = reactor.insert<InputStream>(
std::move(device),
[] (dtc::InputStream& istream) {
try {
istream.isbuf.sync();
}
catch(const std::exception& e) {
std::<< e.what() << '\n';
std::exit(EXIT_FAILURE);
}
}
);
Note: The input stream event is level-trigger. The reactor keeps invoking its callback until all data is drained out from the kernel buffer to the user-space buffer.
Output Stream
OutputStream
is a class derived from WriteEvent
and has a output buffer
OutputStreamBuffer
in charge of write-related operations.
Unlike WriteEvent
which requires users to explicitly call thaw
to
bring a write event back for polling,
OutputStreamBuffer
automatically notifies the reactor when the associated buffer has data.
In other words, when you perform write operations through OutputStream
,
it will unfreeze itself for polling until the buffer becomes empty.
There are many ways to write data through OutputStream
.
First, you could get its raw file descriptor and stick with POSIX
write.
Second, you could use write operations defined in its public member osbuf
.
Third, you could call its thread-safe operator ()
to serialize data in binary format.
We will discuss our built-in serialization library in later section.
Example: Create a Output Stream Event
The example below creates a output stream event and sends a test message. The callback synchronizes its output buffer with the underlying device.
auto os = reactor.insert<OutputStream>(
std::move(device),
[] (dtc::OutputStream& ostream) {
try {
ostream.osbuf.sync();
}
catch(const std::exception& e) {
std::<< e.what() << '\n';
std::exit(EXIT_FAILURE);
}
}
);
for(int i=0; i<4; ++i) {
std::thread t([os](){
(*os)(std::string{"hello world from thread "} + std::to_string(i));
});
}
Note: The reactor keeps invoking the callback of a output stream event when both of its output buffer has data pending and the associated device becomes writable, until all data are flushed.
Stream Buffer
Stream buffer implements a queue of bytes, adding data to the end and removing data from the front.
It provides a variety of read and write operations, and works seamlessly with our built-in serialization
and deserialization library.
DtCraft provides two types of stream buffers, OutputStreamBuffer
and
InputStreamBuffer
.
Each stream buffer has a mutex to protect the underlying queue from race condition.
The source code of stream buffer can be found in include/dtc/ipc/streambuf.hpp
and src/ipc/streambuf.cpp
.
Input Stream Buffer
An input stream buffer contains a linear character array to buffer input operations. It can synchronize data with a given device and perform read operations on the buffer. By default, it is safe to access an input stream buffer from multiple threads. The code below shows a list of common methods provided by the input stream buffer.
class InputStreamBuffer {
std::streamsize in_avail() const;
std::streamsize sync();
std::streamsize read(void* array, std::streamsize n);
std::streamsize copy(void* array, std::streamsize n) const;
std::streamsize drop(std::streamsize n);
std::string_view string_view() const;
void device(Device* ptr);
Device* device() const;
};
These methods are self-explanatory by their names.
in_avail
returns the number of available characters in the buffer.sync
performs an one-time synchronization with the associated device, returning the number of bytes synchronized or throwing any exception byDevice::read
. If no device is associated with the input stream buffer,sync
returns -1.read
extracts up ton
bytes from the input buffer toarray
, returning the actual number of bytes extracted.copy
copies up ton
bytes from the input buffer toarray
, returning the actual number of bytes copied.drop
removes up ton
bytes from the input buffer by simply advancing the buffer pointer.string_view
returns a constant character description over the input buffer.device
lets you associate a new device to or get the present device of an input stream buffer.
The input stream buffer dynamically increases its buffer size during sync
to
accommondate data from the device.
Example: Create an Input Stream Buffer
The example below creates an input stream buffer and associates it with a device.
InputStreamBuffer isbuf (device.get());
Example: Read all Device Data to an Input Stream Buffer
The example below tries to drain all data from a device to an input stream buffer.
while(1) {
try {
if(auto ret = isbuf.sync(); ret == -1) { // EAGAIN or EWOULDBLOCK
std::cout << "Device has no more data to read.\n";
break;
}
}
catch (const std::exception& e) { // Error occurs.
std::cout << e.what() << '\n';
}
}
Example: Inspect an Input Stream Buffer
The example below demonstrates how to copy and inspect data from an input stream buffer.
auto view = isbuf.string_view();
std::vector<char> vec(isbuf.in_avail());
auto n = isbuf.copy(vec.data(), vec.size());
assert(memcmp(view.data(), vec.data(), sizeof(char)*n) == 0);
Note 1: The input stream buffer shares NO ownership of the device. It is user's responsibility to verify the lifetime of the device to prevent synchronization error.
Note 2: The string view of an input stream buffer is a snapshot. Subsequent read operations can invalidate its pointer value.
Output Stream Buffer
A output stream buffer contains a linear character array to buffer output operations. It defines methods to write data to the buffer and synchronize the buffer with the associated device. By default, it is safe to access a output stream buffer from multiple threads. The code below shows a list of common methods provided by a output stream buffer.
class OutputStreamBuffer {
std::streamsize out_avail() const;
std::streamsize flush();
std::streamsize sync();
std::streamsize write(const void* array, std::streamsize n);
std::streamsize copy(void* array, std::streamsize n) const;
std::string_view string_view() const;
void device(Device* ptr);
Device* device() const;
};
These methods are self-explanatory by their names.
out_avail
returns the number of available characters in the buffer.flush
writes all buffered data to the associated device, returning the number of bytes flushed or throwing any exception byDevice::write
. If no device is associated with the output stream buffer,flush
returns -1.sync
performs an one-time synchronization with the associated device, returning the number of bytes synchronized or throwing any exception byDevice::write
. If no device is associated with the output stream buffer,sync
returns -1.write
puts up ton
bytes from thearray
to the output buffer, returning the actual number of bytes inserted.copy
copies up ton
bytes from the output buffer toarray
, returning the actual number of bytes copied.string_view
returns a constant character description over the output buffer.device
lets you associate a new device to or get the present device of a output stream buffer.
The output stream buffer dynamically doubles its size during write
to ensure enough space
accommodate written data.
Example: Create a Output Stream Buffer
The example below creates a output stream buffer and associates it with a device.
OutputStreamBuffer osbuf (device.get());
Example: Flush a Output Stream Buffer
The example below writes all data in a output stream buffer via its underlying write function.
try {
if(auto ret = osbuf.flush(); ret == -1) { // EAGAIN or EWOULDBLOCK
std::cout << "Device is busy. Try later.\n";
}
else assert(osbuf.out_avail() == 0);
}
catch (const std::exception& e) { // Error occurs.
std::cout << e.what() << '\n';
}
Example: Write Data to a Output Stream Buffer
The example below writes a character sequence to a output stream buffer.
std::string data {"a character sequence"};
auto n = osbuf.write(data.c_str(), data.size());
assert(osbuf.out_avail() == n && n == data.size() && osbuf.string_view() == data);
Note 1: The output stream buffer shares NO ownership of the device. It is user's responsibility to verify the lifetime of the device to prevent synchronization error.
Note 2: The string view of a output stream buffer is a snapshot. Subsequent write operations can invalidate its pointer value.
Archiver
DtCraft has a built-in library, archiver, to serialize data and deserialize data
from an input or a output stream buffer.
Our archiver directly works on top of our stream buffer objects, requiring no extra copy in user space.
It supports most of C++ standard containers and classes, and can be extended to handle your own types.
The source code can be found in include/dtc/archive/
.
POD and STL Supports
By default, our archiver supports the following types:
- Arithmetic POD (bool, char, int, float, double, etc).
- Enumeration type.
- C++ standard sequence containers,
array
,vector
,list
,deque
, andforward_list
. - C++ standard associative containers,
set
,multiset
,map
, andmultimap
. - C++ standard unordered associative containers,
unordered_set
andunordered_map
. - C++ standard chrono classes,
duration
andtime_point
. - C++ standard optional class,
optional
. - C++ standard variant class,
variant
. - C++ standard tuple class,
tuple
. - Eigen matrix type.
Binary Input/Output Archiver
We use BinaryOutputArchiver
to serialize data and
BinaryInputArchiver
to deserialize data in binary format.
Binary archiver is designed to produce compact data representation at bit level
and is not human readable. It operates on either OutputStreamBuffer
or InputStreamBuffer
. We use operator ()
to perform
serialization and deserialization on a parameter pack.
The return is a value of type std::streamsize
telling how many bytes are transmitted.
Example: Archive Data in Binary Format
The example below shows how to serialize and deserialize data in binary format.
dtc::OutputStreamBuffer osbuf;
dtc::InputStreamBuffer isbuf;
dtc::BinaryOutputArchiver oar(osbuf);
dtc::BinaryInputArchiver iar(isbuf);
int o1 {1}, i1;
std::string o2 {"test"}, i2;
std::variant<int, double, std::vector<char>> o3 {1.2}, i3;
std::streamsize num_obytes = oar(o1, o2, o3);
std::streamsize num_ibytes = iar(i1, i2, i3);
assert(num_obytes == num_ibytes && o1 == i1 && o2 == i2 && o3 == i3);
Archive a Custom Type
To make your own type work with our archiver, add a template method archive
in the public
scope to your class. This lets our archiver know which data members to serialize and deserialize.
Example: Add Archive Method to Your Classes
The example below shows how to adapt your own type to our archiver interface.
struct MyType {
int a;
double b;
std::tuple<std::string, char> c;
template <typename ArchiverT>
auto archive(ArchiverT& ar) {
return ar(a, b, c);
}
};
Note: If you do not apply the archiver operator to multiple data at one time, you must return the sum of individual returns.
Where to Go from Here?
Congratulations! You have studied one core component in DtCraft. In the next chapter, we will go over the stream graph and key graph components to get your distributed applications up and running.


{{_("Dear")}} {{ fullname }},
{{_("You Support Ticket is Created Successfully. Please check support ticket details.")}}
{{_("Thank you")}}, {{_("Team HelpDesk")}}


When you need just a bit of incentive to, you know, not exploit that hack
The amount of each reward will vary based on severity (guided by the OWASP method). Rewards will be paid out from the worker proposal escrow account in bitUSD to a BitShares account specified by the reward recipient. We may be required by local law to ask for proof of identity before dispersing funds. Researchers who have been awarded bounties will also be listed on the leaderboard.
The audit panel will use the following severity scale and reward estimates as guidelines.
| Overall Risk Severity | ||||
|---|---|---|---|---|
| Impact | HIGH | Medium | High | Critical |
| MEDIUM | Low | Medium | High | |
| LOW | Note | Low | Medium | |
| LOW | MEDIUM | HIGH | ||
| Likelihood |
To qualify for higher rewards, the submission should include everything the auditing panel would need to reproduce and verify the vulnerability. The submission should also be well-prepared and of high quality so that it can be shared with the community as part of our transparency process.


Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Alexander Rouge 6Months Ago
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus sceleri sque pretium in euismod. Nam vitae urnasodales neque in faucibus.
Reply


Our Goal
Your Success
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
Projects Complete
Happy Clint
Award Earned
Projects Complete
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
All
Comercial
Educational
Educational
Educational
Educational
Educational
Educational


German children fish out WWII ammunition from pond
by EuronewsThree children fished out World War Two ammunition from a pond in Germany, police revealed on Sunday.
The incident took place in Ohrdruf, a town in the east-central state of Thuringia.
The three children reeled out ammunition and bullet fragments from the pond by using a strong magnet, local police said in a statement.
Once they realised what they had dragged out, they called the police who locked the site down and disposed of the equipment. No one was hurt.
Police warned people against "such recreational activities" and stressed that they should leave any ammunition they come across on the spot they were found and immediately call the authorities.
Seventy-five years after the end of WWII, unexploded bombs are regularly found across the country. Earlier this year, 16,000 people had to be evacuated in Frankfurt while experts defused a 500 kilogramme WWII bomb found near the European Central bank.
READ MORE: 16,000 evacuated in Frankfurt to defuse WWII bomb


Currently, there are 2 built-in themes: light and dark
To use built-in themes, see Basic usage.
Use the theme toggler in the tool bar to see built-in light and dark theme in action.


People in the design community have not been hinting at being mobile first so much as yelling it through the streets or sagely telling newcomers this phrase like it is a cautionary tale. As a newbie myself, I’ve heard it and now I need to practice it. But HOW?


We deliver filling sand for your building contruction and engineering works.
We supply high quality granites at an affordable market price
We supply quality sharp sound for your contruction works at an affordable price and stress free delevery rates
Whatsapp:<PHONE_NUMBER>7
Address: ... Lagos, NigeriaWorking hours: 6am-7pm (Mon-Sun)


Hey!


Facial Recognition Demo
This is my full stack weekend project. It performs Facial Recognition using Keras Implementation of VGG Face by RCMalli. The source code for this website can be found HERE
Please follow the following instructions as we proceed forward:
- Upload pictures of the people whose faces you would like to recognize in the future
- Faces will be detected and you will be prompted to enter the names of each detected face. You can skip a face if you don't want it to be identified.
- Upload the query images (different form the first ones) where the same labeled group of faces are present.
{% endblock content %}


I've migrated this site to https://jennydaman.gitlab.io. Integrated dev-ops for the win!
If you have JavaScript enabled, you will be redirected.


Thank you for visiting TENNIS.com, a Tennis Media Co LLC site. Your privacy is important to us. To better protect your privacy, we provide this notice explaining our information practices and the choices you can make about the way your information is collected and used by Tennis Media Co LLC. This web site is governed by this Privacy Notice.
The Information We Collect
Through Tennis Media Co LLC publications, websites, and other media, you can order products, enter contests, vote in polls or otherwise express an opinion, subscribe to one of our services such as our online newsletters, or participate in one of our online forums or communities. You are able to visit much of this website and enjoy many Tennis Media Co LLC publications and promotions without providing any personally identifiable information. Sometimes, however, we do need your personally identifiable information to provide you with the products and services that you request. The types of personally identifiable information that may be collected at these pages and elsewhere include, but are not limited to: name, address, e-mail address, telephone number, fax number, credit card information, and information about your interests in and use of various products, programs, and services.
At some Tennis Media Co LLC sites and through certain promotions, you can submit information about other people. For example, you might submit a person's name and e-mail address to send an electronic greeting card and, if you order a gift online or offline and want it sent directly to the recipient, you might submit the recipient's name and address. The types of personally identifiable information that may be collected about other people at these pages include: recipient's name, address, e-mail address, and telephone number.
For certain promotions, only persons who provide us with the requested personally identifiable information will be able to order products, programs, and services or otherwise participate in the promotion's activities and offerings.
We also may collect certain non-personally identifiable information when you visit many of our web pages such as the type of browser you are using, the type of operating system you are using, and the domain name of your Internet service provider.
How We Use the Information
We may use the information you provide about yourself to fulfill your requests for our products, programs, and services, to respond to your inquiries about offerings, and to offer you other products, programs or services that we believe may be of interest to you.
We sometimes use this information to communicate with you, such as to notify you when you have won one of our contests or when we make changes to subscriber agreements, to fulfill a request by you for an online newsletter, or to contact you about your account with us.
We use the information that you provide about others to enable us to send them your gifts or cards. From time to time, we also may use this information to offer our products, programs, or services to them.
If you choose to submit content for publication (e.g., a "letter to our editors"), we may publish your name, screen name, and other information you have provided to us.
The information we collect in connection with our online forums and communities is used to provide an interactive experience. We use this information to facilitate participation in these online forums and communities and, from time to time, to offer you products, programs, or services.
We sometimes use the non-personally identifiable information that we collect to improve the design and content of our publications and websites and to enable us to personalize your Internet experience. We also may use this information in the aggregate to analyze site usage, as well as to offer you products, programs, or services.
We will disclose information we maintain when required to do so by law, for example, in response to a court order or a subpoena. We also may disclose such information in response to a law enforcement agency's request.
Agents and contractors of Tennis Media Co LLC who have access to personally identifiable information are required to protect this information in a manner that is consistent with this Privacy Notice by, for example, not using the information for any purpose other than to carry out the services they are performing for Tennis Media Co LLC.
We may transfer your personally identifiable information to other Tennis Media Co LLC offices for internal management and administrative purposes. Your personal data will be transferred to other Tennis Media Co LLC offices where necessary for the performance or conclusion of our contractual obligations to you or for your benefit. Transfers of personally identifiable information may also be made where necessary for the establishment, exercise, or defense of legal claims.
Although we take appropriate measures to safeguard against unauthorized disclosures of information, we cannot assure you that personally identifiable information that we collect will never be disclosed in a manner that is inconsistent with this Privacy Notice. Inadvertent disclosures may result, for example, when third parties misrepresent their identities in asking the site for access to personally identifiable information about themselves for purposes of correcting possible factual errors in the data.
Privacy Options
If a Tennis Media Co LLC site discloses personally identifiable information to companies not owned by Tennis Media Co LLC who want to market products or services to you, it will provide you with an opportunity to opt out or block such uses. If you prefer not to receive online marketing information from companies not owned by Tennis Media Co LLC, please click here.
Tennis Media Co LLC may on occasion combine information we receive online with outside records to enhance our ability to market to you those products or services that may be of interest to you.
Tennis Media Co LLC sites will not use or transfer personally identifiable information provided to us in ways unrelated to the ones described above without also providing you with an opportunity to opt out of these unrelated uses.
Collection of Information by Third-Party Sites and Sponsors
Some of our sites contain links to other sites whose information practices may be different than ours. You should consult the other sites' privacy notices, as we have no control over information that is submitted to, or collected by, these third parties.
Tennis Media Co LLC sites sometimes may offer contests, sweepstakes, or promotions that are sponsored by or co-sponsored with identified third parties. By virtue of their sponsorship, these third parties may obtain personally identifiable information that visitors voluntarily submit to participate in the contest, sweepstakes, or promotion. Tennis Media Co LLC has no control over the third-party sponsors' use of this information. Tennis Media Co LLC site will notify you at the time of requesting personally identifiable information if third-party sponsors will obtain such information.
Tennis Media Co LLC sites may use reputable third parties to present or serve the advertisements that you may see at its web pages and to conduct research about the advertisements. This privacy notice does not cover any use of information that such third parties may have collected from you or the methods used by the third-parties to collect that information (e.g., cookies, web beacons and clear gifs).
Cookies
To enhance your experience with our sites, many of our web pages use "cookies." Cookies are text files we place in your computer's browser to store your preferences. Cookies, by themselves, do not tell us your e-mail address or other personally identifiable information unless you choose to provide this information to us by, for example, registering at one of our sites. However, once you choose to furnish the site with personally identifiable information, this information may be linked to the data stored in the cookie.
We use cookies to understand site usage and to improve the content and offerings on our sites. For example, we may use cookies to personalize your experience at our web pages (e.g. to recognize you by name when you return to our site), save your password in password-protected areas, and enable you to use shopping carts on our sites. We also may use cookies to offer you products, programs, or services.
We may also use small pieces of code called "web beacons" or "clear gifs" to collect anonymous and aggregate advertising metrics, such as counting page views, promotion views, or advertising responses. These "web beacons" may be used to deliver cookies that conform to our cookie policy.
Our Commitment to Security
We have put in place appropriate physical, electronic, and managerial procedures to safeguard and help prevent unauthorized access, maintain data security, and correctly use the information we collect.
How You can Access or Correct Information
To inquire about personally identifiable information that this Tennis Media Co LLC site has collected about you, or how to correct factual errors in such information, please email us by clicking here.
To protect your privacy and security, we will take reasonable steps to help verify your identity before granting access or making corrections.
Special Note for Parents
The site you are visiting is one of the Tennis Media Co LLC general audience sites.
Changes to this Notice
This Notice may be changed by Tennis Media Co LLC. The revised Notice will be posted to this page so that you are aware of the information we collect, how we use it, and under what circumstances we may disclose it.
How to Contact Us
If you have any questions or concerns about the Tennis Media Co LLC Privacy Notice or its implementation please contact us via email by clicking here or at the following address:
814 South Westgate
Suite 100
Los Angeles, CA 90049
General Phone Number:<PHONE_NUMBER>
http://www.tennis.com


Database: Migrations
Introduction
Migrations are like version control for your database, allowing your team to define and share the application's database schema definition. If you have ever had to tell a teammate to manually add a column to their local database schema after pulling in your changes from source control, you've faced the problem that database migrations solve.
The Laravel Schema
facade provides database agnostic support for creating and manipulating tables across all of Laravel's supported database systems. Typically, migrations will use this facade to create and modify database tables and columns.
Generating Migrations
You may use the make:migration
Artisan command to generate a database migration. The new migration will be placed in your database/migrations
directory. Each migration filename contains a timestamp that allows Laravel to determine the order of the migrations:
php artisan make:migration create_flights_table
The --table
and --create
options may be used to indicate the name of the table and whether or not the migration will be creating a new table. These options pre-fill the generated migration file with the specified table:
php artisan make:migration create_flights_table --create=flights
php artisan make:migration add_destination_to_flights_table --table=flights
If you would like to specify a custom path for the generated migration, you may use the --path
option when executing the make:migration
command. The given path should be relative to your application's base path.
{tip} Migration stubs may be customized using stub publishing
Squashing Migrations
As you build your application, you may accumulate more and more migrations over time. This can lead to your database/migrations
directory becoming bloated with potentially hundreds of migrations. If you would like, you may "squash" your migrations into a single SQL file. To get started, execute the schema:dump
command:
php artisan schema:dump
// Dump the current database schema and prune all existing migrations...
php artisan schema:dump --prune
When you execute this command, Laravel will write a "schema" file to your application's database/schema
directory. Now, when you attempt to migrate your database and no other migrations have been executed, Laravel will execute the schema file's SQL statements first. After executing the schema file's statements, Laravel will execute any remaining migrations that were not part of the schema dump.
You should commit your database schema file to source control so that other new developers on your team may quickly create your application's initial database structure.
{note} Migration squashing is only available for the MySQL, PostgreSQL, and SQLite databases and utilizes the database's command-line client. Schema dumps may not be restored to in-memory SQLite databases.
Migration Structure
A migration class contains two methods: up
and down
. The up
method is used to add new tables, columns, or indexes to your database, while the down
method should reverse the operations performed by the up
method.
Within both of these methods you may use the Laravel schema builder to expressively create and modify tables. To learn about all of the methods available on the Schema
builder, check out its documentation. For example, the following migration creates a flights
table:
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFlightsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('flights', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('airline');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('flights');
}
}
Running Migrations
To run all of your outstanding migrations, execute the migrate
Artisan command:
php artisan migrate
Forcing Migrations To Run In Production
Some migration operations are destructive, which means they may cause you to lose data. In order to protect you from running these commands against your production database, you will be prompted for confirmation before the commands are executed. To force the commands to run without a prompt, use the --force
flag:
php artisan migrate --force
Rolling Back Migrations
To roll back the latest migration operation, you may use the rollback
Artisan command. This command rolls back the last "batch" of migrations, which may include multiple migration files:
php artisan migrate:rollback
You may roll back a limited number of migrations by providing the step
option to the rollback
command. For example, the following command will roll back the last five migrations:
php artisan migrate:rollback --step=5
The migrate:reset
command will roll back all of your application's migrations:
php artisan migrate:reset
Roll Back & Migrate Using A Single Command
The migrate:refresh
command will roll back all of your migrations and then execute the migrate
command. This command effectively re-creates your entire database:
php artisan migrate:refresh
// Refresh the database and run all database seeds...
php artisan migrate:refresh --seed
You may roll back and re-migrate a limited number of migrations by providing the step
option to the refresh
command. For example, the following command will roll back and re-migrate the last five migrations:
php artisan migrate:refresh --step=5
Drop All Tables & Migrate
The migrate:fresh
command will drop all tables from the database and then execute the migrate
command:
php artisan migrate:fresh
php artisan migrate:fresh --seed
{note} The
migrate:fresh
command will drop all database tables regardless of their prefix. This command should be used with caution when developing on a database that is shared with other applications.
Tables
Creating Tables
To create a new database table, use the create
method on the Schema
facade. The create
method accepts two arguments: the first is the name of the table, while the second is a closure which receives a Blueprint
object that may be used to define the new table:
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email');
$table->timestamps();
});
When creating the table, you may use any of the schema builder's column methods to define the table's columns.
Checking For Table / Column Existence
You may check for the existence of a table or column using the hasTable
and hasColumn
methods:
if (Schema::hasTable('users')) {
// The "users" table exists...
}
if (Schema::hasColumn('users', 'email')) {
// The "users" table exists and has an "email" column...
}
Database Connection & Table Options
If you want to perform a schema operation on a database connection that is not your application's default connection, use the connection
method:
Schema::connection('sqlite')->create('users', function (Blueprint $table) {
$table->id();
});
In addition, a few other properties and methods may be used to define other aspects of the table's creation. The engine
property may be used to specify the table's storage engine when using MySQL:
Schema::create('users', function (Blueprint $table) {
$table->engine = 'InnoDB';
// ...
});
The charset
and collation
properties may be used to specify the character set and collation for the created table when using MySQL:
Schema::create('users', function (Blueprint $table) {
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_unicode_ci';
// ...
});
The temporary
method may be used to indicate that the table should be "temporary". Temporary tables are only visible to the current connection's database session and are dropped automatically when the connection is closed:
Schema::create('calculations', function (Blueprint $table) {
$table->temporary();
// ...
});
Updating Tables
The table
method on the Schema
facade may be used to update existing tables. Like the create
method, the table
method accepts two arguments: the name of the table and a closure that receives a Blueprint
instance you may use to add columns or indexes to the table:
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
Schema::table('users', function (Blueprint $table) {
$table->integer('votes');
});
Renaming / Dropping Tables
To rename an existing database table, use the rename
method:
use Illuminate\Support\Facades\Schema;
Schema::rename($from, $to);
To drop an existing table, you may use the drop
or dropIfExists
methods:
Schema::drop('users');
Schema::dropIfExists('users');
Renaming Tables With Foreign Keys
Before renaming a table, you should verify that any foreign key constraints on the table have an explicit name in your migration files instead of letting Laravel assign a convention based name. Otherwise, the foreign key constraint name will refer to the old table name.
Columns
Creating Columns
The table
method on the Schema
facade may be used to update existing tables. Like the create
method, the table
method accepts two arguments: the name of the table and a closure that receives an Illuminate\Database\Schema\Blueprint
instance you may use to add columns to the table:
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
Schema::table('users', function (Blueprint $table) {
$table->integer('votes');
});
Available Column Types
The schema builder blueprint offers a variety of methods that correspond to the different types of columns you can add to your database tables. Each of the available methods are listed in the table below:
bigIncrements bigInteger binary boolean char dateTimeTz dateTime date decimal double enum float foreignId geometryCollection geometry id increments integer ipAddress json jsonb lineString longText macAddress mediumIncrements mediumInteger mediumText morphs multiLineString multiPoint multiPolygon nullableMorphs nullableTimestamps nullableUuidMorphs point polygon rememberToken set smallIncrements smallInteger softDeletesTz softDeletes string text timeTz time timestampTz timestamp timestampsTz timestamps tinyIncrements tinyInteger unsignedBigInteger unsignedDecimal unsignedInteger unsignedMediumInteger unsignedSmallInteger unsignedTinyInteger uuidMorphs uuid year
bigIncrements()
The bigIncrements
method creates an auto-incrementing UNSIGNED BIGINT
(primary key) equivalent column:
$table->bigIncrements('id');
bigInteger()
The bigInteger
method creates a BIGINT
equivalent column:
$table->bigInteger('votes');
binary()
The binary
method creates a BLOB
equivalent column:
$table->binary('photo');
boolean()
The boolean
method creates a BOOLEAN
equivalent column:
$table->boolean('confirmed');
char()
The char
method creates a CHAR
equivalent column with of a given length:
$table->char('name', 100);
dateTimeTz()
The dateTimeTz
method creates a DATETIME
(with timezone) equivalent column with an optional precision (total digits):
$table->dateTimeTz('created_at', $precision = 0);
dateTime()
The dateTime
method creates a DATETIME
equivalent column with an optional precision (total digits):
$table->dateTime('created_at', $precision = 0);
date()
The date
method creates a DATE
equivalent column:
$table->date('created_at');
decimal()
The decimal
method creates a DECIMAL
equivalent column with the given precision (total digits) and scale (decimal digits):
$table->decimal('amount', $precision = 8, $scale = 2);
double()
The double
method creates a DOUBLE
equivalent column with the given precision (total digits) and scale (decimal digits):
$table->double('amount', 8, 2);
enum()
The enum
method creates a ENUM
equivalent column with the given valid values:
$table->enum('difficulty', ['easy', 'hard']);
float()
The float
method creates a FLOAT
equivalent column with the given precision (total digits) and scale (decimal digits):
$table->float('amount', 8, 2);
foreignId()
The foreignId
method is an alias of the unsignedBigInteger
method:
$table->foreignId('user_id');
geometryCollection()
The geometryCollection
method creates a GEOMETRYCOLLECTION
equivalent column:
$table->geometryCollection('positions');
geometry()
The geometry
method creates a GEOMETRY
equivalent column:
$table->geometry('positions');
id()
The id
method is an alias of the bigIncrements
method. By default, the method will create an id
column; however, you may pass a column name if you would like to assign a different name to the column:
$table->id();
increments()
The increments
method creates an auto-incrementing UNSIGNED INTEGER
equivalent column as a primary key:
$table->increments('id');
integer()
The integer
method creates an INTEGER
equivalent column:
$table->integer('votes');
ipAddress()
The ipAddress
method creates an INTEGER
equivalent column:
$table->ipAddress('visitor');
json()
The json
method creates an JSON
equivalent column:
$table->json('options');
jsonb()
The jsonb
method creates an JSONB
equivalent column:
$table->jsonb('options');
lineString()
The lineString
method creates an LINESTRING
equivalent column:
$table->lineString('positions');
longText()
The longText
method creates an LONGTEXT
equivalent column:
$table->longText('description');
macAddress()
The macAddress
method creates a column that is intended to hold a MAC address. Some database systems, such as PostgreSQL, have a dedicated column type for this type of data. Other database systems will use a string equivalent column:
$table->macAddress('device');
mediumIncrements()
The mediumIncrements
method creates an auto-incrementing UNSIGNED MEDIUMINT
equivalent column as a primary key:
$table->mediumIncrements('id');
mediumInteger()
The mediumInteger
method creates an MEDIUMINT
equivalent column:
$table->mediumInteger('votes');
mediumText()
The mediumText
method creates an MEDIUMTEXT
equivalent column:
$table->mediumText('description');
morphs()
The morphs
method is a convenience method that adds a {column}_id
UNSIGNED BIGINT
equivalent column and a {column}_type
VARCHAR
equivalent column.
This method is intended to be used when defining the columns necessary for a polymorphic Eloquent relationship. In the following example, taggable_id
and taggable_type
columns would be created:
$table->morphs('taggable');
multiLineString()
The multiLineString
method creates an MULTILINESTRING
equivalent column:
$table->multiLineString('positions');
multiPoint()
The multiPoint
method creates an MULTIPOINT
equivalent column:
$table->multiPoint('positions');
multiPolygon()
The multiPolygon
method creates an MULTIPOLYGON
equivalent column:
$table->multiPolygon('positions');
nullableTimestamps()
The method is similar to the timestamps method; however, the column that is created will be "nullable":
$table->nullableTimestamps(0);
nullableMorphs()
The method is similar to the morphs method; however, the columns that are created will be "nullable":
$table->nullableMorphs('taggable');
nullableUuidMorphs()
The method is similar to the uuidMorphs method; however, the columns that are created will be "nullable":
$table->nullableUuidMorphs('taggable');
point()
The point
method creates an POINT
equivalent column:
$table->point('position');
polygon()
The polygon
method creates an POLYGON
equivalent column:
$table->polygon('position');
rememberToken()
The rememberToken
method creates a nullable, VARCHAR(100)
equivalent column that is intended to store the current "remember me" authentication token:
$table->rememberToken();
set()
The set
method creates an SET
equivalent column with the given list of valid values:
$table->set('flavors', ['strawberry', 'vanilla']);
smallIncrements()
The smallIncrements
method creates an auto-incrementing UNSIGNED SMALLINT
equivalent column as a primary key:
$table->smallIncrements('id');
smallInteger()
The smallInteger
method creates an SMALLINT
equivalent column:
$table->smallInteger('votes');
softDeletesTz()
The softDeletesTz
method adds a nullable deleted_at
TIMESTAMP
(with timezone) equivalent column with an optional precision (total digits). This column is intended to store the deleted_at
timestamp needed for Eloquent's "soft delete" functionality:
$table->softDeletesTz($column = 'deleted_at', $precision = 0);
softDeletes()
The softDeletes
method adds a nullable deleted_at
TIMESTAMP
equivalent column with an optional precision (total digits). This column is intended to store the deleted_at
timestamp needed for Eloquent's "soft delete" functionality:
$table->softDeletes($column = 'deleted_at', $precision = 0);
string()
The string
method creates an VARCHAR
equivalent column of the given length:
$table->string('name', 100);
text()
The text
method creates an TEXT
equivalent column:
$table->text('description');
timeTz()
The timeTz
method creates an TIME
(with timezone) equivalent column with an optional precision (total digits):
$table->timeTz('sunrise', $precision = 0);
time()
The time
method creates an TIME
equivalent column with an optional precision (total digits):
$table->time('sunrise', $precision = 0);
timestampTz()
The timestampTz
method creates an TIMESTAMP
(with timezone) equivalent column with an optional precision (total digits):
$table->timestampTz('added_at', $precision = 0);
timestamp()
The timestamp
method creates an TIMESTAMP
equivalent column with an optional precision (total digits):
$table->timestamp('added_at', $precision = 0);
timestampsTz()
The timestampsTz
method creates created_at
and updated_at
TIMESTAMP
(with timezone) equivalent columns with an optional precision (total digits):
$table->timestampsTz($precision = 0);
timestamps()
The timestamps
method creates created_at
and updated_at
TIMESTAMP
equivalent columns with an optional precision (total digits):
$table->timestamps($precision = 0);
tinyIncrements()
The tinyIncrements
method creates an auto-incrementing UNSIGNED TINYINT
equivalent column as a primary key:
$table->tinyIncrements('id');
tinyInteger()
The tinyInteger
method creates an TINYINT
equivalent column:
$table->tinyInteger('votes');
unsignedBigInteger()
The unsignedBigInteger
method creates an UNSIGNED BIGINT
equivalent column:
$table->unsignedBigInteger('votes');
unsignedDecimal()
The unsignedDecimal
method creates an UNSIGNED DECIMAL
equivalent column with an optinoal precision (total digits) and scale (decimal digits):
$table->unsignedDecimal('amount', $precision = 8, $scale = 2);
unsignedInteger()
The unsignedInteger
method creates an UNSIGNED INTEGER
equivalent column:
$table->unsignedInteger('votes');
unsignedMediumInteger()
The unsignedMediumInteger
method creates an UNSIGNED MEDIUMINT
equivalent column:
$table->unsignedMediumInteger('votes');
unsignedSmallInteger()
The unsignedSmallInteger
method creates an UNSIGNED SMALLINT
equivalent column:
$table->unsignedSmallInteger('votes');
unsignedTinyInteger()
The unsignedTinyInteger
method creates an UNSIGNED TINYINT
equivalent column:
$table->unsignedTinyInteger('votes');
uuidMorphs()
The uuidMorphs
method is a convenience method that adds a {column}_id
CHAR(36)
equivalent column and a {column}_type
VARCHAR
equivalent column.
This method is intended to be used when defining the columns necessary for a polymorphic Eloquent relationship that use UUID identifiers. In the following example, taggable_id
and taggable_type
columns would be created:
$table->uuidMorphs('taggable');
uuid()
The uuid
method creates an UUID
equivalent column:
$table->uuid('id');
year()
The year
method creates an YEAR
equivalent column:
$table->year('birth_year');
Column Modifiers
In addition to the column types listed above, there are several column "modifiers" you may use when adding a column to a database table. For example, to make the column "nullable", you may use the nullable
method:
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
Schema::table('users', function (Blueprint $table) {
$table->string('email')->nullable();
});
The following table contains all of the available column modifiers. This list does not include index modifiers:
| Modifier | Description |
|---|---|
->after('column') |
Place the column "after" another column (MySQL). |
->autoIncrement() |
Set INTEGER columns as auto-incrementing (primary key). |
->charset('utf8mb4') |
Specify a character set for the column (MySQL). |
->collation('utf8mb4_unicode_ci') |
Specify a collation for the column (MySQL/PostgreSQL/SQL Server). |
->comment('my comment') |
Add a comment to a column (MySQL/PostgreSQL). |
->default($value) |
Specify a "default" value for the column. |
->first() |
Place the column "first" in the table (MySQL). |
->from($integer) |
Set the starting value of an auto-incrementing field (MySQL / PostgreSQL). |
->nullable($value = true) |
Allow NULL values to be inserted into the column. |
->storedAs($expression) |
Create a stored generated column (MySQL). |
->unsigned() |
Set INTEGER columns as UNSIGNED (MySQL). |
->useCurrent() |
Set TIMESTAMP columns to use CURRENT_TIMESTAMP as default value. |
->useCurrentOnUpdate() |
Set TIMESTAMP columns to use CURRENT_TIMESTAMP when a record is updated. |
->virtualAs($expression) |
Create a virtual generated column (MySQL). |
->generatedAs($expression) |
Create an identity column with specified sequence options (PostgreSQL). |
->always() |
Defines the precedence of sequence values over input for an identity column (PostgreSQL). |
Default Expressions
The default
modifier accepts a value or an Illuminate\Database\Query\Expression
instance. Using an Expression
instance will prevent Laravel from wrapping the value in quotes and allow you to use database specific functions. One situation where this is particularly useful is when you need to assign default values to JSON columns:
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Migrations\Migration;
class CreateFlightsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('flights', function (Blueprint $table) {
$table->id();
$table->json('movies')->default(new Expression('(JSON_ARRAY())'));
$table->timestamps();
});
}
}
{note} Support for default expressions depends on your database driver, database version, and the field type. Please refer to your database's documentation.
Modifying Columns
Prerequisites
Before modifying a column, you must install the doctrine/dbal
package using the Composer package manager. The Doctrine DBAL library is used to determine the current state of the column and to create the SQL queries needed to make the requested changes to your column:
composer require doctrine/dbal
If you plan to modify columns created using the timestamp
method, you must also add the following configuration to your application's config/database.php
configuration file:
use Illuminate\Database\DBAL\TimestampType;
'dbal' => [
'types' => [
'timestamp' => TimestampType::class,
],
],
Updating Column Attributes
The change
method allows you to modify the type and attributes of existing columns. For example, you may wish to increase the size of a string
column. To see the change
method in action, let's increase the size of the name
column from 25 to 50. To accomplish this, we simply define the new state of the column and then call the change
method:
Schema::table('users', function (Blueprint $table) {
$table->string('name', 50)->change();
});
We could also modify a column to be nullable:
Schema::table('users', function (Blueprint $table) {
$table->string('name', 50)->nullable()->change();
});
{note} The following column types can be modified:
bigInteger
,binary
,boolean
,date
,dateTime
,dateTimeTz
,decimal
,integer
,json
,longText
,mediumText
,smallInteger
,string
,text
,time
,unsignedBigInteger
,unsignedInteger
,unsignedSmallInteger
, anduuid
. To modify atimestamp
column type a Doctrine type must be registered.
Renaming Columns
To rename a column, you may use the renameColumn
method provided by the schema builder blueprint. Before renaming a column, ensure that you have installed the doctrine/dbal
library via the Composer package manager:
Schema::table('users', function (Blueprint $table) {
$table->renameColumn('from', 'to');
});
{note} Renaming an
enum
column is not currently supported.
Dropping Columns
To drop a column, you may use the dropColumn
method on the schema builder blueprint. If your application is utilizing an SQLite database, you must install the doctrine/dbal
package via the Composer package manager before the dropColumn
method may be used:
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('votes');
});
You may drop multiple columns from a table by passing an array of column names to the dropColumn
method:
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(['votes', 'avatar', 'location']);
});
{note} Dropping or modifying multiple columns within a single migration while using a SQLite database is not supported.
Available Command Aliases
Laravel provides several convenient methods related to dropping common types of columns. Each of these methods is described in the table below:
| Command | Description |
|---|---|
$table->dropMorphs('morphable'); |
Drop the morphable_id and morphable_type columns. |
$table->dropRememberToken(); |
Drop the remember_token column. |
$table->dropSoftDeletes(); |
Drop the deleted_at column. |
$table->dropSoftDeletesTz(); |
Alias of dropSoftDeletes() method. |
$table->dropTimestamps(); |
Drop the created_at and updated_at columns. |
$table->dropTimestampsTz(); |
Alias of dropTimestamps() method. |
Indexes
Creating Indexes
The Laravel schema builder supports several types of indexes. The following example creates a new email
column and specifies that its values should be unique. To create the index, we can chain the unique
method onto the column definition:
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
Schema::table('users', function (Blueprint $table) {
$table->string('email')->unique();
});
Alternatively, you may create the index after defining the column. To do so, you should call the unique
method on the schema builder blueprint. This methods accepts the name of the column that should receive a unique index:
$table->unique('email');
You may even pass an array of columns to an index method to create a compound (or composite) index:
$table->index(['account_id', 'created_at']);
When creating an index, Laravel will automatically generate an index name based on the table, column names, and the index type, but you may pass a second argument to the method to specify the index name yourself:
$table->unique('email', 'unique_email');
Available Index Types
Laravel's schema builder blueprint class provides methods for creating each type of index supported by Laravel. Each index method accepts an optional second argument to specify the name of the index. If omitted, the name will be derived from the names of the table and column(s) used for the index, as well as the index type. Each of the available index methods are described in the table below:
| Command | Description |
|---|---|
$table->primary('id'); |
Adds a primary key. |
$table->primary(['id', 'parent_id']); |
Adds composite keys. |
$table->unique('email'); |
Adds a unique index. |
$table->index('state'); |
Adds an index. |
$table->spatialIndex('location'); |
Adds a spatial index (except SQLite). |
Index Lengths & MySQL / MariaDB
By default, Laravel uses the utf8mb4
character set. If you are running a version of MySQL older than the 5.7.7 release or MariaDB older than the 10.2.2 release, you may need to manually configure the default string length generated by migrations in order for MySQL to create indexes for them. You may configure the default string length by calling the Schema::defaultStringLength
method within the boot
method of your App\Providers\AppServiceProvider
class:
use Illuminate\Support\Facades\Schema;
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Schema::defaultStringLength(191);
}
Alternatively, you may enable the innodb_large_prefix
option for your database. Refer to your database's documentation for instructions on how to properly enable this option.
Renaming Indexes
To rename an index, you may use the renameIndex
method provided by the schema builder blueprint. This method accepts the current index name as its first argument and the desired name as its second argument:
$table->renameIndex('from', 'to')
Dropping Indexes
To drop an index, you must specify the index's name. By default, Laravel automatically assigns an index name based on the table name, the name of the indexed column, and the index type. Here are some examples:
| Command | Description |
|---|---|
$table->dropPrimary('users_id_primary'); |
Drop a primary key from the "users" table. |
$table->dropUnique('users_email_unique'); |
Drop a unique index from the "users" table. |
$table->dropIndex('geo_state_index'); |
Drop a basic index from the "geo" table. |
$table->dropSpatialIndex('geo_location_spatialindex'); |
Drop a spatial index from the "geo" table (except SQLite). |
If you pass an array of columns into a method that drops indexes, the conventional index name will be generated based on the table name, columns, and index type:
Schema::table('geo', function (Blueprint $table) {
$table->dropIndex(['state']); // Drops index 'geo_state_index'
});
Foreign Key Constraints
Laravel also provides support for creating foreign key constraints, which are used to force referential integrity at the database level. For example, let's define a user_id
column on the posts
table that references the id
column on a users
table:
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
Schema::table('posts', function (Blueprint $table) {
$table->unsignedBigInteger('user_id');
$table->foreign('user_id')->references('id')->on('users');
});
Since this syntax is rather verbose, Laravel provides additional, terser methods that use conventions to provide a better developer experience. The example above can be rewritten like so:
Schema::table('posts', function (Blueprint $table) {
$table->foreignId('user_id')->constrained();
});
The foreignId
method is an alias for unsignedBigInteger
while the constrained
method will use conventions to determine the table and column name being referenced. If your table name does not match Laravel's conventions, you may specify the table name by passing it as an argument to the constrained
method:
Schema::table('posts', function (Blueprint $table) {
$table->foreignId('user_id')->constrained('users');
});
You may also specify the desired action for the "on delete" and "on update" properties of the constraint:
$table->foreignId('user_id')
->constrained()
->onUpdate('cascade')
->onDelete('cascade');
Any additional column modifiers must be called before the constrained
method:
$table->foreignId('user_id')
->nullable()
->constrained();
Dropping Foreign Keys
To drop a foreign key, you may use the dropForeign
method, passing the name of the foreign key constraint to be deleted as an argument. Foreign key constraints use the same naming convention as indexes. In other words, the foreign key constraint name is based on the name of the table and the columns in the constraint, followed by a "_foreign" suffix:
$table->dropForeign('posts_user_id_foreign');
Alternatively, you may pass an array containing the column name that holds the foreign key to the dropForeign
method. The array will be converted to a foreign key constraint name using Laravel's constraint naming conventions:
$table->dropForeign(['user_id']);
Toggling Foreign Key Constraints
You may enable or disable foreign key constraints within your migrations by using the following methods:
Schema::enableForeignKeyConstraints();
Schema::disableForeignKeyConstraints();
{note} SQLite disables foreign key constraints by default. When using SQLite, make sure to enable foreign key support in your database configuration before attempting to create them in your migrations. In addition, SQLite only supports foreign keys upon creation of the table and not when tables are altered.


{% extends "frontend/base.html" %}
{% block title %}
Station commodities list
{% endblock %}
{% block list %}
Station Commodity list
{% if data %}
{% include 'frontend/list_nav.html' %}
{% include 'frontend/station_commodity/thead.html' %}
{% for commodity in data.results %}
{% include "frontend/station_commodity/row.html" with data=commodity only %}
{% endfor %}


This is a paragraph. I am styled by a class called "intro"
I am enclosed within a
div
tag. And I can be styled on a document level.
This is an ordered list and it is centered
apple
orange
banana
This is an unordered list.
apple
orange
banana
I am a link that is styled by a class
I am enclosed within a
div
tag. And I am styled on a local level.
This is an ordered list and it is centered
apple
orange
banana
This is an unordered list and I have a class defined
apple
orange
banana
I am a link that is styled by a class


The default action choosen when a new file is added can be changed or reset, in this case, the default action will be prompt for the next time you will add a file.
For linked items (items that remains at their original place), the complete path can be shown on linked items' cells.
The library, where all items are placed, is located by default into the
~/Document folder. The location can be changed by clicking on the button and select
Choose....
You can reset hidden alerts when you've clicked "Do not show this message again".


28 DAYS A film review by Christopher Null Copyright 2000 filmcritic.com filmcritic.com
Everyone knows that writers are drunks. I mean, I'm drunk right now. I'm surprised I can type, you know, since my hands are shaking so bad and my vision is so blurry.
If you're ready to buy in to the writer-as-alcoholic cliché, you should just love 28 Days, which pulls out every stereotype in the book. Sandra Bullock stars as Gwen, the aforementioned drunk writer (living, naturally, in New York City), who ruins her sister's wedding by insulting her during the toast, falling on the cake, and wrecking the "just married" car by crashing it into a house! Off to rehab for her, where she meets a cast of characters drawn so broadly they could populate a sitcom on UPN.
Those also trying to sober up include heroin addict Andrea (TV's Azura Skye), sex fiend Oliver (TV's Michael O'Malley), and drunk ex-doctor Daniel (TV's Reni Santoni).
Gwen and co. are put through their 12 steps in short order, hugging, chanting, cleaning, climbing, singing, taking classes, and bonding with one another over this horrible, horrible disease they all must learn to deal with. See Gwen try to charm a horse. See Gwen's sister (Elizabeth Perkins) confront her. See Gwen sob over mother (also an alky), who died when she was a kid, safely laying the blame off on someone else. See audience roll eyes. Wow, these 28 days really only feel like 19!
The whole movie walks a tightrope between farce and melodrama, but falls liberally into both. In fact, the only saving graces of the film come from the caricatures of supporting characters: Steve Buscemi as Gwen's fallen angel counselor; Alan Tudyk stealing the show as a flamboyantly gay, vaguely Teutonic basket case.
Regular readers of filmcritic.com will know that I've never been a fan of Miss Bullock's work (see also The Net), and her "Golly, I hope I get an Oscar" performance here doesn't do much to change my opinion. Director Betty Thomas (The Brady Bunch Movie) is also completely out of her element. She even shot six episodes of the faux soap opera "Santa Cruz" featured as a running gag in the film -- time that might have been better spent teaching Sandra how to do drama.
But what am I saying? I'm just a drunk writer whose only worry is where his next martini is coming from. Don't listen to me. Hey, bartender!
RATING: **
|------------------------------| \ ***** Perfection \ \ **** Good, memorable film \ \ *** Average, hits and misses \ \ ** Sub-par on many levels \ \ * Unquestionably awful \ |------------------------------|
MPAA Rating: PG-13
Director: Betty Thomas Producer: Jenno Topping Writer: Susannah Grant Starring: Sandra Bullock, Viggo Mortensen, Dominic West, Diane Ladd, Elizabeth Perkins, Steve Buscemi, Azura Skye, Alan Tudyk, Michael O'Malley
http://www.soapcity.com/28days// --- Christopher Null -<EMAIL_ADDRESS>- http://www.filmcritic.com
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Hello all
- I am Dunia Al Kilani ;
- I studied Electrical engineering at the Hashemite University
- Immediately after my graduation, I was employed as sales and technical Engineer at Tal Group.
- To be honest, I did not find myself in the field of electrical engineering much, so I decided to start learning programming.
- I think it is the language of the age and the most important science now.
- I aspire to develop myself a lot in the field of programming, and get a job in this field. Wish me luck !
TOP TEN FAVOURITE FOOTBALL PLAYERS :
- Cristiano Ronaldo
- Sergio Ramos
- Luka Modric
- Kylian Mbappé
- Marcelo
- Benzema
- Federico Valverde
- Toni Kroos
- Daniel Carvajal
- Casemero


{% extends "layout.html" %} {% block content %}
Post photo's and stories to share with friends and family.
New Post


Meeting on Discord (1230PM, 22/04/2020)
1230PM - Agenda Today. (1 Hour 7 Minutes)
- Further discuss about more our functionalities
- Is a forum required?
- Which methodology would we be using?
- The platform we intend to publish on
1237PM - We welcome out new team member and brief him on our progress and ask him if he had any functions he plans to add on. We further discuss the requirements of the application.
- We discuss whether a forum is needed or not on our platform. And decided to continue with an in-app messaging system.
- The platform should be accessible from both phone and computer.
- - The objective of the application is to allow people who need to share a car ride to the university and to allow drivers and passengers to easily find one another by coordinating their pickup and travel time.
- - Driver propose the pickup with passenger. Similar to Grab.
- - There was a need to implement a messaging system into the platform instead of getting the contact of another party.
1250PM - Reviewing out list of functionalities
Only people and the staff of SIM can register - How can we verify that? During the registration phase, Student number and SIM ID/Staff ID have to be used to verify that they are a student.
“Book now” Function
For Auto app ride confirmation, does our app auto match driver and passenger?
Passengers do not get to pick their drivers.
If a passenger were to send in their timing, The driver will be the one accepting. (A proximity check to passengers)
In order to do live tracking, passengers and drivers need to allow their location to be tracked by the application.
Hitch Function - Passenger and Driver would need to communicate with each other; thus we need to publish our available or scheduled timing.
Fast return booking trip - When the ride ends, we will have a pop-up option for both driver and passenger to book a return trip. “Do you want to book a return trip?” This message would pop up once the initial trip ends.
Number of passengers - We need to allow more than one passenger and as long as the account holder is an SIM staff or student, friends and affiliates of the account holder can pool together.
Before booking/confirming a ride (Ride confirmation) - Will there be a popup option for subsequent passengers to inform him/her that they would be sharing with another passenger going the same way? A reminder or notification would notify the subsequent passenger would like to cancel or not if they were to be sharing.
Different payment methods (Credit card KIV) - Pay through app or allow them to settle themselves. If we are going to store the card information, we can process the payment on our side. Or use PayNow/PayLah/Cash. We decided not to do an in-app wallet, and we settled on personal payment between the passenger and driver.
Storing Card Information (KIV) - Since we intend to do Cash/PayLah/PayNow, we do not need to pay via card.
Encryption for sensitive information - We need this function to protect the user.
Account management - Ride History (Price, Distance, Location and the Driver) – Passenger
Pet/Baby ok? - This would be hard to implement; driver and passengers can message themselves for other arrangements if required.
Point System - A reward system to be implemented to encourage and reward customers who uses the application frequently.
Favourite Location - Auto-complete their location from destination or pickup point (School/home).
Pick up/drop off point pin & Additional Stops - We decide not to allow passengers to get additional stops as it would be inconvenient for the driver, passengers only get to choose one location.
Notification system & Driver can accept and reject - Passengers can only cancel or accept rides.
Ratings (smiley or sad face) - We decided not to have a comment or review box. However, a report button would be a faster and more straightforward method if there were to have any complaints.
Profile for both passenger and driver - Should we show their name, school and their course? (This would be a breach of privacy and show too much information). Thus, we decided to only show their name and face on their profile. Registration would require you to take a selfie or picture of yourself.
Status of scheduled trip - This would be needed to check if the ride is confirmed or still pending (searching for a driver).
Trip cancellation/Cancellation Fees (KIV) & Customer Support - If there were to be any emergencies, there would be an in-app button to just call 999. If this system is implemented, we will hire someone to do customer support during office hour timing.
1321PM – What methodology will we be using?
Agile or Waterfall? We discussed that the Waterfall method is rigid and Agile would better, because it is flexible and allows us to adapt to situation if there were to be any changes, we can go ahead and use Taiga to create our user stories and planning as well.
1324PM – The platform we intend to publish on
We need to do 3 different apps (Apple, Android and Computer) based on the project requirement that the application must be on available on both Computer and Mobile phones. These are 3 different platforms, how are we going to display our data and functions?
1326PM – Languages/softwares used
Who will be doing the data base? Something we will have to plan and discuss later on. Anthony will be doing front-end of the application.
- Web App: Python – Flask
- Apple Android App: React, Node JS
- Database: MongoDB
- Agile/user stories: Taiga.io
Questions:
The pricing, the purpose of carpool – is environment > money making? (Business model portion)
Website has lesser things to worry about, what happens if we have a lot of data (the integration between all 3 platforms)? – Platform we intend to publish on.
Project Requirement Documentation – 2nd May
We are required to submit our week 3 weekly reflection to our supervisor by this week.


Is Your Research Software Correct?
I'm Mike Smith! But this is an abridged talk written by Mike Croucher.
www.walkingrandomly.com
Imagine...
Your results are amazing!
but wrong
This 2003 trial, done in Kenya, found that deworming whole schools improved children’s health, school performance, and school attendance.
In 2013, the data was reanalysed independently using new computer programs
Many mistakes found.
We have a problem!

What you did
Open package foo. Click, Click, drag, Click, Click, Click, Right-Click, Save, 'results.csv'.
Load into Excel. Click, drag, generate graph, right click, save, 'pretty-graph.png'
Your Analysis?
What you said
I analysed my data in foo using the bar analysis. Here's a graph of the results.
How reproducible is a mouse click?
Automate
aka 'learn to program'
You are already ahead of most researchers!

- Computer time is cheap. Programmer time is expensive.
- Ensure it's correct, then worry about speed.
 In: Proceedings Second International Workshop on Software Engineering for Computational Science and Engineering. pp. 1–8. doi:10.1109/SECSE.2009.5069155.
Prabhu P, Jablin TB, Raman A, Zhang Y, Huang J, et al.. (2011) A survey of the practice of computational science. In: Proceedings 24th ACM/IEEE Conference on High Performance Computing, Networking, Storage and Analysis. pp. 19:1–19:12. doi:10.1145/2063348.2063374.

Taking you back to your happy place
True Story
- Me: Can I see the code please?
- Them: I'll just get the changes from Bob folded in and email it
- Me: Shouldn't we be using version control?
- Them: No need - it's overkill. We don't have a VC problem.
- Me: The code you sent me doesn't work
- Them: Sorry. I sent the wrong version.
Which version control system should you use?
I like and use 'git' but use whatever your colleagues are using.

- You can get your results by entering one command
- Your code buddy has seen your code -> Show it to the world
- Your code is in git -> upload to public github
Benefits
- It's the right thing to do
- Others will use, debug and enhance your work
- Others will reproduce and cite your work
- More opportunities to collaborate
If python: write it as a module - future you will be grateful
Literate computing
Makes it easy for people to use your module.

Write tests
- Every decent language has a testing framework
- Learn how to use it (software carpentry)
- You write additional code that ensures your code gives the answers you expect
- Tests give you confidence to make changes
$ nosetests ./unittests.py
..............................


Welcome to GoogleIt
GoogleIt is a command line tool that allow you to search on Google in terminal.
Usage
With your computer with macOS. You can use
googleit github
to search term.
Also if you want to search harry-potter
as a book. You can use -b
option like this.
googleit -b harry-potter
Installation
npm install -g googleit
Options
| Option | Description |
|---|---|
| -i | Search image |
| -v | Search video |
| -n | Search news |
| -b | Search book |
| -p | Search patent |
System Requirement
- macOS
May have some issue with Linux and other OS.


Author
Enjoy a New Yacht Discover New Places and Feel Happy,to Share Every One...
Lorem Ipsum is simply dummy text of the printing and typesetting industry.Lorem Ipsum has been the industry's standard dummy text ever since,Lorem Ipsum is simply dummy text of the printing and typesetting industry.Lorem Ipsum has been the industry's standard dummy text ever since Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.
by Alexander Shumihin View on Dribbble
by Zoe Ingram View on Dribbble
by Eileen Tjan View on Dribbble
by Eileen Tjan View on Dribbble
A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart.
Read MoreA wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart.
Read MoreA wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart.
Read MoreA wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart.
Read MoreA wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart.
Read MoreA wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart.
Read MoreEnjoy a New Yacht Discover New Places and Feel Happy,to Share Every One...
Enjoy a New Yacht Discover New Places and Feel Happy,to Share Every One...
Enjoy a New Yacht Discover New Places and Feel Happy,to Share Every One...
Copyright © 2015.Company name All rights reserved.网页模板


While watching tv in your living room, you recieve pictures of yourself from an unknown number.


Since TestCase v. 1.0, the library provides the events test fires functionality.
The functionality is generally crossbrowsing. It was tested with FF (1.5, 2.0, 3.0), Opera, IE (6 and 7), Konqueror and Safari. But case all of the browses are different, with own unique "features", some stuffs works different and some don't work at all. So be ware.
With Safari and Konqueror, currently, you cannot specify the key-codes on the keyboard events correctly. The events will get fired up, but you won't get any correct key-codes from them. Looking forward for a solution.
You may pass the following options with the mouse events
With the keyboard events, you can specify the follwoing options
The usage by itself is pretty simple and plain. Just pass your element in some of the methods, and if
you are trying to call the common mouse/keyboar event firing methods, then specify the event-name.
Downcased and without the 'on' prefix. Like that.
this.fire_click('element-id');
this.fire_mouse_event(element, 'mouseover', { shiftKey: true });
this.fire_key_press(element, Event.KEY_ESC);
var event = this.fire_key_event('element', 'keydown', Event.KEY_UP);
Note that each of the methods return the fired event object. So you can get it right there if you like.
That's all, enjoy!


-
'stay'
-
'switch'
The Monty Hall problem is a probability-based puzzle loosely based on the American television game show Let's Make a Deal and named after its original host, Monty Hall. The rules of the game are simple, there are three doors behind one of which there is a Car. You have to choose a door, After you choose a door the host who knows what's behind each door opens one of the other two doors which does not have a car. Now you are given a choice, whether you stick to your original choice or switch to the remaining door? What do you think will give you a mathematical advantage? Now that there are two doors, and behind one of which there is a car, Do you think it's 50-50? Well, there are plenty of resources available on the correct answer and the intuition for it. Try playing this game with the two strategies and see if you could figure out what is happening.


The item id.
The item if it exists.
Generates the HTML element containing the menu entries.
Returns the currently focused Item.
The focused Item.
Returns the items in that menu.
The array of items.
The variable pool associated to this menu.
True if element is posted in the page.
Posts the element.
Posts the element at the given coordinates.
The x coordinate.
The y coordinate.
Sets the currently focused Item.
The new focused Item.
Removes element from page.
Unposts all submenus of this menu.
Generated using TypeDoc
Retrieves a menu item via its id by depth-first search.


Israeli PM Benjamin Netanyahu charged with fraud and bribery
He has denied any wrongdoing and insists the allegations stem from a ‘witch-hunt’ against him.
Israeli Prime Minister Benjamin Netanyahu has been charged in a series of corruption cases, throwing the country’s paralysed political system into further disarray and threatening the long-time leader’s grip on power.
Capping a three-year investigation, attorney general Avichai Mandelblit charged Mr Netanyahu with fraud, breach of trust and accepting bribes in three different scandals.
It is the first time a sitting Israeli prime minister has been charged with a crime.
According to the indictment, Mr Netanyahu accepted hundreds of thousands of pounds worth of champagne and cigars from billionaire friends, offered to trade favours with a newspaper publisher, and used his influence to help a wealthy telecoms magnate in exchange for favourable coverage on a popular news site.
The indictment does not require Mr Netanyahu to resign but is expected to raise pressure on him to step down.
Mr Mandelblit said his “heavy-hearted decision” was based solely on professional considerations, and he rejected suggestions the indictment was politically motivated.
He angrily criticised pressure from both Mr Netanyahu’s supporters and foes to sway his decision.
The most serious charges are connected to so-called “Case 4000”, in which Mr Netanyahu is accused of passing regulations that gave his friend, telecoms magnate Shaul Elovitch, benefits worth tens of millions to his company Bezeq.
In return, Bezeq’s news site Walla published favourable articles about the PM and his family.
The indictment also said Mr Netanyahu’s gifts of champagne from billionaires Arnon Milchan and James Packer “turned into a sort of supply line”.
And it accuses Mr Netanyahu of assisting Israeli Mr Milchan, a Hollywood mogul, in extending his US visa.
Two close aides to Mr Netanyahu testified against him in the case.
Israel has recently held two inconclusive elections, with a third likely amid an ongoing political impasse.


balances
household balance sheet
| Assets | Rate |
Anual Amount |
Balance |
|---|---|---|---|
| cash | $33.000 | $33.000 | $33.000 |
| investments | $33.000 | $33.000 | $33.000 |
| Misc.Assets | $33.000 | $33.000 | $33.000 |
| Real Estate | $33.000 | $33.000 | $33.000 |
| Total | $2546.00 | $2546.00 | $2546.00 |
|---|
| Liabilities | Rate |
Anual Amount |
Balance |
|---|---|---|---|
| cash | $33.000 | $33.000 | $33.000 |
| investments | $33.000 | $33.000 | $33.000 |
| Misc.Assets | $33.000 | $33.000 | $33.000 |
| Total | $2546.00 | $2546.00 | $2546.00 |
|---|
| Equity | |||
|---|---|---|---|
| New worth | $33.000 | $33.000 | $33.000 |
composition
Assets
$ 12345.0000000
+2.10%
Liabilities
$ 12345.0000000
+2.10%
equity
$ 12345.0000000
+2.10%
balances
household balance sheet
| Assets | Rate |
Anual Amount |
Balance |
|---|---|---|---|
| cash | $33.000 | $33.000 | $33.000 |
| investments | $33.000 | $33.000 | $33.000 |
| Misc.Assets | $33.000 | $33.000 | $33.000 |
| Real Estate | $33.000 | $33.000 | $33.000 |
| Total | $2546.00 | $2546.00 | $2546.00 |
|---|
| Liabilities | Rate |
Anual Amount |
Balance |
|---|---|---|---|
| cash | $33.000 | $33.000 | $33.000 |
| investments | $33.000 | $33.000 | $33.000 |
| Misc.Assets | $33.000 | $33.000 | $33.000 |
| Total | $2546.00 | $2546.00 | $2546.00 |
|---|
| Equity | |||
|---|---|---|---|
| New worth | $33.000 | $33.000 | $33.000 |
composition
Assets
$ 12345.0000000
+2.10%
Liabilities
$ 12345.0000000
+2.10%
equity
$ 12345.0000000
+2.10%
balances
household balance sheet
| Assets | Rate |
Anual Amount |
Balance |
|---|---|---|---|
| cash | $33.000 | $33.000 | $33.000 |
| investments | $33.000 | $33.000 | $33.000 |
| Misc.Assets | $33.000 | $33.000 | $33.000 |
| Real Estate | $33.000 | $33.000 | $33.000 |
| Total | $2546.00 | $2546.00 | $2546.00 |
|---|
| Liabilities | Rate |
Anual Amount |
Balance |
|---|---|---|---|
| cash | $33.000 | $33.000 | $33.000 |
| investments | $33.000 | $33.000 | $33.000 |
| Misc.Assets | $33.000 | $33.000 | $33.000 |
| Total | $2546.00 | $2546.00 | $2546.00 |
|---|
| Equity | |||
|---|---|---|---|
| New worth | $33.000 | $33.000 | $33.000 |
composition
Assets
$ 12345.0000000
+2.10%
Liabilities
$ 12345.0000000
+2.10%
equity
$ 12345.0000000
+2.10%
balances
household balance sheet
| Assets | Rate |
Anual Amount |
Balance |
|---|---|---|---|
| cash | $33.000 | $33.000 | $33.000 |
| investments | $33.000 | $33.000 | $33.000 |
| Misc.Assets | $33.000 | $33.000 | $33.000 |
| Real Estate | $33.000 | $33.000 | $33.000 |
| Total | $2546.00 | $2546.00 | $2546.00 |
|---|
| Liabilities | Rate |
Anual Amount |
Balance |
|---|---|---|---|
| cash | $33.000 | $33.000 | $33.000 |
| investments | $33.000 | $33.000 | $33.000 |
| Misc.Assets | $33.000 | $33.000 | $33.000 |
| Total | $2546.00 | $2546.00 | $2546.00 |
|---|
| Equity | |||
|---|---|---|---|
| New worth | $33.000 | $33.000 | $33.000 |
composition
balances
household balance sheet
| Assets | Rate |
Anual Amount |
Balance |
|---|---|---|---|
| cash | $33.000 | $33.000 | $33.000 |
| investments | $33.000 | $33.000 | $33.000 |
| Misc.Assets | $33.000 | $33.000 | $33.000 |
| Real Estate | $33.000 | $33.000 | $33.000 |
| Total | $2546.00 | $2546.00 | $2546.00 |
|---|
| Liabilities | Rate |
Anual Amount |
Balance |
|---|---|---|---|
| cash | $33.000 | $33.000 | $33.000 |
| investments | $33.000 | $33.000 | $33.000 |
| Misc.Assets | $33.000 | $33.000 | $33.000 |
| Total | $2546.00 | $2546.00 | $2546.00 |
|---|
| Equity | |||
|---|---|---|---|
| New worth | $33.000 | $33.000 | $33.000 |