Merge branch 'develop' into staging

This commit is contained in:
Taylor Otwell 2012-08-01 13:46:06 -05:00
commit d667a15e05
109 changed files with 1690 additions and 333 deletions

View File

@ -8,7 +8,7 @@
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| The URL used to access your application without a trailing slash. The URL | The URL used to access your application without a trailing slash. The URL
| does not have to be set. If it isn't we'll try our best to guess the URL | does not have to be set. If it isn't, we'll try our best to guess the URL
| of your application. | of your application.
| |
*/ */
@ -48,7 +48,7 @@
| |
| This key is used by the encryption and cookie classes to generate secure | This key is used by the encryption and cookie classes to generate secure
| encrypted strings and hashes. It is extremely important that this key | encrypted strings and hashes. It is extremely important that this key
| remain secret and should not be shared with anyone. Make it about 32 | remains secret and it should not be shared with anyone. Make it about 32
| characters of random gibberish. | characters of random gibberish.
| |
*/ */
@ -63,7 +63,7 @@
| Laravel includes a beautiful profiler toolbar that gives you a heads | Laravel includes a beautiful profiler toolbar that gives you a heads
| up display of the queries and logs performed by your application. | up display of the queries and logs performed by your application.
| This is wonderful for development, but, of course, you should | This is wonderful for development, but, of course, you should
| disable the toolbar for production applications.. | disable the toolbar for production applications.
| |
*/ */
@ -84,7 +84,7 @@
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Application Language | Default Application Language
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| The default language of your application. This language will be used by | The default language of your application. This language will be used by
@ -94,12 +94,25 @@
'language' => 'en', 'language' => 'en',
/*
|--------------------------------------------------------------------------
| Supported Languages
|--------------------------------------------------------------------------
|
| These languages may also be supported by your application. If a request
| enters your application with a URI beginning with one of these values
| the default language will automatically be set to that language.
|
*/
'languages' => array(),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| SSL Link Generation | SSL Link Generation
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Many sites use SSL to protect their users data. However, you may not be | Many sites use SSL to protect their users' data. However, you may not be
| able to use SSL on your development machine, meaning all HTTPS will be | able to use SSL on your development machine, meaning all HTTPS will be
| broken during development. | broken during development.
| |

View File

@ -29,7 +29,7 @@
| This key will be prepended to item keys stored using Memcached and APC | This key will be prepended to item keys stored using Memcached and APC
| to prevent collisions with other applications on the server. Since the | to prevent collisions with other applications on the server. Since the
| memory based stores could be shared by other applications, we need to | memory based stores could be shared by other applications, we need to
| be polite and use a prefix to uniquely identifier our items. | be polite and use a prefix to uniquely identify our items.
| |
*/ */

View File

@ -35,7 +35,7 @@
| Default Database Connection | Default Database Connection
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| The name of your default database connection. This connection will used | The name of your default database connection. This connection will be used
| as the default for all database operations unless a different name is | as the default for all database operations unless a different name is
| given when performing said operation. This connection name should be | given when performing said operation. This connection name should be
| listed in the array of connections below. | listed in the array of connections below.
@ -54,7 +54,7 @@
| the freedom to specify as many connections as you can handle. | the freedom to specify as many connections as you can handle.
| |
| All database work in Laravel is done through the PHP's PDO facilities, | All database work in Laravel is done through the PHP's PDO facilities,
| so make sure you have the PDO drivers for your particlar database of | so make sure you have the PDO drivers for your particular database of
| choice installed on your machine. | choice installed on your machine.
| |
*/ */
@ -85,6 +85,7 @@
'password' => '', 'password' => '',
'charset' => 'utf8', 'charset' => 'utf8',
'prefix' => '', 'prefix' => '',
'schema' => 'public',
), ),
'sqlsrv' => array( 'sqlsrv' => array(

View File

@ -9,7 +9,7 @@
| |
| Here you simply specify the error levels that should be ignored by the | Here you simply specify the error levels that should be ignored by the
| Laravel error handler. These levels will still be logged; however, no | Laravel error handler. These levels will still be logged; however, no
| information about about them will be displayed. | information about them will be displayed.
| |
*/ */
@ -56,7 +56,7 @@
| logging is enabled. | logging is enabled.
| |
| You may log the error message however you like; however, a simple log | You may log the error message however you like; however, a simple log
| solution has been setup for you which will log all error messages to | solution has been set up for you which will log all error messages to
| text files within the application storage directory. | text files within the application storage directory.
| |
*/ */

View File

@ -23,7 +23,7 @@
| Session Database | Session Database
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| The database table on which the session should be stored. It probably | The database table in which the session should be stored. It probably
| goes without saying that this option only matters if you are using | goes without saying that this option only matters if you are using
| the super slick database session driver. | the super slick database session driver.
| |

View File

@ -8,7 +8,7 @@
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| This array contains the singular and plural forms of words. It's used by | This array contains the singular and plural forms of words. It's used by
| the "singular" and "plural" methods on the Str class to convert a given | the "singular" and "plural" methods in the Str class to convert a given
| word from singular to plural and vice versa. | word from singular to plural and vice versa.
| |
| Note that the regular expressions are only for inflecting English words. | Note that the regular expressions are only for inflecting English words.

View File

@ -0,0 +1,19 @@
<?php
return array(
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the pagination links. You're free to change them to anything you want.
| If you come up with something more exciting, let us know.
|
*/
'previous' => '&laquo; Précédent',
'next' => 'Suivant &raquo;',
);

View File

@ -0,0 +1,99 @@
<?php
return array(
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used
| by the validator class. Some of the rules contain multiple versions,
| such as the size (max, min, between) rules. These versions are used
| for different input types such as strings and files.
|
| These language lines may be easily changed to provide custom error
| messages in your application. Error messages for custom validation
| rules may also be added to this file.
|
*/
"accepted" => "Le champ :attribute doit être accepté.",
"active_url" => "Le champ :attribute n'est pas une URL valide.",
"after" => "Le champ :attribute doit être une date après :date.",
"alpha" => "Le champ :attribute ne doit contenir que des lettres.",
"alpha_dash" => "Le champ :attribute ne doit contenir que des lettres, nombres et des tirets.",
"alpha_num" => "Le champ :attribute ne doit contenir que des lettres et nombres.",
"before" => "Le champ :attribute doit être une date avant :date.",
"between" => array(
"numeric" => "Le champ :attribute doit être entre :min - :max.",
"file" => "Le champ :attribute doit être entre :min - :max kilo-octets.",
"string" => "Le champ :attribute doit être entre :min - :max caractères.",
),
"confirmed" => "Le champ :attribute confirmation est différent.",
"different" => "Les champ :attribute et :other doivent être différents.",
"email" => "Le format du champ :attribute est invalide.",
"exists" => "Le champ sélectionné :attribute est invalide.",
"image" => "Le champ :attribute doit être une image.",
"in" => "Le champ sélectionné :attribute est invalide.",
"integer" => "Le champ :attribute doit être un entier.",
"ip" => "Le champ :attribute doit être une adresse IP valide.",
"match" => "Le format du champ :attribute est invalide.",
"max" => array(
"numeric" => "Le :attribute doit être plus petit que :max.",
"file" => "Le :attribute doit être plus petit que :max kilo-octets.",
"string" => "Le :attribute doit être plus petit que :max caractères.",
),
"mimes" => "Le champ :attribute doit être un fichier de type: :values.",
"min" => array(
"numeric" => "Le champ :attribute doit être au moins :min.",
"file" => "Le champ :attribute doit être au moins :min kilo-octets.",
"string" => "Le champ :attribute doit être au moins :min caractères.",
),
"not_in" => "Le champ sélectionné :attribute est invalide.",
"numeric" => "Le champ :attribute doit être un nombre.",
"required" => "Le champ :attribute est requis",
"same" => "Le champ :attribute et :other doivent être identique.",
"size" => array(
"numeric" => "Le champ :attribute doit être :size.",
"file" => "Le champ :attribute doit être de :size kilo-octets.",
"string" => "Le champ :attribute doit être de :size caractères.",
),
"unique" => "Le champ :attribute est déjà utilisé.",
"url" => "Le champ :attribute à un format invalide.",
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute_rule" to name the lines. This helps keep your
| custom validation clean and tidy.
|
| So, say you want to use a custom validation message when validating that
| the "email" attribute is unique. Just add "email_unique" to this array
| with your custom message. The Validator will handle the rest!
|
*/
'custom' => array(),
/*
|--------------------------------------------------------------------------
| Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap attribute place-holders
| with something more reader friendly such as "E-Mail Address" instead
| of "email". Your users will thank you.
|
| The Validator class will automatically search this array of lines it
| is attempting to replace the :attribute place-holder in messages.
| It's pretty slick. We think you'll like it.
|
*/
'attributes' => array(),
);

View File

@ -0,0 +1,19 @@
<?php
return array(
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the pagination links. You're free to change them to anything you want.
| If you come up with something more exciting, let us know.
|
*/
'previous' => '&laquo; Előző',
'next' => 'Következő &raquo;',
);

View File

@ -0,0 +1,99 @@
<?php
return array(
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used
| by the validator class. Some of the rules contain multiple versions,
| such as the size (max, min, between) rules. These versions are used
| for different input types such as strings and files.
|
| These language lines may be easily changed to provide custom error
| messages in your application. Error messages for custom validation
| rules may also be added to this file.
|
*/
"accepted" => "A(z) :attribute el kell legyen fogadva.",
"active_url" => "A :attribute nem valós URL.",
"after" => "A :attribute :date utáni dátum kell legyen.",
"alpha" => "A(z) :attribute csak betűket tartalmazhat.",
"alpha_dash" => "A(z) :attribute betűket, számokat és kötőjeleket tartalmazhat.",
"alpha_num" => "A(z) :attribute csak betűket és számokat tartalmazhat.",
"before" => "A :attribute :date előtti dátum kell legyen.",
"between" => array(
"numeric" => "A(z) :attribute :min - :max közötti érték kell legyen.",
"file" => "A(z) :attribute :min - :max kilobyte között kell legyen.",
"string" => "A(z) :attribute :min - :max karakterhossz között kell legyen",
),
"confirmed" => "A(z) :attribute megerősítése nem egyezett meg.",
"different" => "A(z) :attribute és :other különböző kell legyen.",
"email" => "A(z) :attribute formátuma nem megfelelő.",
"exists" => "A(z) választott :attribute nem megfelelő.",
"image" => "A(z) :attribute kép kell legyen.",
"in" => "A(z) választott :attribute nem megfelelő.",
"integer" => "A :attribute szám kell legyen.",
"ip" => "A :attribute valós IP cím kell legyen.",
"match" => "A(z) :attribute formátuma nem megfelelő.",
"max" => array(
"numeric" => "A :attribute kevesebb kell legyen, mint :max.",
"file" => "A :attribute kevesebb kell legyen :max kilobytenál.",
"string" => "A :attribute kevesebb karakterből kell álljon, mint :max.",
),
"mimes" => "A :attribute az alábbi tipusokból való kell legyen :values.",
"min" => array(
"numeric" => "A :attribute legalább :min kell legyen.",
"file" => "A :attribute legalább :min kilobyte kell legyen.",
"string" => "A :attribute legalább :min karakter hosszú kell legyen.",
),
"not_in" => "A választott :attribute nem megfelelő.",
"numeric" => "A :attribute szám kell legyen.",
"required" => "A(z) :attribute megadása kötelező.",
"same" => "A :attribute és a :other muszáj hogy megegyezzen.",
"size" => array(
"numeric" => "A(z) :attribute :size kell legyen.",
"file" => "A(z) :attribute :size kilobyteos kell legyen.",
"string" => "A(z) :attribute :size karakteres kell legyen.",
),
"unique" => "A(z) :attribute már foglalt.",
"url" => "A(z) :attribute formátuma nem megfelelő.",
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute_rule" to name the lines. This helps keep your
| custom validation clean and tidy.
|
| So, say you want to use a custom validation message when validating that
| the "email" attribute is unique. Just add "email_unique" to this array
| with your custom message. The Validator will handle the rest!
|
*/
'custom' => array(),
/*
|--------------------------------------------------------------------------
| Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap attribute place-holders
| with something more reader friendly such as "E-Mail Address" instead
| of "email". Your users will thank you.
|
| The Validator class will automatically search this array of lines it
| is attempting to replace the :attribute place-holder in messages.
| It's pretty slick. We think you'll like it.
|
*/
'attributes' => array(),
);

View File

@ -0,0 +1,19 @@
<?php
return array(
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the pagination links. You're free to change them to anything you want.
| If you come up with something more exciting, let us know.
|
*/
'previous' => '&laquo; Sebelumnya',
'next' => 'Selanjutnya &raquo;',
);

View File

@ -0,0 +1,99 @@
<?php
return array(
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used
| by the validator class. Some of the rules contain multiple versions,
| such as the size (max, min, between) rules. These versions are used
| for different input types such as strings and files.
|
| These language lines may be easily changed to provide custom error
| messages in your application. Error messages for custom validation
| rules may also be added to this file.
|
*/
"accepted" => "Isian :attribute harus diterima.",
"active_url" => "Isian :attribute bukan URL yang valid.",
"after" => "Isian :attribute harus tanggal setelah :date.",
"alpha" => "Isian :attribute hanya boleh berisi huruf.",
"alpha_dash" => "Isian :attribute hanya boleh berisi huruf, angka, dan strip.",
"alpha_num" => "Isian :attribute hanya boleh berisi huruf dan angka.",
"before" => "Isian :attribute harus tanggal sebelum :date.",
"between" => array(
"numeric" => "Isian :attribute harus antara :min - :max.",
"file" => "Isian :attribute harus antara :min - :max kilobytes.",
"string" => "Isian :attribute harus antara :min - :max karakter.",
),
"confirmed" => "Konfirmasi :attribute tidak cocok.",
"different" => "Isian :attribute dan :other harus berbeda.",
"email" => "Format isian :attribute tidak valid.",
"exists" => "Isian :attribute yang dipilih tidak valid.",
"image" => ":attribute harus berupa gambar.",
"in" => "Isian :attribute yang dipilih tidak valid.",
"integer" => "Isian :attribute harus merupakan bilangan.",
"ip" => "Isian :attribute harus alamat IP yang valid.",
"match" => "Format isian :attribute tidak valid.",
"max" => array(
"numeric" => "Isian :attribute harus kurang dari :max.",
"file" => "Isian :attribute harus kurang dari :max kilobytes.",
"string" => "Isian :attribute harus kurang dari :max karakter.",
),
"mimes" => "Isian :attribute harus dokumen berjenis : :values.",
"min" => array(
"numeric" => "Isian :attribute harus minimal :min.",
"file" => "Isian :attribute harus minimal :min kilobytes.",
"string" => "Isian :attribute harus minimal :min karakter.",
),
"not_in" => "Isian :attribute yang dipilih tidak valid.",
"numeric" => "Isian :attribute harus berupa angka.",
"required" => "Isian :attribute wajib diisi.",
"same" => "Isian :attribute dan :other harus sama.",
"size" => array(
"numeric" => "Isian :attribute harus berukuran :size.",
"file" => "Isian :attribute harus berukuran :size kilobyte.",
"string" => "Isian :attribute harus berukuran :size karakter.",
),
"unique" => "Isian :attribute sudah ada sebelumnya.",
"url" => "Format isian :attribute tidak valid.",
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute_rule" to name the lines. This helps keep your
| custom validation clean and tidy.
|
| So, say you want to use a custom validation message when validating that
| the "email" attribute is unique. Just add "email_unique" to this array
| with your custom message. The Validator will handle the rest!
|
*/
'custom' => array(),
/*
|--------------------------------------------------------------------------
| Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap attribute place-holders
| with something more reader friendly such as "E-Mail Address" instead
| of "email". Your users will thank you.
|
| The Validator class will automatically search this array of lines it
| is attempting to replace the :attribute place-holder in messages.
| It's pretty slick. We think you'll like it.
|
*/
'attributes' => array(),
);

View File

@ -0,0 +1,31 @@
<?php
return array(
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the pagination links. You're free to change them to anything you want.
| If you come up with something more exciting, let us know.
|
*/
/*
|--------------------------------------------------------------------------
| ペギネーション言語ライン
|--------------------------------------------------------------------------
|
| 以下の言語設定行はpaginatorライブラリーにより、ペギネーションリンクを作成するため
| 使用されます。お好きなように変更してください。
| もっとエキサイトするアイデアが思い浮かんだら、私達に教えて下さい。
|
*/
'previous' => '&laquo; 前',
'next' => '次 &raquo;',
);

View File

@ -0,0 +1,142 @@
<?php
return array(
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used
| by the validator class. Some of the rules contain multiple versions,
| such as the size (max, min, between) rules. These versions are used
| for different input types such as strings and files.
|
| These language lines may be easily changed to provide custom error
| messages in your application. Error messages for custom validation
| rules may also be added to this file.
|
*/
/*
|--------------------------------------------------------------------------
| バリデーション言語設定
|--------------------------------------------------------------------------
|
| 以下の言語設定はvalidatorクラスで使用しているデフォルトのエラーメッセージを構成しています。
| 幾つかのルールは複数の設定を持っています。例えばサイズ(max,min,between)ルールです。
| (訳注:(numeric, file, string)の間違いと思われる。
| これらの設定は、文字列やファイルのように入力のタイプの違いにより、使い分けられます。
|
| これらの言語設定はあなたのアプリケーションでカスタムエラーメッセージとして表示するため
| 気軽に変更してください。カスタムバリデーションルールのためのエラーメッセージも、
| 同様にこのファイルに追加していただけます。
|
*/
"accepted" => ":attributeを承認してください。",
"active_url" => ":attributeが有効なURLではありません。",
"after" => ":attributeには、:date以降の日付を指定してください。",
"alpha" => ":attributeはアルファベッドのみがご利用できます。",
"alpha_dash" => ":attributeは英数字とダッシュ(-)及び下線(_)がご利用できます。",
"alpha_num" => ":attributeは英数字がご利用できます。",
"before" => ":attributeには、:date以前の日付をご利用ください。",
"between" => array(
"numeric" => ":attributeは、:minから、:maxまでの数字をご指定ください。",
"file" => ":attributeには、:min kBから:max kBまでのサイズのファイルをご指定ください。",
"string" => ":attributeは、:min文字から:max文字の間でご指定ください。",
),
"confirmed" => ":attributeと、確認フィールドとが、一致していません。",
"different" => ":attributeと:otherには、異なった内容を指定してください。",
"email" => ":attributeには正しいメールアドレスの形式をご指定ください。",
"exists" => "選択された:attributeは正しくありません。",
"image" => ":attributeには画像ファイルを指定してください。",
"in" => "選択された:attributeは正しくありません。",
"integer" => ":attributeは整数でご指定ください。",
"ip" => ":attributeには、有効なIPアドレスをご指定ください。",
"match" => ":attributeの入力フォーマットが間違っています。",
"max" => array(
"numeric" => ":attributeには、:max以下の数字をご指定ください。",
"file" => ":attributeには、:max kB以下のファイルをご指定ください。",
"string" => ":attributeは、:max文字以下でご指定ください。",
),
"mimes" => ":attributeには:valuesタイプのファイルを指定してください。",
"min" => array(
"numeric" => ":attributeには、:min以上の数字をご指定ください。",
"file" => ":attributeには、:min kB以上のファイルをご指定ください。",
"string" => ":attributeは、:min文字以上でご指定ください。",
),
"not_in" => "選択された:attributeは正しくありません。",
"numeric" => ":attributeには、数字を指定してください。",
"required" => ":attributeは必ず指定してください。",
"same" => ":attributeと:otherには同じ値を指定してください。",
"size" => array(
"numeric" => ":attributeには:sizeを指定してください。",
"file" => ":attributeのファイルは、:sizeキロバイトでなくてはなりません。",
"string" => ":attributeは:size文字で指定してください。",
),
"unique" => ":attributeに指定された値は既に存在しています。",
"url" => ":attributeのフォーマットが正しくありません。",
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute_rule" to name the lines. This helps keep your
| custom validation clean and tidy.
|
| So, say you want to use a custom validation message when validating that
| the "email" attribute is unique. Just add "email_unique" to this array
| with your custom message. The Validator will handle the rest!
|
*/
/*
|--------------------------------------------------------------------------
| カスタムバリデーション言語設定
|--------------------------------------------------------------------------
|
| ここでは、"属性_ルール"の記法を使用し、属性に対するカスタムバリデーションメッセージを
| 指定してください。これにより、カスタムバリデーションをきれいに美しく保てます。
|
| 例えば、"email"属性のuniqueバリデーションで、カスタムバリデーションメッセージを
| 使いたいならば、"email_unique"をカスタムメッセージとともに、配列に追加してください。
| Validatorクラスが残りの面倒を見ます
|
*/
'custom' => array(),
/*
|--------------------------------------------------------------------------
| Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap attribute place-holders
| with something more reader friendly such as "E-Mail Address" instead
| of "email". Your users will thank you.
|
| The Validator class will automatically search this array of lines it
| is attempting to replace the :attribute place-holder in messages.
| It's pretty slick. We think you'll like it.
|
*/
/*
|--------------------------------------------------------------------------
| バリデーション属性
|--------------------------------------------------------------------------
|
| 以下の言語設定は属性のプレースホルダーを例えば"email"属性を"E-Mailアドレス"という風に
| 読み手に親切になるよう置き換えるために使用されます。
| あなたのユーザーは、あなたに感謝するでしょう。
|
| Validatorクラスは、自動的にメッセージに含まれる:attributeプレースホルダーを
| この配列の値に置き換えようと試みます。絶妙ですね。あなたも気に入ってくれるでしょう。
*/
'attributes' => array(),
);

View File

@ -0,0 +1,19 @@
<?php
return array(
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the pagination links. You're free to change them to anything you want.
| If you come up with something more exciting, let us know.
|
*/
'previous' => '&laquo; Vorige',
'next' => 'Volgende &raquo;',
);

View File

@ -0,0 +1,90 @@
<?php
return array(
/*
|--------------------------------------------------------------------------
| Dutch validation language file
|--------------------------------------------------------------------------
|
*/
"accepted" => "Het :attribute moet geaccepteerd zijn.",
"active_url" => "Het :attribute is geen geldig URL.",
"after" => "Het :attribute moet een datum na :date zijn.",
"alpha" => "Het :attribute mag alleen letters bevatten.",
"alpha_dash" => "Het :attribute mag alleen letters, nummers, onderstreep(_) en strepen(-) bevatten.",
"alpha_num" => "Het :attribute mag alleen letters en nummers",
"before" => "Het :attribute moet een datum voor :date zijn.",
"between" => array(
"numeric" => "Het :attribute moet tussen :min en :max zijn.",
"file" => "Het :attribute moet tussen :min en :max kilobytes zijn.",
"string" => "Het :attribute moet tussen :min en :max tekens zijn.",
),
"confirmed" => "Het :attribute bevestiging komt niet overeen.",
"different" => "Het :attribute en :other moeten verschillend zijn.",
"email" => "Het :attribute formaat is ongeldig.",
"exists" => "Het gekozen :attribute is al ingebruik.",
"image" => "Het :attribute moet een afbeelding zijn.",
"in" => "Het gekozen :attribute is ongeldig.",
"integer" => "Het :attribute moet een getal zijn.",
"ip" => "Het :attribute moet een geldig IP adres bevatten.",
"match" => "Het :attribute formaat is ongeldig.",
"max" => array(
"numeric" => "Het :attribute moet minder dan :max zijn.",
"file" => "Het :attribute moet minder dan :max kilobytes zijn.",
"string" => "Het :attribute moet minder dan :max tekens zijn.",
),
"mimes" => "Het :attribute moet een bestand zijn van het bestandstype :values.",
"min" => array(
"numeric" => "Het :attribute moet minimaal :min zijn.",
"file" => "Het :attribute moet minimaal :min kilobytes zijn.",
"string" => "Het :attribute moet minimaal :min characters zijn.",
),
"not_in" => "Het :attribute formaat is ongeldig.",
"numeric" => "Het :attribute moet een nummer zijn.",
"required" => "Het :attribute veld is verplicht.",
"same" => "Het :attribute en :other moeten overeenkomen.",
"size" => array(
"numeric" => "Het :attribute moet :size zijn.",
"file" => "Het :attribute moet :size kilobyte zijn.",
"string" => "Het :attribute moet :size characters zijn.",
),
"unique" => "Het :attribute is al in gebruik.",
"url" => "Het :attribute formaat is ongeldig.",
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute_rule" to name the lines. This helps keep your
| custom validation clean and tidy.
|
| So, say you want to use a custom validation message when validating that
| the "email" attribute is unique. Just add "email_unique" to this array
| with your custom message. The Validator will handle the rest!
|
*/
'custom' => array(),
/*
|--------------------------------------------------------------------------
| Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap attribute place-holders
| with something more reader friendly such as "E-Mail Address" instead
| of "email". Your users will thank you.
|
| The Validator class will automatically search this array of lines it
| is attempting to replace the :attribute place-holder in messages.
| It's pretty slick. We think you'll like it.
|
*/
'attributes' => array(),
);

View File

@ -38,7 +38,7 @@ function document_exists($page)
} }
/** /**
* Attach the sidebar to the documentatoin template. * Attach the sidebar to the documentation template.
*/ */
View::composer('docs::template', function($view) View::composer('docs::template', function($view)
{ {
@ -68,7 +68,7 @@ function document_exists($page)
// If no page was specified, but a "home" page exists for the section, // If no page was specified, but a "home" page exists for the section,
// we'll set the file to the home page so that the proper page is // we'll set the file to the home page so that the proper page is
// display back out to the client for the requested doc page. // displayed back out to the client for the requested doc page.
if (is_null($page) and document_exists($file.'/home')) if (is_null($page) and document_exists($file.'/home'))
{ {
$file .= '/home'; $file .= '/home';

8
bundles/docs/views/template.blade.php Normal file → Executable file
View File

@ -6,8 +6,8 @@
<title>Laravel: A Framework For Web Artisans</title> <title>Laravel: A Framework For Web Artisans</title>
<meta name="viewport" content="width=device-width"> <meta name="viewport" content="width=device-width">
{{ HTML::style('laravel/css/style.css') }} {{ HTML::style(URL::$base.'/laravel/css/style.css') }}
{{ HTML::style('laravel/js/modernizr-2.5.3.min.js') }} {{ HTML::script(URL::$base.'/laravel/js/modernizr-2.5.3.min.js') }}
</head> </head>
<body onload="prettyPrint()"> <body onload="prettyPrint()">
<div class="wrapper"> <div class="wrapper">
@ -28,7 +28,7 @@
</div> </div>
</div> </div>
{{ HTML::script('http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js') }} {{ HTML::script('http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js') }}
{{ HTML::script('laravel/js/prettify.js') }} {{ HTML::script(URL::$base.'/laravel/js/prettify.js') }}
{{ HTML::script('laravel/js/scroll.js') }} {{ HTML::script(URL::$base.'/laravel/js/scroll.js') }}
</body> </body>
</html> </html>

View File

@ -80,7 +80,7 @@ public function user()
} }
/** /**
* Get the a given application user by ID. * Get the given application user by ID.
* *
* @param int $id * @param int $id
* @return mixed * @return mixed
@ -192,7 +192,7 @@ protected function cookie($name, $value, $minutes)
} }
/** /**
* Get session key name used to store the token. * Get the session key name used to store the token.
* *
* @return string * @return string
*/ */

View File

@ -25,13 +25,20 @@ public function retrieve($id)
* @return void * @return void
*/ */
public function attempt($arguments = array()) public function attempt($arguments = array())
{
$user = $this->model()->where(function($query) use($arguments)
{ {
$username = Config::get('auth.username'); $username = Config::get('auth.username');
$user = $this->model()->where($username, '=', $arguments['username'])->first(); $query->where($username, '=', $arguments['username']);
// This driver uses a basic username and password authentication scheme foreach(array_except($arguments, array('username', 'password', 'remember')) as $column => $val)
// so if the credentials match what is in the database we will just {
$query->where($column, '=', $val);
}
})->first();
// If the credentials match what is in the database we will just
// log the user into the application and remember them if asked. // log the user into the application and remember them if asked.
$password = $arguments['password']; $password = $arguments['password'];

View File

@ -30,10 +30,9 @@ public function retrieve($id)
*/ */
public function attempt($arguments = array()) public function attempt($arguments = array())
{ {
$user = $this->get_user($arguments['username']); $user = $this->get_user($arguments);
// This driver uses a basic username and password authentication scheme // If the credentials match what is in the database we will just
// so if the credentials match what is in the database we will just
// log the user into the application and remember them if asked. // log the user into the application and remember them if asked.
$password = $arguments['password']; $password = $arguments['password'];
@ -48,18 +47,26 @@ public function attempt($arguments = array())
} }
/** /**
* Get the user from the database table by username. * Get the user from the database table.
* *
* @param mixed $value * @param array $arguments
* @return mixed * @return mixed
*/ */
protected function get_user($value) protected function get_user($arguments)
{ {
$table = Config::get('auth.table'); $table = Config::get('auth.table');
return DB::table($table)->where(function($query) use($arguments)
{
$username = Config::get('auth.username'); $username = Config::get('auth.username');
return DB::table($table)->where($username, '=', $value)->first(); $query->where($username, '=', $arguments['username']);
foreach(array_except($arguments, array('username', 'password', 'remember')) as $column => $val)
{
$query->where($column, '=', $val);
}
})->first();
} }
} }

View File

@ -40,7 +40,7 @@ class Autoloader {
/** /**
* Load the file corresponding to a given class. * Load the file corresponding to a given class.
* *
* This method is registerd in the bootstrap file as an SPL auto-loader. * This method is registered in the bootstrap file as an SPL auto-loader.
* *
* @param string $class * @param string $class
* @return void * @return void
@ -55,7 +55,7 @@ public static function load($class)
return class_alias(static::$aliases[$class], $class); return class_alias(static::$aliases[$class], $class);
} }
// All classes in Laravel are staticly mapped. There is no crazy search // All classes in Laravel are statically mapped. There is no crazy search
// routine that digs through directories. It's just a simple array of // routine that digs through directories. It's just a simple array of
// class to file path maps for ultra-fast file loading. // class to file path maps for ultra-fast file loading.
elseif (isset(static::$mappings[$class])) elseif (isset(static::$mappings[$class]))
@ -102,7 +102,7 @@ protected static function load_namespaced($class, $namespace, $directory)
protected static function load_psr($class, $directory = null) protected static function load_psr($class, $directory = null)
{ {
// The PSR-0 standard indicates that class namespaces and underscores // The PSR-0 standard indicates that class namespaces and underscores
// should be used to indcate the directory tree in which the class // should be used to indicate the directory tree in which the class
// resides, so we'll convert them to slashes. // resides, so we'll convert them to slashes.
$file = str_replace(array('\\', '_'), '/', $class); $file = str_replace(array('\\', '_'), '/', $class);

View File

@ -150,18 +150,18 @@ protected static function compile_layouts($value)
} }
// First we'll split out the lines of the template so we can get the // First we'll split out the lines of the template so we can get the
// layout from the top of the template. By convention it must be // layout from the top of the template. By convention, it must be
// located on the first line of the template contents. // located on the first line of the template contents.
$lines = preg_split("/(\r?\n)/", $value); preg_replace_callback(
'/^@layout(\s*?\(.+?\))(\r?\n)?/',
function($matches) use (&$value)
{
$value = substr( $value, strlen( $matches[0] ) ).CRLF.'@include'.$matches[1];
},
$value
);
$pattern = static::matcher('layout'); return $value;
$lines[] = preg_replace($pattern, '$1@include$2', $lines[0]);
// We will add a "render" statement to the end of the templates and
// then slice off the "@layout" shortcut from the start so the
// sections register before the parent template renders.
return implode(CRLF, array_slice($lines, 1));
} }
/** /**
@ -172,9 +172,10 @@ protected static function compile_layouts($value)
*/ */
protected static function extract($value, $expression) protected static function extract($value, $expression)
{ {
preg_match('/@layout(\s*\(.*\))(\s*)/', $value, $matches); if ( preg_match("/@layout\s*?\(\s*?'(.+?)'\s*?\)/", $value, $matches))
{
return str_replace(array("('", "')"), '', $matches[1]); return trim( $matches[1] );
}
} }
/** /**
@ -185,9 +186,9 @@ protected static function extract($value, $expression)
*/ */
protected static function compile_comments($value) protected static function compile_comments($value)
{ {
$value = preg_replace('/\{\{--(.+?)(--\}\})?\n/', "<?php // $1 ?>", $value); $value = preg_replace('/\{\{--(.*?)--\}\}/', "<?php // $1 ?>", $value);
return preg_replace('/\{\{--((.|\s)*?)--\}\}/', "<?php /* $1 */ ?>\n", $value); return preg_replace('/\{\{--(.*?)--\}\}/s', "<?php /* ?>$1<?php */ ?>", $value);
} }
/** /**
@ -198,7 +199,7 @@ protected static function compile_comments($value)
*/ */
protected static function compile_echos($value) protected static function compile_echos($value)
{ {
return preg_replace('/\{\{(.+?)\}\}/', '<?php echo $1; ?>', $value); return preg_replace('/\{\{(.+?)\}\}/s', '<?php echo $1; ?>', $value);
} }
/** /**
@ -209,27 +210,21 @@ protected static function compile_echos($value)
*/ */
protected static function compile_forelse($value) protected static function compile_forelse($value)
{ {
preg_match_all('/(\s*)@forelse(\s*\(.*\))(\s*)/', $value, $matches); preg_match_all('/@forelse\s*?\(\s*?\$(.+?)\s*?as\s*?\$(.+?)\s*?\)/', $value, $matches, PREG_SET_ORDER );
foreach ($matches[0] as $forelse) if ( count($matches) < 1 ) return $value;
foreach ($matches as $forelse)
{ {
preg_match('/\s*\(\s*(\S*)\s/', $forelse, $variable);
// Once we have extracted the variable being looped against, we can add // Once we have extracted the variable being looped against, we can add
// an if statement to the start of the loop that checks if the count // an if statement to the start of the loop that checks if the count
// of the variable being looped against is greater than zero. // of the variable being looped against is greater than zero.
$if = "<?php if (count({$variable[1]}) > 0): ?>"; $replace = '<?php if (count($'.$forelse[1].') > 0): foreach ($'.$forelse[1].' as $'.$forelse[2].'): ?>';
$search = '/(\s*)@forelse(\s*\(.*\))/';
$replace = '$1'.$if.'<?php foreach$2: ?>';
$blade = preg_replace($search, $replace, $forelse);
// Finally, once we have the check prepended to the loop we'll replace // Finally, once we have the check prepended to the loop we'll replace
// all instances of this forelse syntax in the view content of the // all instances of this forelse syntax in the view content of the
// view being compiled to Blade syntax with real PHP syntax. // view being compiled to Blade syntax with real PHP syntax.
$value = str_replace($forelse, $blade, $value); $value = str_replace($forelse[0], $replace, $value);
} }
return $value; return $value;
@ -243,7 +238,7 @@ protected static function compile_forelse($value)
*/ */
protected static function compile_empty($value) protected static function compile_empty($value)
{ {
return str_replace('@empty', '<?php endforeach; ?><?php else: ?>', $value); return str_replace('@empty', '<?php endforeach; else: ?>', $value);
} }
/** /**
@ -265,9 +260,42 @@ protected static function compile_endforelse($value)
*/ */
protected static function compile_structure_openings($value) protected static function compile_structure_openings($value)
{ {
$pattern = '/(\s*)@(if|elseif|foreach|for|while)(\s*\(.*\))/'; preg_replace_callback(
'/@(if|elseif|foreach|for|while)(\s*?)(\([^\n\r\t]+\))/',
return preg_replace($pattern, '$1<?php $2$3: ?>', $value); function($matches) use (&$value)
{
if(count( $matches ) === 4)
{
$open = 0;
$close = 0;
$cut = 0;
$len = strlen($matches[3]);
for($i = 0; $i < $len; $i++)
{
if($matches[3][$i] === '(' )
{
$open++;
}
if($matches[3][$i] === ')' )
{
$close++;
}
if($open !== 0 && ($open === $close))
{
break;
}
}
$condition = substr($matches[3], 0, ($i + 1));
$value = str_replace(
'@'.$matches[1].$matches[2].$condition,
'<?php '.$matches[1].$condition.': ?>',
$value
);
}
},
$value
);
return $value;
} }
/** /**
@ -278,9 +306,9 @@ protected static function compile_structure_openings($value)
*/ */
protected static function compile_structure_closings($value) protected static function compile_structure_closings($value)
{ {
$pattern = '/(\s*)@(endif|endforeach|endfor|endwhile|break)(\s*)/'; $pattern = '/@(endif|endforeach|endfor|endwhile|break|continue)/';
return preg_replace($pattern, '$1<?php $2; ?>$3', $value); return preg_replace($pattern, '<?php $1; ?>', $value);
} }
/** /**
@ -291,7 +319,7 @@ protected static function compile_structure_closings($value)
*/ */
protected static function compile_else($value) protected static function compile_else($value)
{ {
return preg_replace('/(\s*)@(else)(\s*)/', '$1<?php $2: ?>$3', $value); return str_replace( '@else', '<?php else: ?>', $value);
} }
/** /**
@ -302,9 +330,9 @@ protected static function compile_else($value)
*/ */
protected static function compile_unless($value) protected static function compile_unless($value)
{ {
$pattern = '/(\s*)@unless(\s*\(.*\))/'; $pattern = static::matcher('unless');
return preg_replace($pattern, '$1<?php if( ! ($2)): ?>', $value); return preg_replace($pattern, '<?php if( ! ($1)): ?>', $value);
} }
/** /**
@ -328,7 +356,7 @@ protected static function compile_includes($value)
{ {
$pattern = static::matcher('include'); $pattern = static::matcher('include');
return preg_replace($pattern, '$1<?php echo view$2->with(get_defined_vars())->render(); ?>', $value); return preg_replace($pattern, '<?php echo view$1->with(get_defined_vars())->render(); ?>', $value);
} }
/** /**
@ -341,7 +369,7 @@ protected static function compile_render($value)
{ {
$pattern = static::matcher('render'); $pattern = static::matcher('render');
return preg_replace($pattern, '$1<?php echo render$2; ?>', $value); return preg_replace($pattern, '<?php echo render$1; ?>', $value);
} }
/** /**
@ -354,7 +382,7 @@ protected static function compile_render_each($value)
{ {
$pattern = static::matcher('render_each'); $pattern = static::matcher('render_each');
return preg_replace($pattern, '$1<?php echo render_each$2; ?>', $value); return preg_replace($pattern, '<?php echo render_each$1; ?>', $value);
} }
/** /**
@ -369,7 +397,7 @@ protected static function compile_yields($value)
{ {
$pattern = static::matcher('yield'); $pattern = static::matcher('yield');
return preg_replace($pattern, '$1<?php echo \\Laravel\\Section::yield$2; ?>', $value); return preg_replace($pattern, '<?php echo \\Laravel\\Section::yield$1; ?>', $value);
} }
/** /**
@ -379,9 +407,7 @@ protected static function compile_yields($value)
*/ */
protected static function compile_yield_sections($value) protected static function compile_yield_sections($value)
{ {
$replace = '<?php echo \\Laravel\\Section::yield_section(); ?>'; return str_replace('@yield_section', '<?php echo \\Laravel\\Section::yield_section(); ?>', $value);
return str_replace('@yield_section', $replace, $value);
} }
/** /**
@ -396,7 +422,7 @@ protected static function compile_section_start($value)
{ {
$pattern = static::matcher('section'); $pattern = static::matcher('section');
return preg_replace($pattern, '$1<?php \\Laravel\\Section::start$2; ?>', $value); return preg_replace($pattern, '<?php \\Laravel\\Section::start$1; ?>', $value);
} }
/** /**
@ -409,7 +435,7 @@ protected static function compile_section_start($value)
*/ */
protected static function compile_section_end($value) protected static function compile_section_end($value)
{ {
return preg_replace('/@endsection/', '<?php \\Laravel\\Section::stop(); ?>', $value); return str_replace('@endsection', '<?php \\Laravel\\Section::stop(); ?>', $value);
} }
/** /**
@ -436,7 +462,7 @@ protected static function compile_extensions($value)
*/ */
public static function matcher($function) public static function matcher($function)
{ {
return '/(\s*)@'.$function.'(\s*\(.*\))/'; return '/@'.$function.'\s*?(\(.+?\))/';
} }
/** /**

View File

@ -46,7 +46,7 @@ public static function register($bundle, $config = array())
// If the given configuration is actually a string, we will assume it is a // If the given configuration is actually a string, we will assume it is a
// location and set the bundle name to match it. This is common for most // location and set the bundle name to match it. This is common for most
// bundles who simply live in the root bundle directory. // bundles that simply live in the root bundle directory.
if (is_string($config)) if (is_string($config))
{ {
$bundle = $config; $bundle = $config;
@ -55,7 +55,7 @@ public static function register($bundle, $config = array())
} }
// If no location is set, we will set the location to match the name of // If no location is set, we will set the location to match the name of
// the bundle. This is for bundles who are installed to the root of // the bundle. This is for bundles that are installed on the root of
// the bundle directory so a location was not set. // the bundle directory so a location was not set.
if ( ! isset($config['location'])) if ( ! isset($config['location']))
{ {
@ -66,7 +66,7 @@ public static function register($bundle, $config = array())
// It is possible for the developer to specify auto-loader mappings // It is possible for the developer to specify auto-loader mappings
// directly on the bundle registration. This provides a convenient // directly on the bundle registration. This provides a convenient
// way to register mappings withuot a bootstrap. // way to register mappings without a bootstrap.
if (isset($config['autoloads'])) if (isset($config['autoloads']))
{ {
static::autoloads($bundle, $config); static::autoloads($bundle, $config);
@ -74,7 +74,7 @@ public static function register($bundle, $config = array())
} }
/** /**
* Load a bundle by running it's start-up script. * Load a bundle by running its start-up script.
* *
* If the bundle has already been started, no action will be taken. * If the bundle has already been started, no action will be taken.
* *
@ -124,7 +124,7 @@ public static function routes($bundle)
$path = static::path($bundle).'routes'.EXT; $path = static::path($bundle).'routes'.EXT;
// By setting the bundle property on the router the router knows what // By setting the bundle property on the router, the router knows what
// value to replace the (:bundle) place-holder with when the bundle // value to replace the (:bundle) place-holder with when the bundle
// routes are added, keeping the routes flexible. // routes are added, keeping the routes flexible.
Router::$bundle = static::option($bundle, 'handles'); Router::$bundle = static::option($bundle, 'handles');
@ -201,7 +201,7 @@ public static function handles($uri)
} }
/** /**
* Deteremine if a bundle exists within the bundles directory. * Determine if a bundle exists within the bundles directory.
* *
* @param string $bundle * @param string $bundle
* @return bool * @return bool
@ -372,7 +372,7 @@ public static function resolve($bundle)
} }
/** /**
* Parse a element identifier and return the bundle name and element. * Parse an element identifier and return the bundle name and element.
* *
* <code> * <code>
* // Returns array(null, 'admin.user') * // Returns array(null, 'admin.user')

View File

@ -34,7 +34,7 @@
* We will wrap the command execution in a try / catch block and * We will wrap the command execution in a try / catch block and
* simply write out any exception messages we receive to the CLI * simply write out any exception messages we receive to the CLI
* for the developer. Note that this only writes out messages * for the developer. Note that this only writes out messages
* for the CLI exceptions. All others will be not be caught * for the CLI exceptions. All others will not be caught
* and will be totally dumped out to the CLI. * and will be totally dumped out to the CLI.
*/ */
try try

View File

@ -100,7 +100,7 @@ protected static function parse($task)
* // Resolve an instance of a task * // Resolve an instance of a task
* $task = Command::resolve('application', 'migrate'); * $task = Command::resolve('application', 'migrate');
* *
* // Resolve an instance of a task wtihin a bundle * // Resolve an instance of a task within a bundle
* $task = Command::resolve('bundle', 'foo'); * $task = Command::resolve('bundle', 'foo');
* </code> * </code>
* *
@ -121,7 +121,7 @@ public static function resolve($bundle, $task)
} }
// If the task file exists, we'll format the bundle and task name // If the task file exists, we'll format the bundle and task name
// into a task class name and resolve an instance of the so that // into a task class name and resolve an instance of the class so that
// the requested method may be executed. // the requested method may be executed.
if (file_exists($path = Bundle::path($bundle).'tasks/'.$task.EXT)) if (file_exists($path = Bundle::path($bundle).'tasks/'.$task.EXT))
{ {

View File

@ -126,3 +126,15 @@
return new Tasks\Bundle\Providers\Github; return new Tasks\Bundle\Providers\Github;
}); });
} }
/**
* The "help" task provides information about
* artisan usage.
*/
if(! IoC::registered('task: help'))
{
IoC::singleton('task: help', function()
{
return new Tasks\Help;
});
}

View File

@ -49,7 +49,7 @@ public function install($bundles)
// all of its registered dependencies as well. // all of its registered dependencies as well.
// //
// Each bundle provider implements the Provider interface and // Each bundle provider implements the Provider interface and
// is repsonsible for retrieving the bundle source from its // is responsible for retrieving the bundle source from its
// hosting party and installing it into the application. // hosting party and installing it into the application.
$path = path('bundle').$this->path($bundle); $path = path('bundle').$this->path($bundle);
@ -135,7 +135,7 @@ protected function get($bundles)
$responses[] = $bundle; $responses[] = $bundle;
// We'll also get the bundle's declared dependenceis so they // We'll also get the bundle's declared dependencies so they
// can be installed along with the bundle, making it easy // can be installed along with the bundle, making it easy
// to install a group of bundles. // to install a group of bundles.
$dependencies = $this->get($bundle['dependencies']); $dependencies = $this->get($bundle['dependencies']);

View File

@ -27,7 +27,7 @@ protected function zipball($url, $bundle, $path)
// When installing a bundle from a Zip archive, we'll first clone // When installing a bundle from a Zip archive, we'll first clone
// down the bundle zip into the bundles "working" directory so // down the bundle zip into the bundles "working" directory so
// we have a spot to do all of our bundle extration work. // we have a spot to do all of our bundle extraction work.
$target = $work.'laravel-bundle.zip'; $target = $work.'laravel-bundle.zip';
File::put($target, $this->download($url)); File::put($target, $this->download($url));
@ -49,7 +49,7 @@ protected function zipball($url, $bundle, $path)
// Once we have the latest modified directory, we should be // Once we have the latest modified directory, we should be
// able to move its contents over into the bundles folder // able to move its contents over into the bundles folder
// so the bundle will be usable by the develoepr. // so the bundle will be usable by the developer.
File::mvdir($latest, $path); File::mvdir($latest, $path);
File::rmdir($work.'zip'); File::rmdir($work.'zip');

View File

@ -0,0 +1,78 @@
{
"Application Configuration": {
"key:generate": {
"description": "Generate a secure application key.",
"command": "php artisan key:generate"
}
},
"Database Tables": {
"session:table": {
"description": "Generate a migration for the sessions database table.",
"command": "php artisan session:table"
}
},
"Migrations": {
"migrate:install": {
"description": "Create the Laravel migration table.",
"command": "php artisan migrate:install"
},
"migrate:make": {
"description": "Create a migration.",
"command": "php artisan migrate:make create_users_table"
},
"migrate": {
"description": "Run outstanding migrations.",
"command": "php artisan migrate"
},
"migrate:rollback": {
"description": "Roll back the most recent migration.",
"command": "php artisan migrate:rollback"
},
"migrate:reset": {
"description": "Roll back all migrations.",
"command": "php artisan migrate:reset"
}
},
"Bundles": {
"bundle:install": {
"description": "Install a bundle.",
"command": "php artisan bundle:install swiftmailer"
},
"bundle:upgrade": {
"description": "Upgrade a bundle.",
"command": "php artisan bundle:upgrade swiftmailer"
},
"bundle:publish": {
"description": "Publish all bundles' assets.",
"command": "php artisan bundle:publish"
}
},
"Unit Testing": {
"test": {
"description": "Run the application's tests.",
"command": "php artisan test"
}
},
"Routing": {
"route:call": {
"description": "Call a route.",
"command": "php artisan route:call get api/user/1"
}
},
"Application Keys": {
"key:generate": {
"description": "Generate an application key.",
"command": "php artisan key:generade"
}
},
"CLI Options": {
"--env=": {
"description": "Set the Laravel environment.",
"command": "php artisan task --env=local"
},
"--database=": {
"description": "Set the default database connection.",
"command": "php artisan task --database=mysql"
}
}
}

View File

@ -0,0 +1,35 @@
<?php namespace Laravel\CLI\Tasks;
use Laravel\Str;
use Laravel\File;
class Help extends Task {
/**
* List available artisan commands.
*
* @param array $arguments
* @return void
*/
public function commands()
{
// read help contents
$command_data = json_decode(File::get(__DIR__.'/help.json'));
// format and display help contents
$i=0;
foreach($command_data as $category => $commands)
{
if($i++ != 0) echo PHP_EOL;
echo PHP_EOL . "# $category" . PHP_EOL;
foreach($commands as $command => $details)
{
echo PHP_EOL . str_pad($command, 20) . str_pad($details->description, 30);
}
}
}
}

View File

@ -40,7 +40,7 @@ public function last()
$table = $this->table(); $table = $this->table();
// First we need to grab the last batch ID from the migration table, // First we need to grab the last batch ID from the migration table,
// as this will allow us to grab the lastest batch of migrations // as this will allow us to grab the latest batch of migrations
// that need to be run for a rollback command. // that need to be run for a rollback command.
$id = $this->batch(); $id = $this->batch();

View File

@ -151,7 +151,7 @@ public function install()
$table->create(); $table->create();
// Migrations can be run for a specific bundle, so we'll use // Migrations can be run for a specific bundle, so we'll use
// the bundle name and string migration name as an unique ID // the bundle name and string migration name as a unique ID
// for the migrations, allowing us to easily identify which // for the migrations, allowing us to easily identify which
// migrations have been run for each bundle. // migrations have been run for each bundle.
$table->string('bundle', 50); $table->string('bundle', 50);
@ -206,7 +206,7 @@ public function make($arguments = array())
// Once the migration has been created, we'll return the // Once the migration has been created, we'll return the
// migration file name so it can be used by the task // migration file name so it can be used by the task
// consumer if necessary for futher work. // consumer if necessary for further work.
return $file; return $file;
} }
@ -223,7 +223,7 @@ protected function stub($bundle, $migration)
$prefix = Bundle::class_prefix($bundle); $prefix = Bundle::class_prefix($bundle);
// The class name is formatted simialrly to tasks and controllers, // The class name is formatted similarly to tasks and controllers,
// where the bundle name is prefixed to the class if it is not in // where the bundle name is prefixed to the class if it is not in
// the default "application" bundle. // the default "application" bundle.
$class = $prefix.Str::classify($migration); $class = $prefix.Str::classify($migration);

View File

@ -83,7 +83,7 @@ protected function test()
// fix the spaced directories problem when using the command line // fix the spaced directories problem when using the command line
// strings with spaces inside should be wrapped in quotes. // strings with spaces inside should be wrapped in quotes.
$path = escapeshellarg($path) $path = escapeshellarg($path);
passthru('phpunit --configuration '.$path); passthru('phpunit --configuration '.$path);

View File

@ -73,7 +73,7 @@ public static function get($key, $default = null)
$items = static::$items[$bundle][$file]; $items = static::$items[$bundle][$file];
// If a specific configuration item was not requested, the key will be null, // If a specific configuration item was not requested, the key will be null,
// meaning we'll to return the entire array of configuration item from the // meaning we'll return the entire array of configuration items from the
// requested configuration file. Otherwise we can return the item. // requested configuration file. Otherwise we can return the item.
if (is_null($item)) if (is_null($item))
{ {
@ -175,7 +175,7 @@ public static function load($bundle, $file)
// requested. This allows many types of config "drivers". // requested. This allows many types of config "drivers".
$config = Event::first(static::loader, func_get_args()); $config = Event::first(static::loader, func_get_args());
// If configuration items were actually found for the bundle and file we // If configuration items were actually found for the bundle and file, we
// will add them to the configuration array and return true, otherwise // will add them to the configuration array and return true, otherwise
// we will return false indicating the file was not found. // we will return false indicating the file was not found.
if (count($config) > 0) if (count($config) > 0)

View File

@ -3,7 +3,7 @@
class Cookie { class Cookie {
/** /**
* How long is forever (in minutes). * How long is forever (in minutes)?
* *
* @var int * @var int
*/ */
@ -77,7 +77,7 @@ public static function put($name, $value, $expiration = 0, $path = '/', $domain
// If the secure option is set to true, yet the request is not over HTTPS // If the secure option is set to true, yet the request is not over HTTPS
// we'll throw an exception to let the developer know that they are // we'll throw an exception to let the developer know that they are
// attempting to send a secure cookie over the unsecure HTTP. // attempting to send a secure cookie over the insecure HTTP.
if ($secure and ! Request::secure()) if ($secure and ! Request::secure())
{ {
throw new \Exception("Attempting to set secure cookie over HTTP."); throw new \Exception("Attempting to set secure cookie over HTTP.");

View File

@ -147,7 +147,7 @@
| Determine The Application Environment | Determine The Application Environment
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Next we're ready to determine the application environment. This may be | Next, we're ready to determine the application environment. This may be
| set either via the command line options or via the mapping of URIs to | set either via the command line options or via the mapping of URIs to
| environments that lives in the "paths.php" file for the application | environments that lives in the "paths.php" file for the application
| and is parsed. When determining the CLI environment, the "--env" | and is parsed. When determining the CLI environment, the "--env"
@ -178,7 +178,7 @@
| |
| Once we have determined the application environment, we will set it on | Once we have determined the application environment, we will set it on
| the global server array of the HttpFoundation request. This makes it | the global server array of the HttpFoundation request. This makes it
| available throughout the application, thought it is mainly only | available throughout the application, though it is mainly only
| used to determine which configuration files to merge in. | used to determine which configuration files to merge in.
| |
*/ */
@ -216,7 +216,7 @@
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Finally we will register all of the bundles that have been defined for | Finally we will register all of the bundles that have been defined for
| the application. None of them will be started yet, but will be setup | the application. None of them will be started yet, but will be set up
| so that they may be started by the developer at any time. | so that they may be started by the developer at any time.
| |
*/ */

View File

@ -1,5 +1,6 @@
<?php namespace Laravel; <?php namespace Laravel;
use Closure;
use Laravel\Database\Expression; use Laravel\Database\Expression;
use Laravel\Database\Connection; use Laravel\Database\Connection;

View File

@ -185,7 +185,7 @@ public function query($sql, $bindings = array())
// The result we return depends on the type of query executed against the // The result we return depends on the type of query executed against the
// database. On SELECT clauses, we will return the result set, for update // database. On SELECT clauses, we will return the result set, for update
// and deletes we will return the affected row count. // and deletes we will return the affected row count.
if (stripos($sql, 'select') === 0) if (stripos($sql, 'select') === 0 || stripos($sql, 'show') === 0)
{ {
return $this->fetch($statement, Config::get('database.fetch')); return $this->fetch($statement, Config::get('database.fetch'));
} }
@ -209,7 +209,7 @@ public function query($sql, $bindings = array())
/** /**
* Execute a SQL query against the connection. * Execute a SQL query against the connection.
* *
* The PDO statement and boolean result will be return in an array. * The PDO statement and boolean result will be returned in an array.
* *
* @param string $sql * @param string $sql
* @param array $bindings * @param array $bindings
@ -265,7 +265,7 @@ protected function execute($sql, $bindings = array())
throw $exception; throw $exception;
} }
// Once we have execute the query, we log the SQL, bindings, and // Once we have executed the query, we log the SQL, bindings, and
// execution time in a static array that is accessed by all of // execution time in a static array that is accessed by all of
// the connections actively being used by the application. // the connections actively being used by the application.
if (Config::get('database.profile')) if (Config::get('database.profile'))
@ -287,7 +287,7 @@ protected function fetch($statement, $style)
{ {
// If the fetch style is "class", we'll hydrate an array of PHP // If the fetch style is "class", we'll hydrate an array of PHP
// stdClass objects as generic containers for the query rows, // stdClass objects as generic containers for the query rows,
// otherwise we'll just use the fetch styel value. // otherwise we'll just use the fetch style value.
if ($style === PDO::FETCH_CLASS) if ($style === PDO::FETCH_CLASS)
{ {
return $statement->fetchAll(PDO::FETCH_CLASS, 'stdClass'); return $statement->fetchAll(PDO::FETCH_CLASS, 'stdClass');

View File

@ -44,6 +44,13 @@ public function connect($config)
$connection->prepare("SET NAMES '{$config['charset']}'")->execute(); $connection->prepare("SET NAMES '{$config['charset']}'")->execute();
} }
// If a schema has been specified, we'll execute a query against
// the database to set the search path.
if (isset($config['schema']))
{
$connection->prepare("SET search_path TO '{$config['schema']}'")->execute();
}
return $connection; return $connection;
} }

View File

@ -257,26 +257,21 @@ public function _with($includes)
{ {
$includes = (array) $includes; $includes = (array) $includes;
$all_includes = array(); $this->includes = array();
foreach($includes as $include) foreach ($includes as $relationship => $constraints)
{ {
$nested = explode('.', $include); // When eager loading relationships, constraints may be set on the eager
// load definition; however, is none are set, we need to swap the key
$inc = array(); // and the value of the array since there are no constraints.
if (is_numeric($relationship))
foreach($nested as $relation)
{ {
$inc[] = $relation; list($relationship, $constraints) = array($constraints, null);
$all_includes[] = implode('.', $inc);
} }
$this->includes[$relationship] = $constraints;
} }
//remove duplicates and reset the array keys.
$this->includes = array_values(array_unique($all_includes));
return $this; return $this;
} }
@ -758,7 +753,7 @@ public function __call($method, $parameters)
{ {
$meta = array('key', 'table', 'connection', 'sequence', 'per_page', 'timestamps'); $meta = array('key', 'table', 'connection', 'sequence', 'per_page', 'timestamps');
// If the method is actually the name of a static property on the model we'll // If the method is actually the name of a static property on the model, we'll
// return the value of the static property. This makes it convenient for // return the value of the static property. This makes it convenient for
// relationships to access these values off of the instances. // relationships to access these values off of the instances.
if (in_array($method, $meta)) if (in_array($method, $meta))
@ -768,7 +763,7 @@ public function __call($method, $parameters)
$underscored = array('with', 'find'); $underscored = array('with', 'find');
// Some methods need to be accessed both staticly and non-staticly so we'll // Some methods need to be accessed both statically and non-statically so we'll
// keep underscored methods of those methods and intercept calls to them // keep underscored methods of those methods and intercept calls to them
// here so they can be called either way on the model instance. // here so they can be called either way on the model instance.
if (in_array($method, $underscored)) if (in_array($method, $underscored))

View File

@ -38,7 +38,7 @@ class Query {
); );
/** /**
* Creat a new query instance for a model. * Create a new query instance for a model.
* *
* @param Model $model * @param Model $model
* @return void * @return void
@ -118,7 +118,7 @@ public function hydrate($model, $results)
$new = new $class(array(), true); $new = new $class(array(), true);
// We need to set the attributes manually in case the accessible property is // We need to set the attributes manually in case the accessible property is
// set on the array which will prevent the mass assignemnt of attributes if // set on the array which will prevent the mass assignment of attributes if
// we were to pass them in using the constructor or fill methods. // we were to pass them in using the constructor or fill methods.
$new->fill_raw($result); $new->fill_raw($result);
@ -141,7 +141,7 @@ public function hydrate($model, $results)
} }
} }
// The many to many relationships may have pivot table column on them // The many to many relationships may have pivot table columns on them
// so we will call the "clean" method on the relationship to remove // so we will call the "clean" method on the relationship to remove
// any pivot columns that are on the model. // any pivot columns that are on the model.
if ($this instanceof Relationships\Has_Many_And_Belongs_To) if ($this instanceof Relationships\Has_Many_And_Belongs_To)
@ -199,7 +199,7 @@ protected function nested_includes($relationship)
foreach ($this->model_includes() as $include => $constraints) foreach ($this->model_includes() as $include => $constraints)
{ {
// To get the nested includes, we want to find any includes that begin // To get the nested includes, we want to find any includes that begin
// the relationship and a dot, then we will strip off the leading // the relationship with a dot, then we will strip off the leading
// nesting indicator and set the include in the array. // nesting indicator and set the include in the array.
if (starts_with($include, $relationship.'.')) if (starts_with($include, $relationship.'.'))
{ {
@ -217,22 +217,23 @@ protected function nested_includes($relationship)
*/ */
protected function model_includes() protected function model_includes()
{ {
$includes = array(); $relationships = array_keys($this->model->includes);
$implicits = array();
foreach ($this->model->includes as $relationship => $constraints) foreach ($relationships as $relationship)
{ {
// When eager loading relationships, constraints may be set on the eager $parts = explode('.', $relationship);
// load definition; however, is none are set, we need to swap the key
// and the value of the array since there are no constraints. $prefix = '';
if (is_numeric($relationship)) foreach ($parts as $part)
{ {
list($relationship, $constraints) = array($constraints, null); $implicits[$prefix.$part] = NULL;
$prefix .= $part.'.';
}
} }
$includes[$relationship] = $constraints; // Add all implicit includes to the explicit ones
} return $this->model->includes + $implicits;
return $includes;
} }
/** /**

View File

@ -44,7 +44,7 @@ public function __construct($model, $associated, $table, $foreign, $other)
$this->joining = $table ?: $this->joining($model, $associated); $this->joining = $table ?: $this->joining($model, $associated);
// If the Pivot table is timestamped, we'll set the timestamp columns to be // If the Pivot table is timestamped, we'll set the timestamp columns to be
// fetched when the pivot table models are fetched by the developer else // fetched when the pivot table models are fetched by the developer, or else
// the ID will be the only "extra" column fetched in by default. // the ID will be the only "extra" column fetched in by default.
if (Pivot::$timestamps) if (Pivot::$timestamps)
{ {
@ -131,7 +131,7 @@ public function sync($ids)
} }
// Next we will take the difference of the current and given IDs and detach // Next we will take the difference of the current and given IDs and detach
// all of the entities that exists in the current array but are not in // all of the entities that exist in the current array but are not in
// the array of IDs given to the method, finishing the sync. // the array of IDs given to the method, finishing the sync.
$detach = array_diff($current, $ids); $detach = array_diff($current, $ids);

View File

@ -35,7 +35,7 @@ public function __construct(Connection $connection)
*/ */
public function wrap_table($table) public function wrap_table($table)
{ {
// Expressions should be injected into the query as raw strings so // Expressions should be injected into the query as raw strings
// so we do not want to wrap them in any way. We will just return // so we do not want to wrap them in any way. We will just return
// the string value from the expression to be included. // the string value from the expression to be included.
if ($table instanceof Expression) if ($table instanceof Expression)
@ -64,7 +64,7 @@ public function wrap_table($table)
*/ */
public function wrap($value) public function wrap($value)
{ {
// Expressions should be injected into the query as raw strings so // Expressions should be injected into the query as raw strings
// so we do not want to wrap them in any way. We will just return // so we do not want to wrap them in any way. We will just return
// the string value from the expression to be included. // the string value from the expression to be included.
if ($value instanceof Expression) if ($value instanceof Expression)

View File

@ -2,7 +2,7 @@
use Closure; use Closure;
use Laravel\Database; use Laravel\Database;
use Laravel\Paginator; use Paginator;
use Laravel\Database\Query\Grammars\Postgres; use Laravel\Database\Query\Grammars\Postgres;
use Laravel\Database\Query\Grammars\SQLServer; use Laravel\Database\Query\Grammars\SQLServer;
@ -158,7 +158,7 @@ public function join($table, $column1, $operator = null, $column2 = null, $type
{ {
// If the "column" is really an instance of a Closure, the developer is // If the "column" is really an instance of a Closure, the developer is
// trying to create a join with a complex "ON" clause. So, we will add // trying to create a join with a complex "ON" clause. So, we will add
// the join, and then call the Closure with the join/ // the join, and then call the Closure with the join.
if ($column1 instanceof Closure) if ($column1 instanceof Closure)
{ {
$this->joins[] = new Query\Join($type, $table); $this->joins[] = new Query\Join($type, $table);
@ -168,7 +168,7 @@ public function join($table, $column1, $operator = null, $column2 = null, $type
// If the column is just a string, we can assume that the join just // If the column is just a string, we can assume that the join just
// has a simple on clause, and we'll create the join instance and // has a simple on clause, and we'll create the join instance and
// add the clause automatically for the develoepr. // add the clause automatically for the developer.
else else
{ {
$join = new Query\Join($type, $table); $join = new Query\Join($type, $table);
@ -436,7 +436,7 @@ private function dynamic_where($method, $parameters)
foreach ($segments as $segment) foreach ($segments as $segment)
{ {
// If the segment is not a boolean connector, we can assume it it is // If the segment is not a boolean connector, we can assume it is
// a column name, and we'll add it to the query as a new constraint // a column name, and we'll add it to the query as a new constraint
// of the query's where clause and keep iterating the segments. // of the query's where clause and keep iterating the segments.
if ($segment != '_and_' and $segment != '_or_') if ($segment != '_and_' and $segment != '_or_')
@ -659,7 +659,7 @@ public function get($columns = array('*'))
public function aggregate($aggregator, $columns) public function aggregate($aggregator, $columns)
{ {
// We'll set the aggregate value so the grammar does not try to compile // We'll set the aggregate value so the grammar does not try to compile
// a SELECT clause on the query. If an aggregator is present, it's own // a SELECT clause on the query. If an aggregator is present, its own
// grammar function will be used to build the SQL syntax. // grammar function will be used to build the SQL syntax.
$this->aggregate = compact('aggregator', 'columns'); $this->aggregate = compact('aggregator', 'columns');
@ -686,7 +686,7 @@ public function paginate($per_page = 20, $columns = array('*'))
{ {
// Because some database engines may throw errors if we leave orderings // Because some database engines may throw errors if we leave orderings
// on the query when retrieving the total number of records, we'll drop // on the query when retrieving the total number of records, we'll drop
// all of the ordreings and put them back on the query. // all of the orderings and put them back on the query.
list($orderings, $this->orderings) = array($this->orderings, null); list($orderings, $this->orderings) = array($this->orderings, null);
$total = $this->count(reset($columns)); $total = $this->count(reset($columns));
@ -713,12 +713,12 @@ public function insert($values)
{ {
// Force every insert to be treated like a batch insert to make creating // Force every insert to be treated like a batch insert to make creating
// the binding array simpler since we can just spin through the inserted // the binding array simpler since we can just spin through the inserted
// rows as if there/ was more than one every time. // rows as if there was more than one every time.
if ( ! is_array(reset($values))) $values = array($values); if ( ! is_array(reset($values))) $values = array($values);
$bindings = array(); $bindings = array();
// We need to merge the the insert values into the array of the query // We need to merge the insert values into the array of the query
// bindings so that they will be bound to the PDO statement when it // bindings so that they will be bound to the PDO statement when it
// is executed by the database connection. // is executed by the database connection.
foreach ($values as $value) foreach ($values as $value)
@ -819,7 +819,7 @@ public function update($values)
/** /**
* Execute the query as a DELETE statement. * Execute the query as a DELETE statement.
* *
* Optionally, an ID may be passed to the method do delete a specific row. * Optionally, an ID may be passed to the method to delete a specific row.
* *
* @param int $id * @param int $id
* @return int * @return int
@ -852,7 +852,7 @@ public function __call($method, $parameters)
} }
// All of the aggregate methods are handled by a single method, so we'll // All of the aggregate methods are handled by a single method, so we'll
// catch them all here and then pass them off to the agregate method // catch them all here and then pass them off to the aggregate method
// instead of creating methods for each one of them. // instead of creating methods for each one of them.
if (in_array($method, array('count', 'min', 'max', 'avg', 'sum'))) if (in_array($method, array('count', 'min', 'max', 'avg', 'sum')))
{ {

View File

@ -13,7 +13,7 @@ class Grammar extends \Laravel\Database\Grammar {
public $datetime = 'Y-m-d H:i:s'; public $datetime = 'Y-m-d H:i:s';
/** /**
* All of the query componenets in the order they should be built. * All of the query components in the order they should be built.
* *
* @var array * @var array
*/ */
@ -125,7 +125,7 @@ protected function from(Query $query)
protected function joins(Query $query) protected function joins(Query $query)
{ {
// We need to iterate through each JOIN clause that is attached to the // We need to iterate through each JOIN clause that is attached to the
// query an translate it into SQL. The table and the columns will be // query and translate it into SQL. The table and the columns will be
// wrapped in identifiers to avoid naming collisions. // wrapped in identifiers to avoid naming collisions.
foreach ($query->joins as $join) foreach ($query->joins as $join)
{ {
@ -135,7 +135,7 @@ protected function joins(Query $query)
// Each JOIN statement may have multiple clauses, so we will iterate // Each JOIN statement may have multiple clauses, so we will iterate
// through each clause creating the conditions then we'll join all // through each clause creating the conditions then we'll join all
// of the together at the end to build the clause. // of them together at the end to build the clause.
foreach ($join->clauses as $clause) foreach ($join->clauses as $clause)
{ {
extract($clause); extract($clause);
@ -149,7 +149,7 @@ protected function joins(Query $query)
// The first clause will have a connector on the front, but it is // The first clause will have a connector on the front, but it is
// not needed on the first condition, so we will strip it off of // not needed on the first condition, so we will strip it off of
// the condition before adding it to the arrya of joins. // the condition before adding it to the array of joins.
$search = array('AND ', 'OR '); $search = array('AND ', 'OR ');
$clauses[0] = str_replace($search, '', $clauses[0]); $clauses[0] = str_replace($search, '', $clauses[0]);
@ -343,7 +343,7 @@ protected function offset(Query $query)
} }
/** /**
* Compile a SQL INSERT statment from a Query instance. * Compile a SQL INSERT statement from a Query instance.
* *
* This method handles the compilation of single row inserts and batch inserts. * This method handles the compilation of single row inserts and batch inserts.
* *
@ -366,7 +366,7 @@ public function insert(Query $query, $values)
$columns = $this->columnize(array_keys(reset($values))); $columns = $this->columnize(array_keys(reset($values)));
// Build the list of parameter place-holders of values bound to the query. // Build the list of parameter place-holders of values bound to the query.
// Each insert should have the same number of bound paramters, so we can // Each insert should have the same number of bound parameters, so we can
// just use the first array of values. // just use the first array of values.
$parameters = $this->parameterize(reset($values)); $parameters = $this->parameterize(reset($values));
@ -376,7 +376,7 @@ public function insert(Query $query, $values)
} }
/** /**
* Compile a SQL INSERT and get ID statment from a Query instance. * Compile a SQL INSERT and get ID statement from a Query instance.
* *
* @param Query $query * @param Query $query
* @param array $values * @param array $values
@ -389,7 +389,7 @@ public function insert_get_id(Query $query, $values, $column)
} }
/** /**
* Compile a SQL UPDATE statment from a Query instance. * Compile a SQL UPDATE statement from a Query instance.
* *
* @param Query $query * @param Query $query
* @param array $values * @param array $values
@ -410,13 +410,13 @@ public function update(Query $query, $values)
$columns = implode(', ', $columns); $columns = implode(', ', $columns);
// UPDATE statements may be constrained by a WHERE clause, so we'll run // UPDATE statements may be constrained by a WHERE clause, so we'll run
// the entire where compilation process for those contraints. This is // the entire where compilation process for those constraints. This is
// easily achieved by passing it to the "wheres" method. // easily achieved by passing it to the "wheres" method.
return trim("UPDATE {$table} SET {$columns} ".$this->wheres($query)); return trim("UPDATE {$table} SET {$columns} ".$this->wheres($query));
} }
/** /**
* Compile a SQL DELETE statment from a Query instance. * Compile a SQL DELETE statement from a Query instance.
* *
* @param Query $query * @param Query $query
* @return string * @return string

View File

@ -5,7 +5,7 @@
class Postgres extends Grammar { class Postgres extends Grammar {
/** /**
* Compile a SQL INSERT and get ID statment from a Query instance. * Compile a SQL INSERT and get ID statement from a Query instance.
* *
* @param Query $query * @param Query $query
* @param array $values * @param array $values

View File

@ -95,7 +95,7 @@ protected function ansi_offset(Query $query, $components)
// Next we need to calculate the constraint that should be placed on // Next we need to calculate the constraint that should be placed on
// the row number to get the correct offset and limit on the query. // the row number to get the correct offset and limit on the query.
// If there is not limit, we'll just handle the offset. // If there is not a limit, we'll just handle the offset.
if ($query->limit > 0) if ($query->limit > 0)
{ {
$finish = $query->offset + $query->limit; $finish = $query->offset + $query->limit;

View File

@ -40,6 +40,25 @@ public static function create($table, $callback)
return static::execute($table); return static::execute($table);
} }
/**
* Rename a database table in the schema.
*
* @param string $table
* @param string $name
* @return void
*/
public static function rename($table, $new_name)
{
$table = new Schema\Table($table);
// To indicate that the table needs to be renamed, we will run the
// "rename" command on the table instance and pass the instance to
// the execute method as calling a Closure isn't needed.
$table->rename($new_name);
return static::execute($table);
}
/** /**
* Drop a database table from the schema. * Drop a database table from the schema.
* *
@ -71,7 +90,7 @@ public static function execute($table)
{ {
// The implications method is responsible for finding any fluently // The implications method is responsible for finding any fluently
// defined indexes on the schema table and adding the explicit // defined indexes on the schema table and adding the explicit
// commands that are needed to tbe schema instance. // commands that are needed for the schema instance.
static::implications($table); static::implications($table);
foreach ($table->commands as $command) foreach ($table->commands as $command)

View File

@ -96,4 +96,19 @@ protected function type(Fluent $column)
return $this->{'type_'.$column->type}($column); return $this->{'type_'.$column->type}($column);
} }
/**
* Format a value so that it can be used in SQL DEFAULT clauses.
* @param mixed $value
* @return string
*/
protected function default_value($value)
{
if (is_bool($value))
{
return intval($value);
}
return strval($value);
}
} }

View File

@ -37,7 +37,7 @@ public function create(Table $table, Fluent $command)
} }
/** /**
* Geenrate the SQL statements for a table modification command. * Generate the SQL statements for a table modification command.
* *
* @param Table $table * @param Table $table
* @param Fluent $command * @param Fluent $command
@ -47,7 +47,7 @@ public function add(Table $table, Fluent $command)
{ {
$columns = $this->columns($table); $columns = $this->columns($table);
// Once we the array of column definitions, we need to add "add" to the // Once we have the array of column definitions, we need to add "add" to the
// front of each definition, then we'll concatenate the definitions // front of each definition, then we'll concatenate the definitions
// using commas like normal and generate the SQL. // using commas like normal and generate the SQL.
$columns = implode(', ', array_map(function($column) $columns = implode(', ', array_map(function($column)
@ -128,7 +128,7 @@ protected function defaults(Table $table, Fluent $column)
{ {
if ( ! is_null($column->default)) if ( ! is_null($column->default))
{ {
return " DEFAULT '".$column->default."'"; return " DEFAULT '".$this->default_value($column->default)."'";
} }
} }
@ -212,6 +212,18 @@ protected function key(Table $table, Fluent $command, $type)
return 'ALTER TABLE '.$this->wrap($table)." ADD {$type} {$name}({$keys})"; return 'ALTER TABLE '.$this->wrap($table)." ADD {$type} {$name}({$keys})";
} }
/**
* Generate the SQL statement for a rename table command.
*
* @param Table $table
* @param Fluent $command
* @return string
*/
public function rename(Table $table, Fluent $command)
{
return 'RENAME TABLE '.$this->wrap($table).' TO '.$this->wrap($command->name);
}
/** /**
* Generate the SQL statement for a drop table command. * Generate the SQL statement for a drop table command.
* *
@ -284,7 +296,7 @@ public function drop_fulltext(Table $table, Fluent $command)
} }
/** /**
* Generate the SQL statement for a drop unqique key command. * Generate the SQL statement for a drop unique key command.
* *
* @param Table $table * @param Table $table
* @param Fluent $command * @param Fluent $command
@ -353,7 +365,7 @@ protected function type_float(Fluent $column)
} }
/** /**
* Generate the data-type definintion for a decimal. * Generate the data-type definition for a decimal.
* *
* @param Fluent $column * @param Fluent $column
* @return string * @return string

View File

@ -25,7 +25,7 @@ public function create(Table $table, Fluent $command)
} }
/** /**
* Geenrate the SQL statements for a table modification command. * Generate the SQL statements for a table modification command.
* *
* @param Table $table * @param Table $table
* @param Fluent $command * @param Fluent $command
@ -35,7 +35,7 @@ public function add(Table $table, Fluent $command)
{ {
$columns = $this->columns($table); $columns = $this->columns($table);
// Once we the array of column definitions, we need to add "add" to the // Once we have the array of column definitions, we need to add "add" to the
// front of each definition, then we'll concatenate the definitions // front of each definition, then we'll concatenate the definitions
// using commas like normal and generate the SQL. // using commas like normal and generate the SQL.
$columns = implode(', ', array_map(function($column) $columns = implode(', ', array_map(function($column)
@ -101,7 +101,7 @@ protected function defaults(Table $table, Fluent $column)
{ {
if ( ! is_null($column->default)) if ( ! is_null($column->default))
{ {
return " DEFAULT '".$column->default."'"; return " DEFAULT '".$this->default_value($column->default)."'";
} }
} }
@ -198,6 +198,18 @@ protected function key(Table $table, Fluent $command, $unique = false)
return $create." INDEX {$command->name} ON ".$this->wrap($table)." ({$columns})"; return $create." INDEX {$command->name} ON ".$this->wrap($table)." ({$columns})";
} }
/**
* Generate the SQL statement for a rename table command.
*
* @param Table $table
* @param Fluent $command
* @return string
*/
public function rename(Table $table, Fluent $command)
{
return 'ALTER TABLE '.$this->wrap($table).' RENAME TO '.$this->wrap($command->name);
}
/** /**
* Generate the SQL statement for a drop table command. * Generate the SQL statement for a drop table command.
* *
@ -246,7 +258,7 @@ public function drop_primary(Table $table, Fluent $command)
} }
/** /**
* Generate the SQL statement for a drop unqique key command. * Generate the SQL statement for a drop unique key command.
* *
* @param Table $table * @param Table $table
* @param Fluent $command * @param Fluent $command
@ -339,7 +351,7 @@ protected function type_float(Fluent $column)
} }
/** /**
* Generate the data-type definintion for a decimal. * Generate the data-type definition for a decimal.
* *
* @param Fluent $column * @param Fluent $column
* @return string * @return string

View File

@ -29,7 +29,7 @@ public function create(Table $table, Fluent $command)
return $value->type == 'primary'; return $value->type == 'primary';
}); });
// If we found primary key in the array of commands, we'll create the SQL for // If we found primary keys in the array of commands, we'll create the SQL for
// the key addition and append it to the SQL table creation statement for // the key addition and append it to the SQL table creation statement for
// the schema table so the index is properly generated. // the schema table so the index is properly generated.
if ( ! is_null($primary)) if ( ! is_null($primary))
@ -43,7 +43,7 @@ public function create(Table $table, Fluent $command)
} }
/** /**
* Geenrate the SQL statements for a table modification command. * Generate the SQL statements for a table modification command.
* *
* @param Table $table * @param Table $table
* @param Fluent $command * @param Fluent $command
@ -53,7 +53,7 @@ public function add(Table $table, Fluent $command)
{ {
$columns = $this->columns($table); $columns = $this->columns($table);
// Once we the array of column definitions, we need to add "add" to the // Once we have the array of column definitions, we need to add "add" to the
// front of each definition, then we'll concatenate the definitions // front of each definition, then we'll concatenate the definitions
// using commas like normal and generate the SQL. // using commas like normal and generate the SQL.
$columns = array_map(function($column) $columns = array_map(function($column)
@ -87,7 +87,7 @@ protected function columns(Table $table)
{ {
// Each of the data type's have their own definition creation method // Each of the data type's have their own definition creation method
// which is responsible for creating the SQL for the type. This lets // which is responsible for creating the SQL for the type. This lets
// us to keep the syntax easy and fluent, while translating the // us keep the syntax easy and fluent, while translating the
// types to the types used by the database. // types to the types used by the database.
$sql = $this->wrap($column).' '.$this->type($column); $sql = $this->wrap($column).' '.$this->type($column);
@ -127,7 +127,7 @@ protected function defaults(Table $table, Fluent $column)
{ {
if ( ! is_null($column->default)) if ( ! is_null($column->default))
{ {
return ' DEFAULT '.$this->wrap($column->default); return ' DEFAULT '.$this->wrap($this->default_value($column->default));
} }
} }
@ -201,6 +201,18 @@ protected function key(Table $table, Fluent $command, $unique = false)
return $create." INDEX {$command->name} ON ".$this->wrap($table)." ({$columns})"; return $create." INDEX {$command->name} ON ".$this->wrap($table)." ({$columns})";
} }
/**
* Generate the SQL statement for a rename table command.
*
* @param Table $table
* @param Fluent $command
* @return string
*/
public function rename(Table $table, Fluent $command)
{
return 'ALTER TABLE '.$this->wrap($table).' RENAME TO '.$this->wrap($command->name);
}
/** /**
* Generate the SQL statement for a drop table command. * Generate the SQL statement for a drop table command.
* *
@ -214,7 +226,7 @@ public function drop(Table $table, Fluent $command)
} }
/** /**
* Generate the SQL statement for a drop unqique key command. * Generate the SQL statement for a drop unique key command.
* *
* @param Table $table * @param Table $table
* @param Fluent $command * @param Fluent $command
@ -226,7 +238,7 @@ public function drop_unique(Table $table, Fluent $command)
} }
/** /**
* Generate the SQL statement for a drop unqique key command. * Generate the SQL statement for a drop unique key command.
* *
* @param Table $table * @param Table $table
* @param Fluent $command * @param Fluent $command
@ -283,7 +295,7 @@ protected function type_float(Fluent $column)
} }
/** /**
* Generate the data-type definintion for a decimal. * Generate the data-type definition for a decimal.
* *
* @param Fluent $column * @param Fluent $column
* @return string * @return string

View File

@ -32,7 +32,7 @@ public function create(Table $table, Fluent $command)
} }
/** /**
* Geenrate the SQL statements for a table modification command. * Generate the SQL statements for a table modification command.
* *
* @param Table $table * @param Table $table
* @param Fluent $command * @param Fluent $command
@ -42,7 +42,7 @@ public function add(Table $table, Fluent $command)
{ {
$columns = $this->columns($table); $columns = $this->columns($table);
// Once we the array of column definitions, we need to add "add" to the // Once we have the array of column definitions, we need to add "add" to the
// front of each definition, then we'll concatenate the definitions // front of each definition, then we'll concatenate the definitions
// using commas like normal and generate the SQL. // using commas like normal and generate the SQL.
$columns = implode(', ', array_map(function($column) $columns = implode(', ', array_map(function($column)
@ -108,7 +108,7 @@ protected function defaults(Table $table, Fluent $column)
{ {
if ( ! is_null($column->default)) if ( ! is_null($column->default))
{ {
return " DEFAULT '".$column->default."'"; return " DEFAULT '".$this->default_value($column->default)."'";
} }
} }
@ -212,6 +212,18 @@ protected function key(Table $table, Fluent $command, $unique = false)
return $create." INDEX {$command->name} ON ".$this->wrap($table)." ({$columns})"; return $create." INDEX {$command->name} ON ".$this->wrap($table)." ({$columns})";
} }
/**
* Generate the SQL statement for a rename table command.
*
* @param Table $table
* @param Fluent $command
* @return string
*/
public function rename(Table $table, Fluent $command)
{
return 'ALTER TABLE '.$this->wrap($table).' RENAME TO '.$this->wrap($command->name);
}
/** /**
* Generate the SQL statement for a drop table command. * Generate the SQL statement for a drop table command.
* *
@ -235,7 +247,7 @@ public function drop_column(Table $table, Fluent $command)
{ {
$columns = array_map(array($this, 'wrap'), $command->columns); $columns = array_map(array($this, 'wrap'), $command->columns);
// Once we the array of column names, we need to add "drop" to the front // Once we have the array of column names, we need to add "drop" to the front
// of each column, then we'll concatenate the columns using commas and // of each column, then we'll concatenate the columns using commas and
// generate the alter statement SQL. // generate the alter statement SQL.
$columns = implode(', ', array_map(function($column) $columns = implode(', ', array_map(function($column)
@ -260,7 +272,7 @@ public function drop_primary(Table $table, Fluent $command)
} }
/** /**
* Generate the SQL statement for a drop unqiue key command. * Generate the SQL statement for a drop unique key command.
* *
* @param Table $table * @param Table $table
* @param Fluent $command * @param Fluent $command
@ -357,7 +369,7 @@ protected function type_float(Fluent $column)
} }
/** /**
* Generate the data-type definintion for a decimal. * Generate the data-type definition for a decimal.
* *
* @param Fluent $column * @param Fluent $column
* @return string * @return string

View File

@ -144,6 +144,17 @@ public function key($type, $columns, $name)
return $this->command($type, compact('name', 'columns')); return $this->command($type, compact('name', 'columns'));
} }
/**
* Rename the database table.
*
* @param string $name
* @return Fluent
*/
public function rename($name)
{
return $this->command(__FUNCTION__, compact('name'));
}
/** /**
* Drop the database table. * Drop the database table.
* *

View File

@ -2,6 +2,7 @@ # Artisan Commands
## Contents ## Contents
- [Help](#help)
- [Application Configuration](#application-configuration) - [Application Configuration](#application-configuration)
- [Sessions](#sessions) - [Sessions](#sessions)
- [Migrations](#migrations) - [Migrations](#migrations)
@ -12,6 +13,13 @@ ## Contents
- [Application Keys](#keys) - [Application Keys](#keys)
- [CLI Options](#cli-options) - [CLI Options](#cli-options)
<a name="help"></a>
## Help
Description | Command
------------- | -------------
View a list of available artisan commands. | `php artisan help:commands`
<a name="application-configuration"></a> <a name="application-configuration"></a>
## Application Configuration <small>[(More Information)](/docs/install#basic-configuration)</small> ## Application Configuration <small>[(More Information)](/docs/install#basic-configuration)</small>

View File

@ -21,7 +21,7 @@ ## The Basics
<a name="creating-and-registering"></a> <a name="creating-and-registering"></a>
## Creating Bundles ## Creating Bundles
The first step in creating a bundle is to create a folder for the bundle within your **bundles** directory. For this example, let's create an "admin" bundle, which could house the administrator back-end to our application. The **application/start.php** file provides some basic configuration that helps to define how our application will run. Likewise we'll create a **start.php** file within our new bundle folder for the same purpose. It is run everytime the bundle is loaded. Let's create it: The first step in creating a bundle is to create a folder for the bundle within your **bundles** directory. For this example, let's create an "admin" bundle, which could house the administrator back-end to our application. The **application/start.php** file provides some basic configuration that helps to define how our application will run. Likewise we'll create a **start.php** file within our new bundle folder for the same purpose. It is run every time the bundle is loaded. Let's create it:
#### Creating a bundle start.php file: #### Creating a bundle start.php file:

View File

@ -38,6 +38,7 @@ ## Laravel 3.2.4
- Speed up many to many eager loading mapping. - Speed up many to many eager loading mapping.
- Tweak the Eloquent::changed() method. - Tweak the Eloquent::changed() method.
- Added support for locales in the URI.
<a name="upgrade-3.2.3"></a> <a name="upgrade-3.2.3"></a>
## Upgrading From 3.2.3 ## Upgrading From 3.2.3

View File

@ -18,7 +18,8 @@ ### General
- [Route Groups](/docs/routing#groups) - [Route Groups](/docs/routing#groups)
- [Named Routes](/docs/routing#named-routes) - [Named Routes](/docs/routing#named-routes)
- [HTTPS Routes](/docs/routing#https-routes) - [HTTPS Routes](/docs/routing#https-routes)
- [Bundle Routing](/docs/routing#bundle-routing) - [Bundle Routes](/docs/routing#bundle-routes)
- [Controller Routing](/docs/routing#controller-routing)
- [CLI Route Testing](/docs/routing#cli-route-testing) - [CLI Route Testing](/docs/routing#cli-route-testing)
- [Controllers](/docs/controllers) - [Controllers](/docs/controllers)
- [The Basics](/docs/controllers#the-basics) - [The Basics](/docs/controllers#the-basics)
@ -109,3 +110,9 @@ ### Artisan CLI
- [Bundle Tasks](/docs/artisan/tasks#bundle-tasks) - [Bundle Tasks](/docs/artisan/tasks#bundle-tasks)
- [CLI Options](/docs/artisan/tasks#cli-options) - [CLI Options](/docs/artisan/tasks#cli-options)
- [Commands](/docs/artisan/commands) - [Commands](/docs/artisan/commands)
### Contributing
- [Laravel on GitHub](docs/contrib/github)
- [Command Line](docs/contrib/command-line)
- [TortoiseGit](docs/contrib/tortoisegit)

View File

@ -0,0 +1,127 @@
# Contributing to Laravel via Command-Line
## Contents
- [Getting Started](#getting-started)
- [Forking Laravel](#forking-laravel)
- [Cloning Laravel](#cloning-laravel)
- [Adding your Fork](#adding-your-fork)
- [Creating Branches](#creating-branches)
- [Committing](#committing)
- [Submitting a Pull Request](#submitting-a-pull-request)
- [What's Next?](#whats-next)
<a name='getting-started'></a>
## Getting Started
This tutorial explains the basics of contributing to a project on [GitHub](https://github.com/) via the command-line. The workflow can apply to most projects on GitHub, but in this case, we will be focused on the [Laravel](https://github.com/laravel/laravel) project. This tutorial is applicable to OSX, Linux and Windows.
This tutorial assumes you have installed [Git](http://git-scm.com/) and you have created a [GitHub account](https://github.com/signup/free). If you haven't already, look at the [Laravel on GitHub](/docs/contrib/github) documentation in order to familiarize yourself with Laravel's repositories and branches.
<a name='forking-laravel'></a>
## Forking Laravel
Login to GitHub and visit the [Laravel Repository](https://github.com/laravel/laravel). Click on the **Fork** button. This will create your own fork of Laravel in your own GitHub account. Your Laravel fork will be located at **https://github.com/username/laravel** (your GitHub username will be used in place of *username*).
<a name='cloning-laravel'></a>
## Cloning Laravel
Open up the command-line or terminal and make a new directory where you can make development changes to Laravel:
# mkdir laravel-develop
# cd laravel-develop
Next, clone the Laravel repository (not your fork you made):
# git clone https://github.com/laravel/laravel.git .
> **Note**: The reason you are cloning the original Laravel repository (and not the fork you made) is so you can always pull down the most recent changes from the Laravel repository to your local repository.
<a name='adding-your-fork'></a>
## Adding your Fork
Next, it's time to add the fork you made as a **remote repository**:
# git remote add fork git@github.com:username/laravel.git
Remember to replace *username** with your GitHub username. *This is case-sensitive*. You can verify that your fork was added by typing:
# git remote
Now you have a pristine clone of the Laravel repository along with your fork as a remote repository. You are ready to begin branching for new features or fixing bugs.
<a name='creating-branches'></a>
## Creating Branches
First, make sure you are working in the **develop** branch. If you submit changes to the **master** branch, it is unlikely they will be pulled in anytime in the near future. For more information on this, read the documentation for [Laravel on GitHub](/docs/contrib/github). To switch to the develop branch:
# git checkout develop
Next, you want to make sure you are up-to-date with the latest Laravel repository. If any new features or bug fixes have been added to the Laravel project since you cloned it, this will ensure that your local repository has all of those changes. This important step is the reason we originally cloned the Laravel repository instead of your own fork.
# git pull origin develop
Now you are ready to create a new branch for your new feature or bug-fix. When you create a new branch, use a self-descriptive naming convention. For example, if you are going to fix a bug in Eloquent, name your branch *bug/eloquent*:
# git branch bug/eloquent
# git checkout bug/eloquent
Switched to branch 'bug/eloquent'
Or if there is a new feature to add or change to the documentation that you want to make, for example, the localization documentation:
# git branch feature/localization-docs
# git checkout feature/localization-docs
Switched to branch 'feature/localization-docs'
> **Note:** Create one new branch for every new feature or bug-fix. This will encourage organization, limit interdependency between new features/fixes and will make it easy for the Laravel team to merge your changes into the Laravel core.
Now that you have created your own branch and have switched to it, it's time to make your changes to the code. Add your new feature or fix that bug.
<a name='committing'></a>
## Committing
Now that you have finished coding and testing your changes, it's time to commit them to your local repository. First, add the files that you changed/added:
# git add laravel/documentation/localization.md
Next, commit the changes to the repository:
# git commit -s -m "I added some more stuff to the Localization documentation."
- **-s** means that you are signing-off on your commit with your name. This tells the Laravel team know that you personally agree to your code being added to the Laravel core.
- **-m** is the message that goes with your commit. Provide a brief explanation of what you added or changed.
<a name='pushing-to-your-fork'></a>
## Pushing to your Fork
Now that your local repository has your committed changes, it's time to push (or sync) your new branch to your fork that is hosted in GitHub:
# git push fork feature/localization-docs
Your branch has been successfully pushed to your fork on GitHub.
<a name='submitting-a-pull-request'></a>
## Submitting a Pull Request
The final step is to submit a pull request to the Laravel repository. This means that you are requesting that the Laravel team pull and merge your changes to the Laravel core. In your browser, visit your Laravel fork at [https://github.com/username/laravel](https://github.com/username/laravel). Click on **Pull Request**. Next, make sure you choose the proper base and head repositories and branches:
- **base repo:** laravel/laravel
- **base branch:** develop
- **head repo:** username/laravel
- **head branch:** feature/localization-docs
Use the form to write a more detailed description of the changes you made and why you made them. Finally, click **Send pull request**. That's it! The changes you made have been submitted to the Laravel team.
<a name='whats-next'></a>
## What's Next?
Do you have another feature you want to add or another bug you need to fix? First, make sure you always base your new branch off of the develop branch:
# git checkout develop
Then, pull down the latest changes from Laravel's repository:
# git pull origin develop
Now you are ready to create a new branch and start coding again!
> [Jason Lewis](http://jasonlewis.me/)'s blog post [Contributing to a GitHub Project](http://jasonlewis.me/blog/2012/06/how-to-contributing-to-a-github-project) was the primary inspiration for this tutorial.

View File

@ -0,0 +1,35 @@
# Laravel on GitHub
## Contents
- [The Basics](#the-basics)
- [Repositories](#repositoriess)
- [Branches](#branches)
<a name='the-basics'></a>
## The Basics
Because Laravel's development and source control is done through GitHub, anyone is able to make contributions to it. Anyone can fix bugs, add features or improve the documentation.
After submitting proposed changes to the project, the Laravel team will review the changes and make the decision to commit them to Laravel's core.
<a name='repositories'></a>
## Repositories
Laravel's home on GitHub is at [github.com/laravel](https://github.com/laravel). Laravel has several repositories. For basic contributions, the only repository you need to pay attention to is the **laravel** repository, located at [github.com/laravel/laravel](https://github.com/laravel/laravel).
<a name='branches'></a>
## Branches
The **laravel** repository has multiple branches, each serving a specific purpose:
- **master** - This is the Laravel release branch. Active development does not happen on this branch. This branch is only for the most recent, stable Laravel core code. When you download Laravel from [laravel.com](http://laravel.com/), you are downloading directly from this master branch. *Do not make pull requests to this branch.*
- **staging** - I'm not sure what this is for... Last minute testing before pushing develop to master?
- **develop** - This is the working development branch. All proposed code changes and contributions by the community are pulled into this branch. *When you make a pull request to the Laravel project, this is the branch you want to pull-request into.*
Once certain milestones have been reached and/or Taylor Otwell and the Laravel team is happy with the stability and additional features of the current development branch, the changes in the **develop** branch are pulled into the **master** branch, thus creating and releasing the newest stable version of Laravel for the world to use.
*Further Reading*
- [Contributing to Laravel via Command-Line](docs/contrib/command-line)
- [Contributing to Laravel using TortoiseGit](docs/contrib/tortoisegit)

View File

@ -0,0 +1,113 @@
# Contributing to Laravel using TortoiseGit
## Contents
- [Getting Started](#getting-started)
- [Forking Laravel](#forking-laravel)
- [Cloning Laravel](#cloning-laravel)
- [Adding your Fork](#adding-your-fork)
- [Creating Branches](#creating-branches)
- [Committing](#committing)
- [Submitting a Pull Request](#submitting-a-pull-request)
- [What's Next?](#whats-next)
<a name='getting-started'></a>
## Getting Started
This tutorial explains the basics of contributing to a project on [GitHub](https://github.com/) using [TortoiseGit](http://code.google.com/p/tortoisegit/) for Windows. The workflow can apply to most projects on GitHub, but in this case, we will be focused on the [Laravel](https://github.com/laravel/laravel) project.
This tutorial assumes you have installed TortoiseGit for Windows and you have created a GitHub account. If you haven't already, look at the [Laravel on GitHub](/docs/contrib/github) documentation in order to familiarize yourself with Laravel's repositories and branches.
<a name='forking-laravel'></a>
## Forking Laravel
Login to GitHub and visit the [Laravel Repository](https://github.com/laravel/laravel). Click on the **Fork** button. This will create your own fork of Laravel in your own GitHub account. Your Laravel fork will be located at **https://github.com/username/laravel** (your GitHub username will be used in place of *username*).
<a name='cloning-laravel'></a>
## Cloning Laravel
Open up Windows Explorer and create a new directory where you can make development changes to Laravel.
- Right-click the Laravel directory to bring up the context menu. Click on **Git Clone...**
- Git clone
- **Url:** https://github.com/laravel/laravel.git
- **Directory:** the directory that you just created in the previous step
- Click **OK**
> **Note**: The reason you are cloning the original Laravel repository (and not the fork you made) is so you can always pull down the most recent changes from the Laravel repository to your local repository.
<a name='adding-your-fork'></a>
## Adding your Fork
After the cloning process is complete, it's time to add the fork you made as a **remote repository**.
- Right-click the Laravel directory and goto **TortoiseGit > Settings**
- Goto the **Git/Remote** section. Add a new remote:
- **Remote**: fork
- **URL**: https://github.com/username/laravel.git
- Click **Add New/Save**
- Click **OK**
Remember to replace *username* with your GitHub username. *This is case-sensitive*.
<a name='creating-branches'></a>
## Creating Branches
Now you are ready to create a new branch for your new feature or bug-fix. When you create a new branch, use a self-descriptive naming convention. For example, if you are going to fix a bug in Eloquent, name your branch *bug/eloquent*. Or if you were going to make changes to the localization documentation, name your branch *feature/localization-docs*. A good naming convention will encourage organization and help others understand the purpose of your branch.
- Right-click the Laravel directory and goto **TortoiseGit > Create Branch**
- **Branch:** feature/localization-docs
- **Base On Branch:** remotes/origin/develop
- **Check** *Track*
- **Check** *Switch to new branch*
- Click **OK**
This will create your new *feature/localization-docs* branch and switch you to it.
> **Note:** Create one new branch for every new feature or bug-fix. This will encourage organization, limit interdependency between new features/fixes and will make it easy for the Laravel team to merge your changes into the Laravel core.
Now that you have created your own branch and have switched to it, it's time to make your changes to the code. Add your new feature or fix that bug.
<a name='committing'></a>
##Committing
Now that you have finished coding and testing your changes, it's time to commit them to your local repository:
- Right-click the Laravel directory and goto **Git Commit -> "feature/localization-docs"...**
- Commit
- **Message:** Provide a brief explaination of what you added or changed
- Click **Sign** - This tells the Laravel team know that you personally agree to your code being added to the Laravel core
- **Changes made:** Check all changed/added files
- Click **OK**
<a name='pushing-to-your-fork'></a>
## Pushing to your Fork
Now that your local repository has your committed changes, it's time to push (or sync) your new branch to your fork that is hosted in GitHub:
- Right-click the Laravel directory and goto **Git Sync...**
- Git Syncronization
- **Local Branch:** feature/localization-docs
- **Remote Branch:** leave this blank
- **Remote URL:** fork
- Click **Push**
- When asked for "username:" enter your GitHub *case-sensitive* username
- When asked for "password:" enter your GitHub *case-sensitive* account
Your branch has been successfully pushed to your fork on GitHub.
<a name='submitting-a-pull-request'></a>
## Submitting a Pull Request
The final step is to submit a pull request to the Laravel repository. This means that you are requesting that the Laravel team pull and merge your changes to the Laravel core. In your browser, visit your Laravel fork at [https://github.com/username/laravel](https://github.com/username/laravel). Click on **Pull Request**. Next, make sure you choose the proper base and head repositories and branches:
- **base repo:** laravel/laravel
- **base branch:** develop
- **head repo:** username/laravel
- **head branch:** feature/localization-docs
Use the form to write a more detailed description of the changes you made and why you made them. Finally, click **Send pull request**. That's it! The changes you made have been submitted to the Laravel team.
<a name='whats-next'></a>
## What's Next?
Do you have another feature you want to add or another bug you need to fix? Just follow the same instructions as before in the [Creating Branches](#creating-branches) section. Just remember to always create a new branch for every new feature/fix and don't forget to always base your new branches off of the *remotes/origin/develop* branch.

View File

@ -49,7 +49,7 @@ ## Controller Routing
<a name="bundle-controllers"></a> <a name="bundle-controllers"></a>
## Bundle Controllers ## Bundle Controllers
Bundles are Laravel's modular package system. Bundles can easily configured to handle requests to your application. We'll be going over [bundles in more detail](/docs/bundles) in another document. Bundles are Laravel's modular package system. Bundles can be easily configured to handle requests to your application. We'll be going over [bundles in more detail](/docs/bundles) in another document.
Creating controllers that belong to bundles is almost identical to creating your application controllers. Just prefix the controller class name with the name of the bundle, so if your bundle is named "admin", your controller classes would look like this: Creating controllers that belong to bundles is almost identical to creating your application controllers. Just prefix the controller class name with the name of the bundle, so if your bundle is named "admin", your controller classes would look like this:

View File

@ -5,6 +5,7 @@ ## Contents
- [Quick Start Using SQLite](#quick) - [Quick Start Using SQLite](#quick)
- [Configuring Other Databases](#server) - [Configuring Other Databases](#server)
- [Setting The Default Connection Name](#default) - [Setting The Default Connection Name](#default)
- [Overwriting The Default PDO Options](#options)
Laravel supports the following databases out of the box: Laravel supports the following databases out of the box:
@ -44,3 +45,26 @@ ## Setting The Default Connection Name
'default' => 'sqlite'; 'default' => 'sqlite';
The default connection will always be used by the [fluent query builder](/docs/database/fluent). If you need to change the default connection during a request, use the **Config::set** method. The default connection will always be used by the [fluent query builder](/docs/database/fluent). If you need to change the default connection during a request, use the **Config::set** method.
<a href="options"></a>
##Overwriting The Default PDO Options
The PDO connector class (**laravel/database/connectors/connector.php**) has a set of default PDO attributes defined which can be overwritten in the options array for each system. For example, one of the default attributes is to force column names to lowercase (**PDO::CASE_LOWER**) even if they are defined in UPPERCASE or CamelCase in the table. Therefore, under the default attributes, query result object variables would only be accessible in lowercase.
An example of the MySQL system settings with added default PDO attributes:
'mysql' => array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'database',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'prefix' => '',
PDO::ATTR_CASE => PDO::CASE_LOWER,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL,
PDO::ATTR_STRINGIFY_FETCHES => false,
PDO::ATTR_EMULATE_PREPARES => false,
),
More about the PDO connection attributes can be found [in the PHP manual](http://php.net/manual/en/pdo.setattribute.php).

View File

@ -15,6 +15,7 @@ ## Contents
- [Setter & Getter Methods](#getter-and-setter-methods) - [Setter & Getter Methods](#getter-and-setter-methods)
- [Mass-Assignment](#mass-assignment) - [Mass-Assignment](#mass-assignment)
- [Converting Models To Arrays](#to-array) - [Converting Models To Arrays](#to-array)
- [Deleting Models](#delete)
<a name="the-basics"></a> <a name="the-basics"></a>
## The Basics ## The Basics
@ -223,7 +224,7 @@ ### One-To-Many
return $this->has_many('Comment', 'my_foreign_key'); return $this->has_many('Comment', 'my_foreign_key');
You may be wondering: _If the dynamic properties return the relationship and require less keystokes, why would I ever use the relationship methods?_ Actually, relationship methods are very powerful. They allow you to continue to chain query methods before retrieving the relationship. Check this out: You may be wondering: _If the dynamic properties return the relationship and require less keystrokes, why would I ever use the relationship methods?_ Actually, relationship methods are very powerful. They allow you to continue to chain query methods before retrieving the relationship. Check this out:
echo Post::find(1)->comments()->order_by('votes', 'desc')->take(10)->get(); echo Post::find(1)->comments()->order_by('votes', 'desc')->take(10)->get();
@ -242,8 +243,9 @@ ### Many-To-Many
id - INTEGER id - INTEGER
name - VARCHAR name - VARCHAR
**Roles_Users:** **Role_User:**
id - INTEGER
user_id - INTEGER user_id - INTEGER
role_id - INTEGER role_id - INTEGER
@ -277,6 +279,17 @@ ### Many-To-Many
} }
By default only certain fields from the pivot table will be returned (the two **id** fields, and the timestamps). If your pivot table contains additional columns, you can fetch them too by using the **with()** method :
class User extends Eloquent {
public function roles()
{
return $this->has_many_and_belongs_to('Role', 'user_roles')->with('column');
}
}
<a name="inserting-related-models"></a> <a name="inserting-related-models"></a>
## Inserting Related Models ## Inserting Related Models
@ -525,3 +538,12 @@ #### Excluding attributes from the array:
public static $hidden = array('password'); public static $hidden = array('password');
} }
<a name="delete"></a>
## Deleting Models
Because Eloquent inherits all the features and methods of Fluent queries, deleting models is a snap:
$author->delete();
Note, however, than this won't delete any related models (e.g. all the author's Book models will still exist), unless you have set up [foreign keys](/docs/database/schema#foreign-keys) and cascading deletes.

View File

@ -169,7 +169,7 @@ ## Table Joins
$join->on('users.id', '=', 'phone.user_id'); $join->on('users.id', '=', 'phone.user_id');
$join->or_on('users.id', '=', 'phone.contact_id'); $join->or_on('users.id', '=', 'phone.contact_id');
}) })
->get(array('users.email', 'phone.numer')); ->get(array('users.email', 'phone.number'));
<a name="ordering"></a> <a name="ordering"></a>
## Ordering Results ## Ordering Results

View File

@ -13,7 +13,7 @@ ## Contents
<a name="the-basics"></a> <a name="the-basics"></a>
## The Basics ## The Basics
The Schema Bulder provides methods for creating and modifying your database tables. Using a fluent syntax, you can work with your tables without using any vendor specific SQL. The Schema Builder provides methods for creating and modifying your database tables. Using a fluent syntax, you can work with your tables without using any vendor specific SQL.
*Further Reading:* *Further Reading:*
@ -69,6 +69,7 @@ ## Adding Columns
`$table->text('description');` | TEXT equivalent to the table `$table->text('description');` | TEXT equivalent to the table
`$table->blob('data');` | BLOB equivalent to the table `$table->blob('data');` | BLOB equivalent to the table
`->nullable()` | Designate that the column allows NULL values `->nullable()` | Designate that the column allows NULL values
`->default($value)` | Declare a default value for a column
> **Note:** Laravel's "boolean" type maps to a small integer column on all database systems. > **Note:** Laravel's "boolean" type maps to a small integer column on all database systems.

View File

@ -4,6 +4,7 @@ ## Contents
- [Reading Files](#get) - [Reading Files](#get)
- [Writing Files](#put) - [Writing Files](#put)
- [Removing files](#delete)
- [File Uploads](#upload) - [File Uploads](#upload)
- [File Extensions](#ext) - [File Extensions](#ext)
- [Checking File Types](#is) - [Checking File Types](#is)
@ -29,6 +30,13 @@ #### Appending to a file:
File::append('path/to/file', 'appended file content'); File::append('path/to/file', 'appended file content');
<a name="delete"></a>
## Removing Files
#### Deleting a single file:
File::delete('path/to/file');
<a name="upload"></a> <a name="upload"></a>
## File Uploads ## File Uploads
@ -65,7 +73,7 @@ ## Getting MIME Types
#### Getting the MIME type associated with an extension: #### Getting the MIME type associated with an extension:
echo File::mime('gif'); echo File::mime('gif'); // outputs 'image/gif'
> **Note:** This method simply returns the MIME type defined for the extension in the **application/config/mimes.php** file. > **Note:** This method simply returns the MIME type defined for the extension in the **application/config/mimes.php** file.

View File

@ -24,7 +24,7 @@ #### Registering a resolver in the IoC container:
}); });
Great! Now we have registered a resolver for SwiftMailer in our container. But, what if we don't want the container to create a new mailer instance every time we need one? Maybe we just want the container to return the same instance after the intial instance is created. Just tell the container the object should be a singleton: Great! Now we have registered a resolver for SwiftMailer in our container. But, what if we don't want the container to create a new mailer instance every time we need one? Maybe we just want the container to return the same instance after the initial instance is created. Just tell the container the object should be a singleton:
#### Registering a singleton in the container: #### Registering a singleton in the container:

View File

@ -55,7 +55,7 @@ #### Getting a language line in a given language:
<a name="replace"></a> <a name="replace"></a>
## Place Holders & Replacements ## Place Holders & Replacements
Now, let's work on our welcome message. "Welcome to our website!" is a pretty generic message. It would be helpful to be able to specify the name of the person we are welcoming. But, creating a language line for each user of our application would be time-consuming and ridiculous. Thankfully, you don't have to. You can specify "place-holders" within your language lines. Place-holders are preceeded by a colon: Now, let's work on our welcome message. "Welcome to our website!" is a pretty generic message. It would be helpful to be able to specify the name of the person we are welcoming. But, creating a language line for each user of our application would be time-consuming and ridiculous. Thankfully, you don't have to. You can specify "place-holders" within your language lines. Place-holders are preceded by a colon:
#### Creating a language line with place-holders: #### Creating a language line with place-holders:

View File

@ -24,7 +24,7 @@ ## Logging
To enable logging, set the **log** option in the error configuration to "true". When enabled, the Closure defined by the **logger** configuration item will be executed when an error occurs. This gives you total flexibility in how the error should be logged. You can even e-mail the errors to your development team! To enable logging, set the **log** option in the error configuration to "true". When enabled, the Closure defined by the **logger** configuration item will be executed when an error occurs. This gives you total flexibility in how the error should be logged. You can even e-mail the errors to your development team!
By default, logs are stored in the **storage/logs** direcetory, and a new log file is created for each day. This keeps your log files from getting crowded with too many messages. By default, logs are stored in the **storage/logs** directory, and a new log file is created for each day. This keeps your log files from getting crowded with too many messages.
<a name="the-logger-class"></a> <a name="the-logger-class"></a>
## The Logger Class ## The Logger Class

View File

@ -62,7 +62,7 @@ #### Determining if the current request is using HTTPS:
// This request is over HTTPS! // This request is over HTTPS!
} }
#### Determing if the current request is an AJAX request: #### Determining if the current request is an AJAX request:
if (Request::ajax()) if (Request::ajax())
{ {

View File

@ -4,7 +4,7 @@ ## Contents
- [The Basics](#the-basics) - [The Basics](#the-basics)
- [Wildcards](#wildcards) - [Wildcards](#wildcards)
- [The 404 Events](#the-404-event) - [The 404 Event](#the-404-event)
- [Filters](#filters) - [Filters](#filters)
- [Pattern Filters](#pattern-filters) - [Pattern Filters](#pattern-filters)
- [Global Filters](#global-filters) - [Global Filters](#global-filters)
@ -99,14 +99,14 @@ #### The default 404 event handler:
You are free to change this to fit the needs of your application! You are free to change this to fit the needs of your application!
*Futher Reading:* *Further Reading:*
- *[Events](/docs/events)* - *[Events](/docs/events)*
<a name="filters"></a> <a name="filters"></a>
## Filters ## Filters
Route filters may be run before or after a route is executed. If a "before" filter returns a value, that value is considered the response to the request and the route is not executed, which is conveniont when implementing authentication filters, etc. Filters are typically defined in **application/routes.php**. Route filters may be run before or after a route is executed. If a "before" filter returns a value, that value is considered the response to the request and the route is not executed, which is convenient when implementing authentication filters, etc. Filters are typically defined in **application/routes.php**.
#### Registering a filter: #### Registering a filter:

View File

@ -366,7 +366,7 @@ #### Specifying a custom error message for a given attribute:
However, if you are using many custom error messages, specifying inline may become cumbersome and messy. For that reason, you can specify your custom messages in the **custom** array within the validation language file: However, if you are using many custom error messages, specifying inline may become cumbersome and messy. For that reason, you can specify your custom messages in the **custom** array within the validation language file:
#### Adding custom error messages to the validation langauge file: #### Adding custom error messages to the validation language file:
'custom' => array( 'custom' => array(
'email_required' => 'We need to know your e-mail address!', 'email_required' => 'We need to know your e-mail address!',
@ -417,7 +417,7 @@ #### Registering a custom validation rule:
Validator::register('awesome', function($attribute, $value, $parameters) Validator::register('awesome', function($attribute, $value, $parameters)
{ {
return $value == $parameters[0]; return $value == $parameters[0];
} });
In this case, the parameters argument of your validation rule would receive an array containing one element: "yes". In this case, the parameters argument of your validation rule would receive an array containing one element: "yes".

View File

@ -54,9 +54,9 @@ #### Returning a custom response:
return Response::make('Hello World!', 200, $headers); return Response::make('Hello World!', 200, $headers);
}); });
#### Returning a custom response containing a view: #### Returning a custom response containing a view, with binding data:
return Response::view('home', 200, $headers); return Response::view('home', array('foo' => 'bar'));
#### Returning a JSON response: #### Returning a JSON response:

View File

@ -15,7 +15,7 @@ ## Content
<a name="entities"></a> <a name="entities"></a>
## Entities ## Entities
When displaying user input in your Views, it is important to convert all characters which have signifance in HTML to their "entity" representation. When displaying user input in your Views, it is important to convert all characters which have significance in HTML to their "entity" representation.
For example, the < symbol should be converted to its entity representation. Converting HTML characters to their entity representation helps protect your application from cross-site scripting: For example, the < symbol should be converted to its entity representation. Converting HTML characters to their entity representation helps protect your application from cross-site scripting:

View File

@ -22,6 +22,10 @@ #### Pull the paginated results from the query:
$orders = DB::table('orders')->paginate($per_page); $orders = DB::table('orders')->paginate($per_page);
You can also pass an optional array of table columns to select in the query:
$orders = DB::table('orders')->paginate($per_page, array('id', 'name', 'created_at'));
#### Display the results in a view: #### Display the results in a view:
<?php foreach ($orders->results as $order): ?> <?php foreach ($orders->results as $order): ?>

View File

@ -10,7 +10,7 @@ ## Contents
<a name="the-basics"></a> <a name="the-basics"></a>
## The Basics ## The Basics
Your application probably uses a common layout across most of its pages. Manually creating this layout within every controller action can be a pain. Specifying a controller layout will make your develompent much more enjoyable. Here's how to get started: Your application probably uses a common layout across most of its pages. Manually creating this layout within every controller action can be a pain. Specifying a controller layout will make your development much more enjoyable. Here's how to get started:
#### Specify a "layout" property on your controller: #### Specify a "layout" property on your controller:
@ -69,13 +69,16 @@ #### Echoing function results using Blade:
{{ Asset::styles() }} {{ Asset::styles() }}
#### Rendering a view: #### Render a view:
You can use **@include** to render a view into another view. The rendered view will automatically inherit all of the data from the current view.
<h1>Profile</hi> <h1>Profile</hi>
@include('user.profile') @include('user.profile')
> **Note:** When using the **@include** Blade expression, the view will automatically inherit all of the current view data. Similarly, you can use **@render**, which behaves the same as **@include** except the rendered view will **not** inherit the data from the current view.
@render('admin.list')
#### Creating loops using Blade: #### Creating loops using Blade:
@ -130,6 +133,12 @@ #### Blade comments:
... ...
@endif @endif
{{--
This is
a multi-line
comment.
--}}
> **Note:** Blade comments, unlike HTML comments, are not visible in the HTML source. > **Note:** Blade comments, unlike HTML comments, are not visible in the HTML source.
<a name="blade-layouts"></a> <a name="blade-layouts"></a>

View File

@ -60,7 +60,7 @@ public static function native($code, $error, $file, $line)
{ {
if (error_reporting() === 0) return; if (error_reporting() === 0) return;
// For a PHP error, we'll create an ErrorExcepetion and then feed that // For a PHP error, we'll create an ErrorException and then feed that
// exception to the exception method, which will create a simple view // exception to the exception method, which will create a simple view
// of the exception details for the developer. // of the exception details for the developer.
$exception = new \ErrorException($error, $code, 0, $file, $line); $exception = new \ErrorException($error, $code, 0, $file, $line);
@ -80,7 +80,7 @@ public static function native($code, $error, $file, $line)
*/ */
public static function shutdown() public static function shutdown()
{ {
// If a fatal error occured that we have not handled yet, we will // If a fatal error occurred that we have not handled yet, we will
// create an ErrorException and feed it to the exception handler, // create an ErrorException and feed it to the exception handler,
// as it will not yet have been handled. // as it will not yet have been handled.
$error = error_get_last(); $error = error_get_last();

View File

@ -125,7 +125,7 @@ public static function first($event, $parameters = array())
} }
/** /**
* Fire an event and return the the first response. * Fire an event and return the first response.
* *
* Execution will be halted after the first valid response is found. * Execution will be halted after the first valid response is found.
* *

View File

@ -161,7 +161,7 @@ public static function mime($extension, $default = 'application/octet-stream')
} }
/** /**
* Determine if a file is a given type. * Determine if a file is of a given type.
* *
* The Fileinfo PHP extension is used to determine the file's MIME type. * The Fileinfo PHP extension is used to determine the file's MIME type.
* *
@ -184,7 +184,7 @@ public static function is($extensions, $path)
$mime = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path); $mime = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path);
// The MIME configuration file contains an array of file extensions and // The MIME configuration file contains an array of file extensions and
// their associated MIME types. We will spin through each extension the // their associated MIME types. We will loop through each extension the
// developer wants to check and look for the MIME type. // developer wants to check and look for the MIME type.
foreach ((array) $extensions as $extension) foreach ((array) $extensions as $extension)
{ {
@ -296,7 +296,7 @@ public static function rmdir($directory, $preserve = false)
{ {
// If the item is a directory, we can just recurse into the // If the item is a directory, we can just recurse into the
// function and delete that sub-directory, otherwise we'll // function and delete that sub-directory, otherwise we'll
// just deleete the file and keep going! // just delete the file and keep going!
if ($item->isDir()) if ($item->isDir())
{ {
static::rmdir($item->getRealPath()); static::rmdir($item->getRealPath());
@ -335,7 +335,7 @@ public static function latest($directory, $options = fIterator::SKIP_DOTS)
$items = new fIterator($directory, $options); $items = new fIterator($directory, $options);
// To get the latest created file, we'll simply spin through the // To get the latest created file, we'll simply loop through the
// directory, setting the latest file if we encounter a file // directory, setting the latest file if we encounter a file
// with a UNIX timestamp greater than the latest one. // with a UNIX timestamp greater than the latest one.
foreach ($items as $item) foreach ($items as $item)

View File

@ -34,7 +34,10 @@ function __($key, $replacements = array(), $language = null)
*/ */
function dd($value) function dd($value)
{ {
die(var_dump($value)); echo "<pre>";
var_dump($value);
echo "</pre>";
die;
} }
/** /**
@ -462,7 +465,7 @@ function root_namespace($class, $separator = '\\')
/** /**
* Get the "class basename" of a class or object. * Get the "class basename" of a class or object.
* *
* The basename is considered the name of the class minus all namespaces. * The basename is considered to be the name of the class minus all namespaces.
* *
* @param object|string $class * @param object|string $class
* @return string * @return string
@ -581,3 +584,15 @@ function get_cli_option($option, $default = null)
return value($default); return value($default);
} }
/**
* Calculate the human-readable file size (with proper units).
*
* @param int $size
* @return string
*/
function get_file_size($size)
{
$units = array('Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB');
return @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2).' '.$units[$i];
}

View File

@ -137,10 +137,12 @@ public static function span($value, $attributes = array())
* @param bool $https * @param bool $https
* @return string * @return string
*/ */
public static function link($url, $title, $attributes = array(), $https = null) public static function link($url, $title = null, $attributes = array(), $https = null)
{ {
$url = URL::to($url, $https); $url = URL::to($url, $https);
if (is_null($title)) $title = $url;
return '<a href="'.$url.'"'.static::attributes($attributes).'>'.static::entities($title).'</a>'; return '<a href="'.$url.'"'.static::attributes($attributes).'>'.static::entities($title).'</a>';
} }
@ -152,7 +154,7 @@ public static function link($url, $title, $attributes = array(), $https = null)
* @param array $attributes * @param array $attributes
* @return string * @return string
*/ */
public static function link_to_secure($url, $title, $attributes = array()) public static function link_to_secure($url, $title = null, $attributes = array())
{ {
return static::link($url, $title, $attributes, true); return static::link($url, $title, $attributes, true);
} }
@ -168,7 +170,7 @@ public static function link_to_secure($url, $title, $attributes = array())
* @param bool $https * @param bool $https
* @return string * @return string
*/ */
public static function link_to_asset($url, $title, $attributes = array(), $https = null) public static function link_to_asset($url, $title = null, $attributes = array(), $https = null)
{ {
$url = URL::to_asset($url, $https); $url = URL::to_asset($url, $https);
@ -183,7 +185,7 @@ public static function link_to_asset($url, $title, $attributes = array(), $https
* @param array $attributes * @param array $attributes
* @return string * @return string
*/ */
public static function link_to_secure_asset($url, $title, $attributes = array()) public static function link_to_secure_asset($url, $title = null, $attributes = array())
{ {
return static::link_to_asset($url, $title, $attributes, true); return static::link_to_asset($url, $title, $attributes, true);
} }
@ -207,7 +209,7 @@ public static function link_to_secure_asset($url, $title, $attributes = array())
* @param array $attributes * @param array $attributes
* @return string * @return string
*/ */
public static function link_to_route($name, $title, $parameters = array(), $attributes = array()) public static function link_to_route($name, $title = null, $parameters = array(), $attributes = array())
{ {
return static::link(URL::to_route($name, $parameters), $title, $attributes); return static::link(URL::to_route($name, $parameters), $title, $attributes);
} }
@ -231,7 +233,7 @@ public static function link_to_route($name, $title, $parameters = array(), $attr
* @param array $attributes * @param array $attributes
* @return string * @return string
*/ */
public static function link_to_action($action, $title, $parameters = array(), $attributes = array()) public static function link_to_action($action, $title = null, $parameters = array(), $attributes = array())
{ {
return static::link(URL::to_action($action, $parameters), $title, $attributes); return static::link(URL::to_action($action, $parameters), $title, $attributes);
} }
@ -359,7 +361,7 @@ public static function attributes($attributes)
foreach ((array) $attributes as $key => $value) foreach ((array) $attributes as $key => $value)
{ {
// For numeric keys, we will assume that the key and the value are the // For numeric keys, we will assume that the key and the value are the
// same, as this will conver HTML attributes such as "required" that // same, as this will convert HTML attributes such as "required" that
// may be specified as required="required", etc. // may be specified as required="required", etc.
if (is_numeric($key)) $key = $value; if (is_numeric($key)) $key = $value;

View File

@ -124,7 +124,7 @@ public static function resolve($type, $parameters = array())
// If the requested type is registered as a singleton, we want to cache off // If the requested type is registered as a singleton, we want to cache off
// the instance in memory so we can return it later without creating an // the instance in memory so we can return it later without creating an
// entirely new instances of the object on each subsequent request. // entirely new instances of the object on each subsequent request.
if (isset(static::$registry[$type]['singleton'])) if (isset(static::$registry[$type]['singleton']) && static::$registry[$type]['singleton'] === true)
{ {
static::$singletons[$type] = $object; static::$singletons[$type] = $object;
} }
@ -154,7 +154,7 @@ protected static function build($type, $parameters = array())
$reflector = new \ReflectionClass($type); $reflector = new \ReflectionClass($type);
// If the type is not instantiable, the developer is attempting to resolve // If the type is not instantiable, the developer is attempting to resolve
// an abstract type such as an Interface of Abstract Class and there is // an abstract type such as an Interface of an Abstract Class and there is
// no binding registered for the abstraction so we need to bail out. // no binding registered for the abstraction so we need to bail out.
if ( ! $reflector->isInstantiable()) if ( ! $reflector->isInstantiable())
{ {
@ -179,7 +179,7 @@ protected static function build($type, $parameters = array())
/** /**
* Resolve all of the dependencies from the ReflectionParameters. * Resolve all of the dependencies from the ReflectionParameters.
* *
* @param array $parameterrs * @param array $parameters
* @return array * @return array
*/ */
protected static function dependencies($parameters) protected static function dependencies($parameters)
@ -191,7 +191,7 @@ protected static function dependencies($parameters)
$dependency = $parameter->getClass(); $dependency = $parameter->getClass();
// If the class is null, it means the dependency is a string or some other // If the class is null, it means the dependency is a string or some other
// primitive type, which we can not esolve since it is not a class and // primitive type, which we can not resolve since it is not a class and
// we'll just bomb out with an error since we have nowhere to go. // we'll just bomb out with an error since we have nowhere to go.
if (is_null($dependency)) if (is_null($dependency))
{ {

View File

@ -134,7 +134,7 @@ public function get($language = null, $default = null)
$line = array_get($lines, $line, $default); $line = array_get($lines, $line, $default);
// If the line is not a string, it probably means the developer asked for // If the line is not a string, it probably means the developer asked for
// the entire langauge file and the value of the requested value will be // the entire language file and the value of the requested value will be
// an array containing all of the lines in the file. // an array containing all of the lines in the file.
if (is_string($line)) if (is_string($line))
{ {

View File

@ -54,7 +54,7 @@
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| By setting error reporting to -1, we essentially force PHP to report | By setting error reporting to -1, we essentially force PHP to report
| every error, and this is guranteed to show every error on future | every error, and this is guaranteed to show every error on future
| releases of PHP. This allows everything to be fixed early! | releases of PHP. This allows everything to be fixed early!
| |
*/ */
@ -107,6 +107,46 @@
return Event::first('404'); return Event::first('404');
}); });
/*
|--------------------------------------------------------------------------
| Gather The URI And Locales
|--------------------------------------------------------------------------
|
| When routing, we'll need to grab the URI and the supported locales for
| the route so we can properly set the language and route the request
| to the proper end-point in the application.
|
*/
$uri = URI::current();
$locales = Config::get('application.languages', array());
$locales[] = Config::get('application.language');
/*
|--------------------------------------------------------------------------
| Set The Locale Based On Route
|--------------------------------------------------------------------------
|
| If the URI starts with one of the supported languages, we will set
| the default language to match that URI segment and shorten the
| URI we'll pass to the router to not include the lang segment.
|
*/
foreach ($locales as $locale)
{
if (starts_with($uri, $locale))
{
Config::set('application.language', $locale);
$uri = trim(substr($uri, strlen($locale)), '/'); break;
}
}
if ($uri === '') $uri = '/';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Route The Incoming Request | Route The Incoming Request
@ -118,8 +158,6 @@
| |
*/ */
$uri = URI::current();
Request::$route = Routing\Router::route(Request::method(), $uri); Request::$route = Routing\Router::route(Request::method(), $uri);
$response = Request::$route->call(); $response = Request::$route->call();
@ -143,7 +181,7 @@
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| If a session driver has been configured, we will save the session to | If a session driver has been configured, we will save the session to
| storage so it is avaiable for the next request. This will also set | storage so it is available for the next request. This will also set
| the session cookie in the cookie jar to be sent to the user. | the session cookie in the cookie jar to be sent to the user.
| |
*/ */
@ -172,7 +210,7 @@
| And We're Done! | And We're Done!
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Raise the "done" event so extra output can be attached to the response | Raise the "done" event so extra output can be attached to the response.
| This allows the adding of debug toolbars, etc. to the view, or may be | This allows the adding of debug toolbars, etc. to the view, or may be
| used to do some kind of logging by the application. | used to do some kind of logging by the application.
| |

View File

@ -28,7 +28,7 @@ protected static function exception_line($e)
* Write a message to the log file. * Write a message to the log file.
* *
* <code> * <code>
* // Write an "error" messge to the log file * // Write an "error" message to the log file
* Log::write('error', 'Something went horribly wrong!'); * Log::write('error', 'Something went horribly wrong!');
* *
* // Write an "error" message using the class' magic method * // Write an "error" message using the class' magic method
@ -51,7 +51,7 @@ public static function write($type, $message)
// If there aren't listeners on the log event, we'll just write to the // If there aren't listeners on the log event, we'll just write to the
// log files using the default conventions, writing one log file per // log files using the default conventions, writing one log file per
// day so they files don't get too crowded. // day so the files don't get too crowded.
else else
{ {
$message = static::format($type, $message); $message = static::format($type, $message);

View File

@ -68,7 +68,7 @@ protected static function connect($servers)
*/ */
public static function __callStatic($method, $parameters) public static function __callStatic($method, $parameters)
{ {
return call_user_func_array(array(static::instance(), $method), $parameters); return call_user_func_array(array(static::connection(), $method), $parameters);
} }
} }

View File

@ -48,7 +48,7 @@ public function singular($value)
} }
// English words may be automatically inflected using regular expressions. // English words may be automatically inflected using regular expressions.
// If the word is english, we'll just pass off the word to the automatic // If the word is English, we'll just pass off the word to the automatic
// inflection method and return the result, which is cached. // inflection method and return the result, which is cached.
$irregular = $this->config['irregular']; $irregular = $this->config['irregular'];
@ -77,7 +77,7 @@ public function plural($value, $count = 2)
} }
// English words may be automatically inflected using regular expressions. // English words may be automatically inflected using regular expressions.
// If the word is english, we'll just pass off the word to the automatic // If the word is English, we'll just pass off the word to the automatic
// inflection method and return the result, which is cached. // inflection method and return the result, which is cached.
$irregular = array_flip($this->config['irregular']); $irregular = array_flip($this->config['irregular']);
@ -104,7 +104,7 @@ protected function auto($value, $source, $irregular)
return $value; return $value;
} }
// Next we will check the "irregular" patterns, which contains words // Next, we will check the "irregular" patterns, which contain words
// like "children" and "teeth" which can not be inflected using the // like "children" and "teeth" which can not be inflected using the
// typically used regular expression matching approach. // typically used regular expression matching approach.
foreach ($irregular as $irregular => $pattern) foreach ($irregular as $irregular => $pattern)

View File

@ -5,6 +5,7 @@
use Laravel\Event; use Laravel\Event;
use Laravel\Config; use Laravel\Config;
use Laravel\Request; use Laravel\Request;
use Laravel\Database;
class Profiler { class Profiler {
@ -28,6 +29,9 @@ public static function render($response)
// type applications, so we will not send anything in those scenarios. // type applications, so we will not send anything in those scenarios.
if ( ! Request::ajax()) if ( ! Request::ajax())
{ {
static::$data['memory'] = get_file_size(memory_get_usage(true));
static::$data['memory_peak'] = get_file_size(memory_get_peak_usage(true));
static::$data['time'] = number_format((microtime(true) - LARAVEL_START) * 1000, 2);
return render('path: '.__DIR__.'/template'.BLADE_EXT, static::$data); return render('path: '.__DIR__.'/template'.BLADE_EXT, static::$data);
} }
} }
@ -54,6 +58,8 @@ public static function query($sql, $bindings, $time)
{ {
foreach ($bindings as $binding) foreach ($bindings as $binding)
{ {
$binding = Database::connection()->pdo->quote($binding);
$sql = preg_replace('/\?/', $binding, $sql, 1); $sql = preg_replace('/\?/', $binding, $sql, 1);
} }

View File

@ -61,6 +61,8 @@
@endif @endif
</a> </a>
</li> </li>
<li><a class="anbu-tab">Time <span class="anbu-count">{{ $time }}ms</span></a></li>
<li><a class="anbu-tab">Memory <span class="anbu-count">{{ $memory }} ({{ $memory_peak }})</span></a></li>
<li class="anbu-tab-right"><a id="anbu-hide" href="#">&#8614;</a></li> <li class="anbu-tab-right"><a id="anbu-hide" href="#">&#8614;</a></li>
<li class="anbu-tab-right"><a id="anbu-close" href="#">&times;</a></li> <li class="anbu-tab-right"><a id="anbu-close" href="#">&times;</a></li>
<li class="anbu-tab-right"><a id="anbu-zoom" href="#">&#8645;</a></li> <li class="anbu-tab-right"><a id="anbu-zoom" href="#">&#8645;</a></li>

View File

@ -17,7 +17,7 @@ class Redis {
protected $port; protected $port;
/** /**
* The databse number the connection selects on load. * The database number the connection selects on load.
* *
* @var int * @var int
*/ */

View File

@ -178,6 +178,16 @@ public static function referrer()
return static::foundation()->headers->get('referer'); return static::foundation()->headers->get('referer');
} }
/**
* Get the timestamp of the time when the request was started.
*
* @return int
*/
public static function time()
{
return (int) LARAVEL_START;
}
/** /**
* Determine if the current request is via the command line. * Determine if the current request is via the command line.
* *

View File

@ -106,7 +106,7 @@ public static function json($data, $status = 200, $headers = array())
* return Response::eloquent($data, 200, array('header' => 'value')); * return Response::eloquent($data, 200, array('header' => 'value'));
* </code> * </code>
* *
* @param Eloquenet|array $data * @param Eloquent|array $data
* @param int $status * @param int $status
* @param array $headers * @param array $headers
* @return Response * @return Response
@ -239,7 +239,7 @@ public function send()
public function render() public function render()
{ {
// If the content is a stringable object, we'll go ahead and call // If the content is a stringable object, we'll go ahead and call
// to toString method so that we can get the string content of // the toString method so that we can get the string content of
// the content object. Otherwise we'll just cast to string. // the content object. Otherwise we'll just cast to string.
if (str_object($this->content)) if (str_object($this->content))
{ {

View File

@ -14,7 +14,7 @@ class Filter {
public static $filters = array(); public static $filters = array();
/** /**
* The route filters that are based on pattern. * The route filters that are based on a pattern.
* *
* @var array * @var array
*/ */

View File

@ -10,7 +10,7 @@
class Route { class Route {
/** /**
* The URI the route response to. * The URI the route responds to.
* *
* @var string * @var string
*/ */
@ -52,7 +52,7 @@ class Route {
public $action; public $action;
/** /**
* The parameters that will passed to the route callback. * The parameters that will be passed to the route callback.
* *
* @var array * @var array
*/ */
@ -79,7 +79,7 @@ public function __construct($method, $uri, $action, $parameters = array())
// We'll set the parameters based on the number of parameters passed // We'll set the parameters based on the number of parameters passed
// compared to the parameters that were needed. If more parameters // compared to the parameters that were needed. If more parameters
// are needed, we'll merge in defaults. // are needed, we'll merge in the defaults.
$this->parameters($action, $parameters); $this->parameters($action, $parameters);
} }
@ -96,7 +96,7 @@ protected function parameters($action, $parameters)
// If there are less parameters than wildcards, we will figure out how // If there are less parameters than wildcards, we will figure out how
// many parameters we need to inject from the array of defaults and // many parameters we need to inject from the array of defaults and
// merge them in into the main array for the route. // merge them into the main array for the route.
if (count($defaults) > count($parameters)) if (count($defaults) > count($parameters))
{ {
$defaults = array_slice($defaults, count($parameters)); $defaults = array_slice($defaults, count($parameters));

View File

@ -55,7 +55,7 @@ class Router {
public static $group; public static $group;
/** /**
* The "handes" clause for the bundle currently being routed. * The "handles" clause for the bundle currently being routed.
* *
* @var string * @var string
*/ */
@ -303,7 +303,7 @@ public static function controller($controllers, $defaults = 'index', $https = nu
{ {
list($bundle, $controller) = Bundle::parse($identifier); list($bundle, $controller) = Bundle::parse($identifier);
// First we need to replace the dots with slashes in thte controller name // First we need to replace the dots with slashes in the controller name
// so that it is in directory format. The dots allow the developer to use // so that it is in directory format. The dots allow the developer to use
// a cleaner syntax when specifying the controller. We will also grab the // a cleaner syntax when specifying the controller. We will also grab the
// root URI for the controller's bundle. // root URI for the controller's bundle.
@ -311,7 +311,7 @@ public static function controller($controllers, $defaults = 'index', $https = nu
$root = Bundle::option($bundle, 'handles'); $root = Bundle::option($bundle, 'handles');
// If the controller is a "home" controller, we'll need to also build a // If the controller is a "home" controller, we'll need to also build an
// index method route for the controller. We'll remove "home" from the // index method route for the controller. We'll remove "home" from the
// route root and setup a route to point to the index method. // route root and setup a route to point to the index method.
if (ends_with($controller, 'home')) if (ends_with($controller, 'home'))
@ -428,7 +428,7 @@ public static function uses($action)
// To find the route, we'll simply spin through the routes looking // To find the route, we'll simply spin through the routes looking
// for a route with a "uses" key matching the action, and if we // for a route with a "uses" key matching the action, and if we
// find one we cache and return it. // find one, we cache and return it.
foreach (static::routes() as $method => $routes) foreach (static::routes() as $method => $routes)
{ {
foreach ($routes as $key => $value) foreach ($routes as $key => $value)
@ -484,7 +484,7 @@ protected static function match($method, $uri)
{ {
foreach (static::method($method) as $route => $action) foreach (static::method($method) as $route => $action)
{ {
// We only need to check routes with regular expression since all other // We only need to check routes with regular expression since all others
// would have been able to be matched by the search for literal matches // would have been able to be matched by the search for literal matches
// we just did before we started searching. // we just did before we started searching.
if (str_contains($route, '(')) if (str_contains($route, '('))

View File

@ -24,7 +24,7 @@ class Session {
const csrf_token = 'csrf_token'; const csrf_token = 'csrf_token';
/** /**
* Create the session payload and the load the session. * Create the session payload and load the session.
* *
* @return void * @return void
*/ */

View File

@ -84,7 +84,7 @@ public function delete($id)
} }
/** /**
* Delete all expired sessions from persistant storage. * Delete all expired sessions from persistent storage.
* *
* @param int $expiration * @param int $expiration
* @return void * @return void

View File

@ -63,7 +63,7 @@ public function id()
return Str::random(40); return Str::random(40);
} }
// We'll containue generating random IDs until we find an ID that is // We'll continue generating random IDs until we find an ID that is
// not currently assigned to a session. This is almost definitely // not currently assigned to a session. This is almost definitely
// going to happen on the first iteration. // going to happen on the first iteration.
do { do {

Some files were not shown because too many files have changed in this diff Show More