From 66ff8a4076c635e9e4aa31ef4f856d635af48038 Mon Sep 17 00:00:00 2001 From: Dayle Rees Date: Wed, 28 Mar 2012 10:30:51 +0100 Subject: [PATCH 01/32] integrated a simple version of anbu into the laravel core Signed-off-by: Dayle Rees --- application/config/anbu.php | 59 +++++++++ application/start.php | 16 ++- application/views/home/index.php | 3 +- laravel/anbu/anbu.css | 207 +++++++++++++++++++++++++++++++ laravel/anbu/anbu.js | 174 ++++++++++++++++++++++++++ laravel/anbu/anbu.php | 97 +++++++++++++++ laravel/anbu/template.php | 63 ++++++++++ 7 files changed, 617 insertions(+), 2 deletions(-) create mode 100644 application/config/anbu.php mode change 100644 => 100755 application/start.php mode change 100644 => 100755 application/views/home/index.php create mode 100755 laravel/anbu/anbu.css create mode 100755 laravel/anbu/anbu.js create mode 100755 laravel/anbu/anbu.php create mode 100755 laravel/anbu/template.php diff --git a/application/config/anbu.php b/application/config/anbu.php new file mode 100644 index 00000000..9b6503ee --- /dev/null +++ b/application/config/anbu.php @@ -0,0 +1,59 @@ + true, + + /* + |-------------------------------------------------------------------------- + | Show the QUERIES tab. + |-------------------------------------------------------------------------- + | + | Display a tab showing all queries performed by the Database layer. + | + */ + + 'tab_queries' => true, + + /* + |-------------------------------------------------------------------------- + | Include jQuery? + |-------------------------------------------------------------------------- + | + | Anbu needs the jQuery JavaScript framework to function, if you are already + | using jQuery in your templates, set this value to false. + | + */ + + 'include_jquery' => true, + + /* + |-------------------------------------------------------------------------- + | Event Listeners + |-------------------------------------------------------------------------- + | + | These are the Laravel event listeners, feel free to modify them to use + | a different data source, or include more if necessary. + | + */ + + 'event_listeners' => function() + { + // pass laravel log entries to anbu + Event::listen('laravel.log', 'Anbu::log'); + + // pass executed SQL queries to anbu + Event::listen('laravel.query', 'Anbu::sql'); + }, + +); diff --git a/application/start.php b/application/start.php old mode 100644 new mode 100755 index 085dd090..a6fd4f70 --- a/application/start.php +++ b/application/start.php @@ -125,6 +125,20 @@ Blade::sharpen(); +/* +|-------------------------------------------------------------------------- +| Enable The Anbu Profiler +|-------------------------------------------------------------------------- +| +| The Anbu profiler is an easy way to view all of your Executed SQL +| queries, log entries and other useful data from the front-end of your +| web app, to enable output simply add Anbu::render(); after the +| tag of your main template, or page. +| +*/ + +Anbu::register(); + /* |-------------------------------------------------------------------------- | Set The Default Timezone @@ -154,4 +168,4 @@ if ( ! Request::cli() and Config::get('session.driver') !== '') { Session::load(); -} \ No newline at end of file +} diff --git a/application/views/home/index.php b/application/views/home/index.php old mode 100644 new mode 100755 index 156c36ab..980248f3 --- a/application/views/home/index.php +++ b/application/views/home/index.php @@ -88,6 +88,7 @@ +

Welcome To Laravel

@@ -126,4 +127,4 @@
- \ No newline at end of file + diff --git a/laravel/anbu/anbu.css b/laravel/anbu/anbu.css new file mode 100755 index 00000000..343b011c --- /dev/null +++ b/laravel/anbu/anbu.css @@ -0,0 +1,207 @@ +/* +Anbu Styles +Copyright 2012 Dayle Rees. +MIT License +Intended for inclusion with the Laravel PHP Framework. +*/ + +.anbu +{ + font-family:Helvetica, "Helvetica Neue", Arial, sans-serif !important; + font-size:14px !important; + background-color:#222 !important; + position:fixed !important; + bottom:0 !important; + right:0 !important; + width:100%; + z-index: 9999 !important; +} + +.anbu-tabs +{ + margin:0 !important; + padding:0 !important; + overflow:hidden !important; +} + +.anbu-tabs li +{ + display:inline; +} + +.anbu-tabs a, .anbu-tabs a:visited +{ + color:#aaa !important; + text-transform:uppercase !important; + font-weight:bold !important; + display:inline-block; + text-decoration:none !important; + font-size:0.8em !important; + padding: 0.8em 2em 0.7em 2em !important; + -webkit-transition-property:color, background-color; + -webkit-transition-duration: 0.7s, 0.2s; + -webkit-transition-timing-function: ease-in, ease-in; + -moz-transition-property:color, background-color; + -moz-transition-duration: 0.7s, 0.2s; + -moz-transition-timing-function: ease-in, ease-in; + -ms-transition-property:color, background-color; + -ms-transition-duration: 0.7s, 0.2s; + -ms-transition-timing-function: ease-in, ease-in; + -o-transition-property:color, background-color; + -o-transition-duration: 0.7s, 0.2s; + -o-transition-timing-function: ease-in, ease-in; + transition-property:color, background-color; + transition-duration: 0.7s, 0.2s; + transition-timing-function: ease-in, ease-in; +} + +#anbu-closed-tabs a, #anbu-closed-tabs a:visited +{ + padding: 0.85em 1.2em 0.85em 1.2em !important; +} + +.anbu-tabs a:hover +{ + background-color:#333 !important; + color:#fff !important; +} + +.anbu-tabs a.anbu-active-tab +{ + color:#fff !important; + background-color:#333 !important; +} + +.anbu a:focus +{ + outline:none !important; +} + +.anbu-tabs a:active +{ + background-color:#111 !important; +} + +.anbu-tabs li.anbu-tab-right +{ + float:right !important; +} + +.anbu-tabs li.anbu-tab-right a, .anbu-tabs li.anbu-tab-right a:visited +{ + padding: 0.86em 2em 0.7em 2em !important; +} + +#anbu-closed-tabs +{ + display:none; +} + + +.anbu-window +{ + display:none; +} + +.anbu-content-area +{ + background-color: #fff !important; + background-image: -webkit-gradient(linear, left top, left bottom, from(#eeeeee), to(#ffffff)); + background-image: -webkit-linear-gradient(top, #eeeeee, #ffffff); + background-image: -moz-linear-gradient(top, #eeeeee, #ffffff); + background-image: -ms-linear-gradient(top, #eeeeee, #ffffff); + background-image: -o-linear-gradient(top, #eeeeee, #ffffff); + background-image: linear-gradient(to bottom, #eeeeee, #ffffff); + height:14em; + margin-top:6px !important; + overflow-x:hidden !important; + overflow-y:auto !important; +} + +.anbu-table table +{ + margin:0 !important; + padding:0 !important; + font-size:0.9em !important; + border:0 !important; + border-collapse:collapse !important; + width:100% !important; + background-color:#fff !important; +} + +.anbu-table pre +{ + margin:0 !important; +} + +.anbu-table tr +{ + border-bottom:1px solid #ccc !important; +} + +.anbu-table tr:first-child +{ + border:0 !important; +} + +.anbu-table th +{ + background-color:#555 !important; + color:#fff !important; + text-transform:uppercase !important; +} + +.anbu-table th, .anbu-table td +{ + text-align:left !important; + padding:0.4em 1em !important; + margin:0 !important; +} + +.anbu-table td +{ + vertical-align:top !important; +} + +.anbu-table-first +{ + background-color:#eee !important; + border-right:1px solid #ccc !important; + width:10% !important; +} + +span.anbu-count +{ + margin-left:0.5em !important; + background-color:#555 !important; + display:inline-block !important; + padding:0.1em 0.5em 0.2em 0.5em !important; + color:#eee !important; + text-shadow:0 0 4px #000 !important; + -webkit-border-radius: 1px; + -moz-border-radius: 1px; + border-radius: 1px; + -moz-background-clip: padding; -webkit-background-clip: padding-box; background-clip: padding-box; + +} + +.anbu-empty +{ + display:block !important; + padding:1em !important; + text-align:center !important; + font-style:italic !important; + color:#ccc !important; + margin:1em !important; + text-shadow:0 1px 0px #fff !important; +} + +.anbu pre +{ + overflow-x: auto; + white-space: pre-wrap; + white-space: -moz-pre-wrap !important; + white-space: -pre-wrap; + white-space: -o-pre-wrap; + word-wrap: break-word; +} diff --git a/laravel/anbu/anbu.js b/laravel/anbu/anbu.js new file mode 100755 index 00000000..8f86fe35 --- /dev/null +++ b/laravel/anbu/anbu.js @@ -0,0 +1,174 @@ +/* +Anbu Profiler +Copyright 2012 Dayle Rees. +MIT License +Intended for inclusion with the Laravel PHP Framework. +*/ + +var anbu = { + + // BOUND ELEMENTS + // ------------------------------------------------------------- + // Binding these elements early, stops jQuery from "querying" + // the DOM every time they are used. + + el : { + main : $('.anbu'), + close : $('#anbu-close'), + zoom : $('#anbu-zoom'), + hide : $('#anbu-hide'), + show : $('#anbu-show'), + tab_pane : $('.anbu-tab-pane'), + hidden_tab_pane : $('.anbu-tab-pane:visible'), + tab : $('.anbu-tab'), + tabs : $('.anbu-tabs'), + tab_links : $('.anbu-tabs a'), + window : $('.anbu-window'), + closed_tabs : $('#anbu-closed-tabs'), + open_tabs : $('#anbu-open-tabs'), + content_area : $('.anbu-content-area') + }, + + // CLASS ATTRIBUTES + // ------------------------------------------------------------- + // Useful variable for Anbu. + + isZoomed : false, // is anbu in full screen mode + small_height : $('.anbu-content-area').height(), // initial height of content area + active_tab : 'anbu-active-tab', // the name of the active tab css + tab_data : 'data-anbu-tab', // the data attribute of the tab link + mini_button_width : '2.6em', // size of anbu when compact + window_open : false, // is the top window open? + active_pane : '', // current active pane + + // START() + // ------------------------------------------------------------- + // Sets up all the binds for Anbu! + + start : function () + { + // hide initial elements + + anbu.el.close.hide(); + anbu.el.zoom.hide(); + anbu.el.tab_pane.hide(); + + // bind all click events + anbu.el.close.click( function () { anbu.close_window(); }); + anbu.el.hide.click( function () { anbu.hide(); }); + anbu.el.show.click( function () { anbu.show(); }); + anbu.el.zoom.click( function () { anbu.zoom(); }); + anbu.el.tab.click( function () { anbu.clicked_tab($(this)); }); + }, + + // CLICKED_TAB() + // ------------------------------------------------------------- + // A tab has been clicked, decide what to do. + + clicked_tab : function (tab) + { + // if the tab is closed + if(anbu.window_open && anbu.active_pane == tab.attr(anbu.tab_data)) + { + anbu.close_window(); + } + else + { + anbu.open_window(tab); + } + }, + + // OPEN_WINDOW() + // ------------------------------------------------------------- + // Animate open the top window to the appropriate tab. + + open_window : function (tab) + { + // can't directly assign this line, but it works + $('.anbu-tab-pane:visible').fadeOut(200); + $('.' + tab.attr(anbu.tab_data)).delay(220).fadeIn(300); + anbu.el.tab_links.removeClass(anbu.active_tab); + tab.addClass(anbu.active_tab); + anbu.el.window.slideDown(300); + anbu.el.close.fadeIn(300); + anbu.el.zoom.fadeIn(300); + anbu.active_pane = tab.attr(anbu.tab_data); + anbu.window_open = true; + }, + + + // CLOSE_WINDOW() + // ------------------------------------------------------------- + // Animate closed the top window hiding all tabs. + + close_window : function() + { + anbu.el.tab_pane.fadeOut(100); + anbu.el.window.slideUp(300); + anbu.el.close.fadeOut(300); + anbu.el.zoom.fadeOut(300); + anbu.el.tab_links.removeClass(anbu.active_tab); + anbu.active_pane = ''; + anbu.window_open = false; + }, + + + // SHOW() + // ------------------------------------------------------------- + // Show the Anbu toolbar when it has been compacted. + + show : function () + { + anbu.el.closed_tabs.fadeOut(600, function () { + anbu.el.open_tabs.fadeIn(200); + }) + anbu.el.main.animate({width: '100%'}, 700); + }, + + // HIDE() + // ------------------------------------------------------------- + // Hide the anbu toolbar, show a tiny re-open button. + + hide : function () + { + anbu.close_window(); + anbu.el.window.slideUp(400, function () { + anbu.close_window(); + anbu.el.open_tabs.fadeOut(200, function () { + anbu.el.closed_tabs.fadeIn(200); + }) + anbu.el.main.animate({width: anbu.mini_button_width}, 700); + }); + + }, + + // TOGGLEZOOM() + // ------------------------------------------------------------- + // Toggle the zoomed mode of the top window. + + zoom : function () + { + if(anbu.isZoomed) + { + height = anbu.small_height; + anbu.isZoomed = false; + } + else + { + // the 6px is padding on the top of the window + height = ($(window).height() - anbu.el.tabs.height() - 6) + 'px'; + anbu.isZoomed = true; + } + + anbu.el.content_area.animate({height: height}, 700); + } + +} + + +jQuery(document).ready(function () { + // launch anbu + anbu.start(); +}); + + diff --git a/laravel/anbu/anbu.php b/laravel/anbu/anbu.php new file mode 100755 index 00000000..693d4b03 --- /dev/null +++ b/laravel/anbu/anbu.php @@ -0,0 +1,97 @@ + + * @copyright 2012 Dayle Rees + * @license MIT License + */ +class Anbu { + + /** + * An array of log entries recorded. + * + * @var array + */ + private static $logs = array(); + + /** + * Am array of SQL queries executed. + * + * @var array + */ + private static $queries = array(); + + + /** + * Render Anbu, assign view params and echo out the main view. + * + * @return void + */ + public static function render() + { + $data = array( + 'anbu_logs' => static::$logs, + 'anbu_queries' => static::$queries, + 'anbu_css' => File::get(path('sys').'anbu/anbu.css'), + 'anbu_js' => File::get(path('sys').'anbu/anbu.js'), + 'anbu_config' => Config::get('anbu') + ); + + echo View::make('path: '.path('sys').'anbu/template.php', $data)->render(); + } + + /** + * Add a log entry to the log entries array. + * + * @return void + */ + public static function log($type, $message) + { + static::$logs[] = array($type, $message); + } + + /** + * Add a performed SQL query to Anbu. + * + * @param string $sql + * @param array $bindings + * @param float $time + * @return void + */ + public static function sql($sql, $bindings, $time) + { + // I used this method to swap in the bindings, its very ugly + // will be replaced later, hopefully will find something in + // the core + foreach ($bindings as $b) + { + $count = 1; + $sql = str_replace('?', '`'.$b.'`', $sql,$count); + } + + static::$queries[] = array($sql, $time); + } + + /** + * Start Anbu's event listeners. + * + * @return void + */ + public static function register() + { + // load the event listeners from a closure in the + // anbu config file, this allows the user to easily + // modify them + $listener = Config::get('anbu.event_listeners'); + $listener(); + } + +} diff --git a/laravel/anbu/template.php b/laravel/anbu/template.php new file mode 100755 index 00000000..bb767e3e --- /dev/null +++ b/laravel/anbu/template.php @@ -0,0 +1,63 @@ + + +
+
+
+ +
+ + + + + + + + + + + + +
TypeMessage
+ + There are no log entries. + +
+ + +
+ + + + + + + + + + + + +
TimeQuery
ms
+ + There have been no SQL queries executed. + +
+ + +
+
+ + + +
+ + + From 8d16ce8d812d6150120fbdbf77434b26819f0a5d Mon Sep 17 00:00:00 2001 From: Dayle Rees Date: Wed, 28 Mar 2012 11:09:11 +0100 Subject: [PATCH 02/32] adding the anbu alias Signed-off-by: Dayle Rees --- application/config/application.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) mode change 100644 => 100755 application/config/application.php diff --git a/application/config/application.php b/application/config/application.php old mode 100644 new mode 100755 index c5f5a3ba..75af1c74 --- a/application/config/application.php +++ b/application/config/application.php @@ -116,6 +116,7 @@ */ 'aliases' => array( + 'Anbu' => 'Laravel\\Anbu\\Anbu', 'Auth' => 'Laravel\\Auth', 'Asset' => 'Laravel\\Asset', 'Autoloader' => 'Laravel\\Autoloader', @@ -157,4 +158,4 @@ 'View' => 'Laravel\\View', ), -); \ No newline at end of file +); From daea5fee2db3cf030796ec5463577688cadc3d8c Mon Sep 17 00:00:00 2001 From: Dayle Rees Date: Thu, 29 Mar 2012 21:18:06 +0100 Subject: [PATCH 03/32] changed anbu to load automatically at end of request- taylors idea --- application/config/anbu.php | 13 +++++++++++++ application/views/home/index.php | 1 - laravel/anbu/anbu.php | 9 +++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/application/config/anbu.php b/application/config/anbu.php index 9b6503ee..148d2933 100644 --- a/application/config/anbu.php +++ b/application/config/anbu.php @@ -3,6 +3,19 @@ return array( + /* + |-------------------------------------------------------------------------- + | Enable Anbu + |-------------------------------------------------------------------------- + | + | This will cause anbu to be rendered on every request, if you would prefer + | to enable anbu in your templates manually, simply add Anbu::render(); + | after the tag. + | + */ + + 'enable' => true, + /* |-------------------------------------------------------------------------- | Show the LOG tab. diff --git a/application/views/home/index.php b/application/views/home/index.php index 980248f3..562a72bb 100755 --- a/application/views/home/index.php +++ b/application/views/home/index.php @@ -88,7 +88,6 @@ -

Welcome To Laravel

diff --git a/laravel/anbu/anbu.php b/laravel/anbu/anbu.php index 693d4b03..e2e7c4e7 100755 --- a/laravel/anbu/anbu.php +++ b/laravel/anbu/anbu.php @@ -3,6 +3,7 @@ use Laravel\View; use Laravel\File; use Laravel\Config; +use Laravel\Event; /** * Anbu, the light weight profiler for Laravel. @@ -92,6 +93,14 @@ public static function register() // modify them $listener = Config::get('anbu.event_listeners'); $listener(); + + // echo anbu on laravel.done if enabled + if(Config::get('anbu.enable')) + { + Event::listen('laravel.done', function() { + Anbu::render(); + }); + } } } From 63a3e2b5eeaac0a64820cb0f30b9c84ecc85f0b5 Mon Sep 17 00:00:00 2001 From: Dayle Rees Date: Tue, 3 Apr 2012 09:08:39 +0100 Subject: [PATCH 04/32] better line-height on code samples --- public/laravel/css/style.css | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/laravel/css/style.css b/public/laravel/css/style.css index b98816df..8460fea9 100755 --- a/public/laravel/css/style.css +++ b/public/laravel/css/style.css @@ -218,7 +218,12 @@ pre font-size:0.8em; background-color:#f5f5f5; text-shadow:1px 1px 0 #fff; - line-height:1.7em; + line-height:1.5em; +} + +.content pre li +{ + margin:0.2em 0; } code From 6f8e3259f02ec05cf7c34220939c12a5e6cd77e4 Mon Sep 17 00:00:00 2001 From: Dayle Rees Date: Tue, 3 Apr 2012 09:46:09 +0100 Subject: [PATCH 05/32] added welcome view with link to docs --- application/views/home/index.blade.php | 59 +++++++++++ application/views/home/index.php | 129 ------------------------- public/laravel/css/style.css | 23 +++++ 3 files changed, 82 insertions(+), 129 deletions(-) create mode 100644 application/views/home/index.blade.php delete mode 100644 application/views/home/index.php diff --git a/application/views/home/index.blade.php b/application/views/home/index.blade.php new file mode 100644 index 00000000..47782ff6 --- /dev/null +++ b/application/views/home/index.blade.php @@ -0,0 +1,59 @@ + + + + + + Laravel: A Framework For Web Artisans + + {{ HTML::style('laravel/css/style.css') }} + + +
+
+

Laravel

+

A Framework For Web Artisans

+ +

+ You have successfully installed the Laravel framework. Laravel is a simple framework + that helps web artisans create beautiful, creative applications using elegant, expressive + syntax. You'll love using it. +

+
+
+
+

Learn the terrain.

+ +

+ You've landed yourself on our default home page. The route that + is generating this page lives at: +

+ +
{{ path('app') }}routes.php
+ +

And the view sitting before you can be found at:

+ +
{{ path('app') }}views/home/index.php
+ +

Read the docs.

+ +

+ The docs are now included with the source package, you can {{ HTML::link('docs', 'read them offline here') }}. +

+ +

Create something beautiful.

+ +

+ Now that you're up and running, it's time to start creating! + Here are some links to help you get started: +

+ + +
+
+
+ + diff --git a/application/views/home/index.php b/application/views/home/index.php deleted file mode 100644 index 156c36ab..00000000 --- a/application/views/home/index.php +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - Laravel - A Framework For Web Artisans - - - - -
-

Welcome To Laravel

- -

A Framework For Web Artisans

- -

- You have successfully installed the Laravel framework. Laravel is a simple framework - that helps web artisans create beautiful, creative applications using elegant, expressive - syntax. You'll love using it. -

- -

Learn the terrain.

- -

- You've landed yourself on our default home page. The route that - is generating this page lives at: -

- -
APP_PATH/routes.php
- -

And the view sitting before you can be found at:

- -
APP_PATH/views/home/index.php
- -

Create something beautiful.

- -

- Now that you're up and running, it's time to start creating! - Here are some links to help you get started: -

- - -
- - \ No newline at end of file diff --git a/public/laravel/css/style.css b/public/laravel/css/style.css index 8460fea9..f7b9a608 100755 --- a/public/laravel/css/style.css +++ b/public/laravel/css/style.css @@ -235,6 +235,29 @@ code text-shadow:1px 1px 0 #fff; } +.home +{ + font-size:1.1em; +} + +.out-links +{ + margin:0; + padding:0; +} + +.out-links li +{ + display:inline-block; +} + +.out-links li:not(:first-child):before +{ + content:"/"; + padding:0 1em; + color:#888; +} + /* Prettify Styles -------------- */ From 3d23303aeaaea7ae5ded441dbd01240b1c3f5eef Mon Sep 17 00:00:00 2001 From: Jason Lewis Date: Tue, 3 Apr 2012 19:57:01 +1000 Subject: [PATCH 06/32] Includes use render to prevent WSOD --- laravel/blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laravel/blade.php b/laravel/blade.php index 7e6d33c9..e3111d09 100644 --- a/laravel/blade.php +++ b/laravel/blade.php @@ -264,7 +264,7 @@ protected static function compile_includes($value) { $pattern = static::matcher('include'); - return preg_replace($pattern, '$1with(get_defined_vars()); ?>', $value); + return preg_replace($pattern, '$1with(get_defined_vars())->render(); ?>', $value); } /** From edbac90ce3a21ba513022e9d6ab7e52d8f8bbbe5 Mon Sep 17 00:00:00 2001 From: Dayle Rees Date: Tue, 3 Apr 2012 11:30:00 +0100 Subject: [PATCH 07/32] added back to top widget --- bundles/docs/views/template.blade.php | 1 + public/laravel/css/style.css | 21 +++ public/laravel/js/scroll.js | 236 ++++++++++++++++++++++++++ 3 files changed, 258 insertions(+) create mode 100644 public/laravel/js/scroll.js diff --git a/bundles/docs/views/template.blade.php b/bundles/docs/views/template.blade.php index 44c6ff87..e49556d3 100644 --- a/bundles/docs/views/template.blade.php +++ b/bundles/docs/views/template.blade.php @@ -29,6 +29,7 @@
+ {{ HTML::script('http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js') }} {{ Asset::container('footer')->scripts(); }} diff --git a/public/laravel/css/style.css b/public/laravel/css/style.css index f7b9a608..acb53a0f 100755 --- a/public/laravel/css/style.css +++ b/public/laravel/css/style.css @@ -258,6 +258,27 @@ .out-links li:not(:first-child):before color:#888; } +#toTop +{ + display:block; + padding:0.2em 1em 0.05em 1em; + position:fixed; + top:1.2em; + right:1.2em; + background-color:#777; + text-align:center; + color:#fff; + text-decoration:none; + text-transform:uppercase; + font-size:0.9em; + border-radius:3px; +} + +#toTop:hover +{ + background-color:#E3591E; +} + /* Prettify Styles -------------- */ diff --git a/public/laravel/js/scroll.js b/public/laravel/js/scroll.js new file mode 100644 index 00000000..1a4e9f05 --- /dev/null +++ b/public/laravel/js/scroll.js @@ -0,0 +1,236 @@ + +/* + * jQuery EasIng v1.1.2 - http://gsgd.co.uk/sandbox/jquery.easIng.php + * + * Uses the built In easIng capabilities added In jQuery 1.1 + * to offer multiple easIng options + * + * Copyright (c) 2007 George Smith + * Licensed under the MIT License: + * http://www.opensource.org/licenses/mit-license.php + */ + +// t: current time, b: begInnIng value, c: change In value, d: duration + +jQuery.extend( jQuery.easing, +{ + easeInQuad: function (x, t, b, c, d) { + return c*(t/=d)*t + b; + }, + easeOutQuad: function (x, t, b, c, d) { + return -c *(t/=d)*(t-2) + b; + }, + easeInOutQuad: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t + b; + return -c/2 * ((--t)*(t-2) - 1) + b; + }, + easeInCubic: function (x, t, b, c, d) { + return c*(t/=d)*t*t + b; + }, + easeOutCubic: function (x, t, b, c, d) { + return c*((t=t/d-1)*t*t + 1) + b; + }, + easeInOutCubic: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t + b; + return c/2*((t-=2)*t*t + 2) + b; + }, + easeInQuart: function (x, t, b, c, d) { + return c*(t/=d)*t*t*t + b; + }, + easeOutQuart: function (x, t, b, c, d) { + return -c * ((t=t/d-1)*t*t*t - 1) + b; + }, + easeInOutQuart: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t*t + b; + return -c/2 * ((t-=2)*t*t*t - 2) + b; + }, + easeInQuint: function (x, t, b, c, d) { + return c*(t/=d)*t*t*t*t + b; + }, + easeOutQuint: function (x, t, b, c, d) { + return c*((t=t/d-1)*t*t*t*t + 1) + b; + }, + easeInOutQuint: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; + return c/2*((t-=2)*t*t*t*t + 2) + b; + }, + easeInSine: function (x, t, b, c, d) { + return -c * Math.cos(t/d * (Math.PI/2)) + c + b; + }, + easeOutSine: function (x, t, b, c, d) { + return c * Math.sin(t/d * (Math.PI/2)) + b; + }, + easeInOutSine: function (x, t, b, c, d) { + return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; + }, + easeInExpo: function (x, t, b, c, d) { + return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; + }, + easeOutExpo: function (x, t, b, c, d) { + return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; + }, + easeInOutExpo: function (x, t, b, c, d) { + if (t==0) return b; + if (t==d) return b+c; + if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; + return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; + }, + easeInCirc: function (x, t, b, c, d) { + return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; + }, + easeOutCirc: function (x, t, b, c, d) { + return c * Math.sqrt(1 - (t=t/d-1)*t) + b; + }, + easeInOutCirc: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; + return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; + }, + easeInElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + }, + easeOutElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; + }, + easeInOutElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; + }, + easeInBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c*(t/=d)*t*((s+1)*t - s) + b; + }, + easeOutBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; + }, + easeInOutBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; + return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; + }, + easeInBounce: function (x, t, b, c, d) { + return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; + }, + easeOutBounce: function (x, t, b, c, d) { + if ((t/=d) < (1/2.75)) { + return c*(7.5625*t*t) + b; + } else if (t < (2/2.75)) { + return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; + } else if (t < (2.5/2.75)) { + return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; + } else { + return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; + } + }, + easeInOutBounce: function (x, t, b, c, d) { + if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; + return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; + } +}); + +/* +|-------------------------------------------------------------------------- +| UItoTop jQuery Plugin 1.1 +| http://www.mattvarone.com/web-design/uitotop-jquery-plugin/ +|-------------------------------------------------------------------------- +*/ + +(function($){ + $.fn.UItoTop = function(options) { + + var defaults = { + text: 'To Top', + min: 200, + inDelay:600, + outDelay:400, + containerID: 'toTop', + containerHoverID: 'toTopHover', + scrollSpeed: 1200, + easingType: 'linear' + }; + + var settings = $.extend(defaults, options); + var containerIDhash = '#' + settings.containerID; + var containerHoverIDHash = '#'+settings.containerHoverID; + + $('body').append(''+settings.text+''); + $(containerIDhash).hide().click(function(){ + $('html, body').animate({scrollTop:0}, settings.scrollSpeed, settings.easingType); + $('#'+settings.containerHoverID, this).stop().animate({'opacity': 0 }, settings.inDelay, settings.easingType); + return false; + }) + .prepend('') + .hover(function() { + $(containerHoverIDHash, this).stop().animate({ + 'opacity': 1 + }, 600, 'linear'); + }, function() { + $(containerHoverIDHash, this).stop().animate({ + 'opacity': 0 + }, 700, 'linear'); + }); + + $(window).scroll(function() { + var sd = $(window).scrollTop(); + if(typeof document.body.style.maxHeight === "undefined") { + $(containerIDhash).css({ + 'position': 'absolute', + 'top': $(window).scrollTop() + $(window).height() - 50 + }); + } + if ( sd > settings.min ) + $(containerIDhash).fadeIn(settings.inDelay); + else + $(containerIDhash).fadeOut(settings.Outdelay); + }); + +}; +})(jQuery); + + +$(document).ready(function() { + $().UItoTop({ easingType: 'easeOutQuart' }); + if ($('#docs-sidebar').length ) { + $.get('/docs/sidebar', function(data) { + $('.sidebar ul.toc').before(data); + $('.sidebar ul.toc').hide(); + var url = document.location.href; + // console.log(url); + var parent_folder = url.substr(0, url.lastIndexOf('/')); + var active = url.substr(0, url.length-document.location.hash.length); + + $('.docs.sidebar ul ul').hide(); + $('.docs.sidebar ul ul').each(function() { + $(this).parent('li').addClass('nav-close'); + var anchor = $(this).prev('a').attr('href'); + if (anchor == active.replace('http://laravel.com', '')) { + $(this).prev('a').addClass('active'); + $(this).parent('li').addClass('nav-open').removeClass('nav-close'); + $(this).show(); + } else if (anchor == parent_folder.replace('http://laravel.com', '')) { + $(this).prev('a').addClass('active'); + $(this).parent('li').addClass('nav-open').removeClass('nav-close'); + $(this).show(); + } + //console.log(anchor+' == '+parent_folder); + $(this).prev('a').bind('click', function(e) { + $(this).parent('li').toggleClass('nav-open').toggleClass('nav-close'); + $(this).next('ul').animate({opacity: 'toggle', height: 'toggle'}, "slow"); + return false; + }); + }); + }); + } // end if +}); \ No newline at end of file From 9f1bd0ca3fec9dc5352a93322e4c6b04d6f5ef68 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 3 Apr 2012 08:22:18 -0500 Subject: [PATCH 08/32] chdir if the request is not from the web. --- paths.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/paths.php b/paths.php index 152a4f79..afc2bf58 100644 --- a/paths.php +++ b/paths.php @@ -13,6 +13,14 @@ // -------------------------------------------------------------- if ( ! isset($web)) $web = false; +// -------------------------------------------------------------- +// Change to the current directory if not from the web. +// -------------------------------------------------------------- +if ( ! $web) +{ + chdir(__DIR__); +} + // -------------------------------------------------------------- // Define the directory separator for the environment. // -------------------------------------------------------------- From 5d3cc6beb0bb1ebf46384afbd6ba98d81307a960 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 3 Apr 2012 09:17:18 -0500 Subject: [PATCH 09/32] template changes. --- application/views/home/index.blade.php | 22 ++++++--- bundles/docs/routes.php | 67 ++++++++++++++++++++------ bundles/docs/views/home.blade.php | 37 -------------- bundles/docs/views/menu.blade.php | 27 ----------- bundles/docs/views/template.blade.php | 12 ++--- public/laravel/css/style.css | 19 ++++++-- 6 files changed, 85 insertions(+), 99 deletions(-) delete mode 100644 bundles/docs/views/home.blade.php delete mode 100644 bundles/docs/views/menu.blade.php diff --git a/application/views/home/index.blade.php b/application/views/home/index.blade.php index 47782ff6..dd26ad93 100644 --- a/application/views/home/index.blade.php +++ b/application/views/home/index.blade.php @@ -13,15 +13,12 @@

Laravel

A Framework For Web Artisans

-

- You have successfully installed the Laravel framework. Laravel is a simple framework - that helps web artisans create beautiful, creative applications using elegant, expressive - syntax. You'll love using it. +

-

Learn the terrain.

+

Learn the terrain.

You've landed yourself on our default home page. The route that @@ -34,13 +31,22 @@

{{ path('app') }}views/home/index.php
-

Read the docs.

+

Grow in knowledge.

- The docs are now included with the source package, you can {{ HTML::link('docs', 'read them offline here') }}. + Leaning to use Laravel is amazingly simple thanks to + its {{ HTML::link('docs', 'wonderful documentation') }}. + Here are the basics:

-

Create something beautiful.

+
    +
  • {{ HTML::link('docs/routing#the-basics', 'Defining Routes') }}
  • +
  • {{ HTML::link('docs/controllers#the-basics', 'Building Controllers') }}
  • +
  • {{ HTML::link('docs/views#the-basics', 'Creating Views') }}
  • +
  • {{ HTML::link('docs/database/eloquent', 'Eloquent ORM') }}
  • +
+ +

Create something beautiful.

Now that you're up and running, it's time to start creating! diff --git a/bundles/docs/routes.php b/bundles/docs/routes.php index 43641286..184656cc 100644 --- a/bundles/docs/routes.php +++ b/bundles/docs/routes.php @@ -1,38 +1,75 @@ add('prettify', 'laravel/js/prettify.js'); - $view->with('sidebar', Markdown(file_get_contents(path('storage').'documentation/contents.md'))); + $view->with('sidebar', document('contents')); }); +/** + * Handle the documentation homepage. + * + * This page contains the "introduction" to Laravel. + */ Route::get('(:bundle)', function() { - return View::make('docs::home'); + return View::make('docs::page')->with('content', document('home')); }); -Route::get('docs/(:any)/(:any?)', function($section, $page = null) +/** + * Handle documentation routes for sections and pages. + * + * @param string $section + * @param string $page + * @return mixed + */ +Route::get('(:bundle)/(:any)/(:any?)', function($section, $page = null) { - $root = path('storage').'documentation/'; + $file = rtrim(implode('/', func_get_args()), '/'); - $file = rtrim(implode('/', array($section, $page)), '/').'.md'; - - if (file_exists($path = $root.$file)) + // 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 + // display back out to the client for the requested doc page. + if (is_null($page) and document_exists($file.'/home')) { - $content = Markdown(file_get_contents($path)); + $file .= '/home'; } - elseif (file_exists($path = $root.$section.'/home.md')) + + if (document_exists($file)) { - $content = Markdown(file_get_contents($path)); + return View::make('docs::page')->with('content', document($file)); } else { return Response::error('404'); } - - return View::make('docs::page')->with('content', $content); }); \ No newline at end of file diff --git a/bundles/docs/views/home.blade.php b/bundles/docs/views/home.blade.php deleted file mode 100644 index 86670159..00000000 --- a/bundles/docs/views/home.blade.php +++ /dev/null @@ -1,37 +0,0 @@ -@layout('docs::template') - -@section('content') -

Learn the terrain.

- -

- You've landed yourself on our default home page. The route that - is generating this page lives in the main routes file. You can - find it here: -

- -
APP_PATH/routes.php
- - -

And the view sitting before you can be found at:

- -
APP_PATH/views/home/index.php
- -

Create something beautiful.

- -

- Now that you're up and running, it's time to start creating! - Here are some links to help you get started: -

- - -@endsection diff --git a/bundles/docs/views/menu.blade.php b/bundles/docs/views/menu.blade.php deleted file mode 100644 index 164556da..00000000 --- a/bundles/docs/views/menu.blade.php +++ /dev/null @@ -1,27 +0,0 @@ -

Documentation

- \ No newline at end of file diff --git a/bundles/docs/views/template.blade.php b/bundles/docs/views/template.blade.php index e49556d3..fd4a0a9d 100644 --- a/bundles/docs/views/template.blade.php +++ b/bundles/docs/views/template.blade.php @@ -5,8 +5,9 @@ Laravel: A Framework For Web Artisans - {{ Asset::styles(); }} - {{ Asset::scripts(); }} + + {{ HTML::style('laravel/css/style.css') }} + {{ HTML::style('laravel/js/modernizr-2.5.3.min.js') }}
@@ -14,10 +15,7 @@

Laravel

A Framework For Web Artisans

-

- You have successfully installed the Laravel framework. Laravel is a simple framework - that helps web artisans create beautiful, creative applications using elegant, expressive - syntax. You'll love using it. +

@@ -30,6 +28,6 @@
{{ HTML::script('http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js') }} - {{ Asset::container('footer')->scripts(); }} + {{ HTML::script('laravel/js/prettify.js') }} diff --git a/public/laravel/css/style.css b/public/laravel/css/style.css index acb53a0f..1b598b9b 100755 --- a/public/laravel/css/style.css +++ b/public/laravel/css/style.css @@ -141,6 +141,14 @@ .content>h2 { margin-top:2.2em; } +div.home>h2:not(:first-child) { + margin-top:2.2em; +} + +div.home>h2 { + font-size: 14pt; +} + .content>h3 { font-size: 12pt; } @@ -159,6 +167,12 @@ .content li margin-bottom:1em; } +div.home li +{ + line-height:1.5em; + margin-bottom:1em; +} + a, a:visited { color:#2972A3; @@ -235,11 +249,6 @@ code text-shadow:1px 1px 0 #fff; } -.home -{ - font-size:1.1em; -} - .out-links { margin:0; From 6ee7c1c280625979bb84e15e36c972e05b70e298 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 3 Apr 2012 09:20:59 -0500 Subject: [PATCH 10/32] tweaking docs. --- bundles/docs/views/page.blade.php | 2 +- bundles/docs/views/template.blade.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/docs/views/page.blade.php b/bundles/docs/views/page.blade.php index 9f6da707..1309e905 100644 --- a/bundles/docs/views/page.blade.php +++ b/bundles/docs/views/page.blade.php @@ -2,4 +2,4 @@ @section('content') {{ $content }} -@endsection +@endsection \ No newline at end of file diff --git a/bundles/docs/views/template.blade.php b/bundles/docs/views/template.blade.php index fd4a0a9d..2d108569 100644 --- a/bundles/docs/views/template.blade.php +++ b/bundles/docs/views/template.blade.php @@ -30,4 +30,4 @@ {{ HTML::script('http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js') }} {{ HTML::script('laravel/js/prettify.js') }} - + \ No newline at end of file From 71531e5fe92da48af7e7562145d84701b44c78d4 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 3 Apr 2012 09:22:02 -0500 Subject: [PATCH 11/32] cleaning up code. --- application/bundles.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/application/bundles.php b/application/bundles.php index a408a244..e8b8f266 100644 --- a/application/bundles.php +++ b/application/bundles.php @@ -35,8 +35,6 @@ return array( - // route the official docs - 'docs' => array( - 'handles' => 'docs' - ), + 'docs' => array('handles' => 'docs'), + ); \ No newline at end of file From 7d30d179b765e67ebf1cfec889bc1a787a634a8f Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 3 Apr 2012 09:42:30 -0500 Subject: [PATCH 12/32] update documentation. --- bundles/docs/views/template.blade.php | 1 + public/laravel/css/style.css | 2 +- storage/documentation/database/eloquent.md | 28 +++++++++++++++++++++- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/bundles/docs/views/template.blade.php b/bundles/docs/views/template.blade.php index 2d108569..02e24bd9 100644 --- a/bundles/docs/views/template.blade.php +++ b/bundles/docs/views/template.blade.php @@ -29,5 +29,6 @@
{{ HTML::script('http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js') }} {{ HTML::script('laravel/js/prettify.js') }} + {{ HTML::script('laravel/js/scroll.js') }} \ No newline at end of file diff --git a/public/laravel/css/style.css b/public/laravel/css/style.css index 1b598b9b..fb5b11fc 100755 --- a/public/laravel/css/style.css +++ b/public/laravel/css/style.css @@ -269,7 +269,7 @@ .out-links li:not(:first-child):before #toTop { - display:block; + display:none; padding:0.2em 1em 0.05em 1em; position:fixed; top:1.2em; diff --git a/storage/documentation/database/eloquent.md b/storage/documentation/database/eloquent.md index 8624b8a7..3f7f66c6 100644 --- a/storage/documentation/database/eloquent.md +++ b/storage/documentation/database/eloquent.md @@ -14,6 +14,7 @@ ## Contents - [Constraining Eager Loads](#constraining-eager-loads) - [Setter & Getter Methods](#getter-and-setter-methods) - [Mass-Assignment](#mass-assignment) +- [Converting Models To Arrays](#to-array) ## The Basics @@ -303,6 +304,10 @@ ## Inserting Related Models $user->roles()->attach($role_id); +Alternatively, you can use the `sync` method, which accepts an array of IDs to "sync" with the intermediate table. After this operation is complete, only the IDs in the array will be on the intermediate table. + + $user->roles()->sync(array(1, 2, 3)); + ## Working With Intermediate Tables @@ -457,4 +462,25 @@ ## Mass-Assignment User::accessible(array('email', 'password', 'name')); -> **Note:** Utmost caution should be taken when mass-assigning using user-input. Technical oversights could cause serious security vulnerabilities. \ No newline at end of file +> **Note:** Utmost caution should be taken when mass-assigning using user-input. Technical oversights could cause serious security vulnerabilities. + + +## Converting Models To Arrays + +When building JSON APIs, you will often need to convert your models to array so they can be easily serialized. It's really simple. + +#### Convert a model to an array: + + return json_encode($user->to_array()); + +The `to_array` method will automatically grab all of the attributes on your model, as well as any loaded relationships. + +Sometimes you may wish to limit the attributes that are included in your model's array, such as passwords. To do this, add a `hidden` attribute definition to your model: + +#### Excluding attributes from the array: + + class User extends Eloquent { + + public static $hidden = array('password'); + + } \ No newline at end of file From c31df7379b23aed0945df48a52e16366dd22abf2 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 3 Apr 2012 09:48:44 -0500 Subject: [PATCH 13/32] put change log in docs. --- changes.md => storage/documentation/changes.md | 8 ++++---- storage/documentation/contents.md | 1 + storage/documentation/database/eloquent.md | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) rename changes.md => storage/documentation/changes.md (94%) diff --git a/changes.md b/storage/documentation/changes.md similarity index 94% rename from changes.md rename to storage/documentation/changes.md index ae1d2cd2..2fedc32c 100644 --- a/changes.md +++ b/storage/documentation/changes.md @@ -1,4 +1,4 @@ -## Laravel Change Log +# Laravel Change Log ## Contents @@ -20,9 +20,9 @@ ## Laravel 3.2 - Fixed the passing of strings into the Input::except method. - Fixed replacement of optional parameters in URL::transpose method. -- Added "to_array" method to the base Eloquent model. -- Added "$hidden" static variable to the base Eloquent model. -- Added "sync" method to has_many_and_belongs_to Eloquent relationship. +- [Added `to_array` method to the base Eloquent model](/docs/database/eloquent#to-array). +- [Added `$hidden` static variable to the base Eloquent model](/docs/database/eloquent#to-array). +- [Added `sync` method to has\_many\_and\_belongs\_to Eloquent relationship](/docs/database/eloquent#sync-method). - Improved View performance by only loading contents from file once. - Fix handling of URLs beginning with has in URL::to. diff --git a/storage/documentation/contents.md b/storage/documentation/contents.md index 25d78c8a..ab0a9f1f 100644 --- a/storage/documentation/contents.md +++ b/storage/documentation/contents.md @@ -1,5 +1,6 @@ ### General - [Laravel Overview](/docs/home) +- [Change Log](/docs/changes) - [Installation & Setup](/docs/install) - [Requirements](/docs/install#requirements) - [Installation](/docs/install#installation) diff --git a/storage/documentation/database/eloquent.md b/storage/documentation/database/eloquent.md index 3f7f66c6..b0e499fb 100644 --- a/storage/documentation/database/eloquent.md +++ b/storage/documentation/database/eloquent.md @@ -304,6 +304,7 @@ ## Inserting Related Models $user->roles()->attach($role_id); + Alternatively, you can use the `sync` method, which accepts an array of IDs to "sync" with the intermediate table. After this operation is complete, only the IDs in the array will be on the intermediate table. $user->roles()->sync(array(1, 2, 3)); From fdb7b3a7f39a3baa2aa3006687e5932439a841aa Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 3 Apr 2012 09:49:24 -0500 Subject: [PATCH 14/32] put additions on top. --- storage/documentation/changes.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/documentation/changes.md b/storage/documentation/changes.md index 2fedc32c..84e695d2 100644 --- a/storage/documentation/changes.md +++ b/storage/documentation/changes.md @@ -18,11 +18,11 @@ ## Contents ## Laravel 3.2 -- Fixed the passing of strings into the Input::except method. -- Fixed replacement of optional parameters in URL::transpose method. - [Added `to_array` method to the base Eloquent model](/docs/database/eloquent#to-array). - [Added `$hidden` static variable to the base Eloquent model](/docs/database/eloquent#to-array). - [Added `sync` method to has\_many\_and\_belongs\_to Eloquent relationship](/docs/database/eloquent#sync-method). +- Fixed the passing of strings into the Input::except method. +- Fixed replacement of optional parameters in URL::transpose method. - Improved View performance by only loading contents from file once. - Fix handling of URLs beginning with has in URL::to. From e66d8943d1e34a47a3c5192245837cd5b8219a2e Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 3 Apr 2012 09:51:56 -0500 Subject: [PATCH 15/32] move documentation into bundle. --- .../documentation => bundles/docs/pages}/artisan/commands.md | 0 .../documentation => bundles/docs/pages}/artisan/tasks.md | 0 {storage/documentation => bundles/docs/pages}/auth/config.md | 0 {storage/documentation => bundles/docs/pages}/auth/usage.md | 0 {storage/documentation => bundles/docs/pages}/bundles.md | 0 {storage/documentation => bundles/docs/pages}/cache/config.md | 0 {storage/documentation => bundles/docs/pages}/cache/usage.md | 0 {storage/documentation => bundles/docs/pages}/changes.md | 0 {storage/documentation => bundles/docs/pages}/config.md | 0 {storage/documentation => bundles/docs/pages}/contents.md | 0 {storage/documentation => bundles/docs/pages}/controllers.md | 0 .../documentation => bundles/docs/pages}/database/config.md | 0 .../documentation => bundles/docs/pages}/database/eloquent.md | 0 .../documentation => bundles/docs/pages}/database/fluent.md | 0 .../docs/pages}/database/migrations.md | 0 {storage/documentation => bundles/docs/pages}/database/raw.md | 0 .../documentation => bundles/docs/pages}/database/redis.md | 0 .../documentation => bundles/docs/pages}/database/schema.md | 0 {storage/documentation => bundles/docs/pages}/encryption.md | 0 {storage/documentation => bundles/docs/pages}/events.md | 0 {storage/documentation => bundles/docs/pages}/files.md | 0 {storage/documentation => bundles/docs/pages}/home.md | 0 {storage/documentation => bundles/docs/pages}/input.md | 0 {storage/documentation => bundles/docs/pages}/install.md | 0 {storage/documentation => bundles/docs/pages}/ioc.md | 0 {storage/documentation => bundles/docs/pages}/loading.md | 0 {storage/documentation => bundles/docs/pages}/localization.md | 0 {storage/documentation => bundles/docs/pages}/logging.md | 0 {storage/documentation => bundles/docs/pages}/models.md | 0 {storage/documentation => bundles/docs/pages}/requests.md | 0 {storage/documentation => bundles/docs/pages}/routing.md | 0 .../documentation => bundles/docs/pages}/session/config.md | 0 .../documentation => bundles/docs/pages}/session/usage.md | 0 {storage/documentation => bundles/docs/pages}/strings.md | 0 {storage/documentation => bundles/docs/pages}/testing.md | 0 {storage/documentation => bundles/docs/pages}/urls.md | 0 {storage/documentation => bundles/docs/pages}/validation.md | 0 {storage/documentation => bundles/docs/pages}/views/assets.md | 0 {storage/documentation => bundles/docs/pages}/views/forms.md | 0 {storage/documentation => bundles/docs/pages}/views/home.md | 0 {storage/documentation => bundles/docs/pages}/views/html.md | 0 .../documentation => bundles/docs/pages}/views/pagination.md | 0 .../documentation => bundles/docs/pages}/views/templating.md | 0 bundles/docs/routes.php | 4 ++-- 44 files changed, 2 insertions(+), 2 deletions(-) rename {storage/documentation => bundles/docs/pages}/artisan/commands.md (100%) rename {storage/documentation => bundles/docs/pages}/artisan/tasks.md (100%) rename {storage/documentation => bundles/docs/pages}/auth/config.md (100%) rename {storage/documentation => bundles/docs/pages}/auth/usage.md (100%) rename {storage/documentation => bundles/docs/pages}/bundles.md (100%) rename {storage/documentation => bundles/docs/pages}/cache/config.md (100%) rename {storage/documentation => bundles/docs/pages}/cache/usage.md (100%) rename {storage/documentation => bundles/docs/pages}/changes.md (100%) rename {storage/documentation => bundles/docs/pages}/config.md (100%) rename {storage/documentation => bundles/docs/pages}/contents.md (100%) rename {storage/documentation => bundles/docs/pages}/controllers.md (100%) rename {storage/documentation => bundles/docs/pages}/database/config.md (100%) rename {storage/documentation => bundles/docs/pages}/database/eloquent.md (100%) rename {storage/documentation => bundles/docs/pages}/database/fluent.md (100%) rename {storage/documentation => bundles/docs/pages}/database/migrations.md (100%) rename {storage/documentation => bundles/docs/pages}/database/raw.md (100%) rename {storage/documentation => bundles/docs/pages}/database/redis.md (100%) rename {storage/documentation => bundles/docs/pages}/database/schema.md (100%) rename {storage/documentation => bundles/docs/pages}/encryption.md (100%) rename {storage/documentation => bundles/docs/pages}/events.md (100%) rename {storage/documentation => bundles/docs/pages}/files.md (100%) rename {storage/documentation => bundles/docs/pages}/home.md (100%) rename {storage/documentation => bundles/docs/pages}/input.md (100%) rename {storage/documentation => bundles/docs/pages}/install.md (100%) rename {storage/documentation => bundles/docs/pages}/ioc.md (100%) rename {storage/documentation => bundles/docs/pages}/loading.md (100%) rename {storage/documentation => bundles/docs/pages}/localization.md (100%) rename {storage/documentation => bundles/docs/pages}/logging.md (100%) rename {storage/documentation => bundles/docs/pages}/models.md (100%) rename {storage/documentation => bundles/docs/pages}/requests.md (100%) rename {storage/documentation => bundles/docs/pages}/routing.md (100%) rename {storage/documentation => bundles/docs/pages}/session/config.md (100%) rename {storage/documentation => bundles/docs/pages}/session/usage.md (100%) rename {storage/documentation => bundles/docs/pages}/strings.md (100%) rename {storage/documentation => bundles/docs/pages}/testing.md (100%) rename {storage/documentation => bundles/docs/pages}/urls.md (100%) rename {storage/documentation => bundles/docs/pages}/validation.md (100%) rename {storage/documentation => bundles/docs/pages}/views/assets.md (100%) rename {storage/documentation => bundles/docs/pages}/views/forms.md (100%) rename {storage/documentation => bundles/docs/pages}/views/home.md (100%) rename {storage/documentation => bundles/docs/pages}/views/html.md (100%) rename {storage/documentation => bundles/docs/pages}/views/pagination.md (100%) rename {storage/documentation => bundles/docs/pages}/views/templating.md (100%) diff --git a/storage/documentation/artisan/commands.md b/bundles/docs/pages/artisan/commands.md similarity index 100% rename from storage/documentation/artisan/commands.md rename to bundles/docs/pages/artisan/commands.md diff --git a/storage/documentation/artisan/tasks.md b/bundles/docs/pages/artisan/tasks.md similarity index 100% rename from storage/documentation/artisan/tasks.md rename to bundles/docs/pages/artisan/tasks.md diff --git a/storage/documentation/auth/config.md b/bundles/docs/pages/auth/config.md similarity index 100% rename from storage/documentation/auth/config.md rename to bundles/docs/pages/auth/config.md diff --git a/storage/documentation/auth/usage.md b/bundles/docs/pages/auth/usage.md similarity index 100% rename from storage/documentation/auth/usage.md rename to bundles/docs/pages/auth/usage.md diff --git a/storage/documentation/bundles.md b/bundles/docs/pages/bundles.md similarity index 100% rename from storage/documentation/bundles.md rename to bundles/docs/pages/bundles.md diff --git a/storage/documentation/cache/config.md b/bundles/docs/pages/cache/config.md similarity index 100% rename from storage/documentation/cache/config.md rename to bundles/docs/pages/cache/config.md diff --git a/storage/documentation/cache/usage.md b/bundles/docs/pages/cache/usage.md similarity index 100% rename from storage/documentation/cache/usage.md rename to bundles/docs/pages/cache/usage.md diff --git a/storage/documentation/changes.md b/bundles/docs/pages/changes.md similarity index 100% rename from storage/documentation/changes.md rename to bundles/docs/pages/changes.md diff --git a/storage/documentation/config.md b/bundles/docs/pages/config.md similarity index 100% rename from storage/documentation/config.md rename to bundles/docs/pages/config.md diff --git a/storage/documentation/contents.md b/bundles/docs/pages/contents.md similarity index 100% rename from storage/documentation/contents.md rename to bundles/docs/pages/contents.md diff --git a/storage/documentation/controllers.md b/bundles/docs/pages/controllers.md similarity index 100% rename from storage/documentation/controllers.md rename to bundles/docs/pages/controllers.md diff --git a/storage/documentation/database/config.md b/bundles/docs/pages/database/config.md similarity index 100% rename from storage/documentation/database/config.md rename to bundles/docs/pages/database/config.md diff --git a/storage/documentation/database/eloquent.md b/bundles/docs/pages/database/eloquent.md similarity index 100% rename from storage/documentation/database/eloquent.md rename to bundles/docs/pages/database/eloquent.md diff --git a/storage/documentation/database/fluent.md b/bundles/docs/pages/database/fluent.md similarity index 100% rename from storage/documentation/database/fluent.md rename to bundles/docs/pages/database/fluent.md diff --git a/storage/documentation/database/migrations.md b/bundles/docs/pages/database/migrations.md similarity index 100% rename from storage/documentation/database/migrations.md rename to bundles/docs/pages/database/migrations.md diff --git a/storage/documentation/database/raw.md b/bundles/docs/pages/database/raw.md similarity index 100% rename from storage/documentation/database/raw.md rename to bundles/docs/pages/database/raw.md diff --git a/storage/documentation/database/redis.md b/bundles/docs/pages/database/redis.md similarity index 100% rename from storage/documentation/database/redis.md rename to bundles/docs/pages/database/redis.md diff --git a/storage/documentation/database/schema.md b/bundles/docs/pages/database/schema.md similarity index 100% rename from storage/documentation/database/schema.md rename to bundles/docs/pages/database/schema.md diff --git a/storage/documentation/encryption.md b/bundles/docs/pages/encryption.md similarity index 100% rename from storage/documentation/encryption.md rename to bundles/docs/pages/encryption.md diff --git a/storage/documentation/events.md b/bundles/docs/pages/events.md similarity index 100% rename from storage/documentation/events.md rename to bundles/docs/pages/events.md diff --git a/storage/documentation/files.md b/bundles/docs/pages/files.md similarity index 100% rename from storage/documentation/files.md rename to bundles/docs/pages/files.md diff --git a/storage/documentation/home.md b/bundles/docs/pages/home.md similarity index 100% rename from storage/documentation/home.md rename to bundles/docs/pages/home.md diff --git a/storage/documentation/input.md b/bundles/docs/pages/input.md similarity index 100% rename from storage/documentation/input.md rename to bundles/docs/pages/input.md diff --git a/storage/documentation/install.md b/bundles/docs/pages/install.md similarity index 100% rename from storage/documentation/install.md rename to bundles/docs/pages/install.md diff --git a/storage/documentation/ioc.md b/bundles/docs/pages/ioc.md similarity index 100% rename from storage/documentation/ioc.md rename to bundles/docs/pages/ioc.md diff --git a/storage/documentation/loading.md b/bundles/docs/pages/loading.md similarity index 100% rename from storage/documentation/loading.md rename to bundles/docs/pages/loading.md diff --git a/storage/documentation/localization.md b/bundles/docs/pages/localization.md similarity index 100% rename from storage/documentation/localization.md rename to bundles/docs/pages/localization.md diff --git a/storage/documentation/logging.md b/bundles/docs/pages/logging.md similarity index 100% rename from storage/documentation/logging.md rename to bundles/docs/pages/logging.md diff --git a/storage/documentation/models.md b/bundles/docs/pages/models.md similarity index 100% rename from storage/documentation/models.md rename to bundles/docs/pages/models.md diff --git a/storage/documentation/requests.md b/bundles/docs/pages/requests.md similarity index 100% rename from storage/documentation/requests.md rename to bundles/docs/pages/requests.md diff --git a/storage/documentation/routing.md b/bundles/docs/pages/routing.md similarity index 100% rename from storage/documentation/routing.md rename to bundles/docs/pages/routing.md diff --git a/storage/documentation/session/config.md b/bundles/docs/pages/session/config.md similarity index 100% rename from storage/documentation/session/config.md rename to bundles/docs/pages/session/config.md diff --git a/storage/documentation/session/usage.md b/bundles/docs/pages/session/usage.md similarity index 100% rename from storage/documentation/session/usage.md rename to bundles/docs/pages/session/usage.md diff --git a/storage/documentation/strings.md b/bundles/docs/pages/strings.md similarity index 100% rename from storage/documentation/strings.md rename to bundles/docs/pages/strings.md diff --git a/storage/documentation/testing.md b/bundles/docs/pages/testing.md similarity index 100% rename from storage/documentation/testing.md rename to bundles/docs/pages/testing.md diff --git a/storage/documentation/urls.md b/bundles/docs/pages/urls.md similarity index 100% rename from storage/documentation/urls.md rename to bundles/docs/pages/urls.md diff --git a/storage/documentation/validation.md b/bundles/docs/pages/validation.md similarity index 100% rename from storage/documentation/validation.md rename to bundles/docs/pages/validation.md diff --git a/storage/documentation/views/assets.md b/bundles/docs/pages/views/assets.md similarity index 100% rename from storage/documentation/views/assets.md rename to bundles/docs/pages/views/assets.md diff --git a/storage/documentation/views/forms.md b/bundles/docs/pages/views/forms.md similarity index 100% rename from storage/documentation/views/forms.md rename to bundles/docs/pages/views/forms.md diff --git a/storage/documentation/views/home.md b/bundles/docs/pages/views/home.md similarity index 100% rename from storage/documentation/views/home.md rename to bundles/docs/pages/views/home.md diff --git a/storage/documentation/views/html.md b/bundles/docs/pages/views/html.md similarity index 100% rename from storage/documentation/views/html.md rename to bundles/docs/pages/views/html.md diff --git a/storage/documentation/views/pagination.md b/bundles/docs/pages/views/pagination.md similarity index 100% rename from storage/documentation/views/pagination.md rename to bundles/docs/pages/views/pagination.md diff --git a/storage/documentation/views/templating.md b/bundles/docs/pages/views/templating.md similarity index 100% rename from storage/documentation/views/templating.md rename to bundles/docs/pages/views/templating.md diff --git a/bundles/docs/routes.php b/bundles/docs/routes.php index 184656cc..30812899 100644 --- a/bundles/docs/routes.php +++ b/bundles/docs/routes.php @@ -13,7 +13,7 @@ */ function document($page) { - return Markdown(file_get_contents(path('storage').'documentation/'.$page.'.md')); + return Markdown(file_get_contents(__DIR__.'/pages/'.$page.'.md')); } /** @@ -24,7 +24,7 @@ function document($page) */ function document_exists($page) { - return file_exists(path('storage').'documentation/'.$page.'.md'); + return file_exists(__DIR__.'/pages/'.$page.'.md'); } /** From 6735631cc1c5bed7a5fc319b6ecc7b961ef20e46 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 3 Apr 2012 09:53:33 -0500 Subject: [PATCH 16/32] tweaking style. --- application/views/home/index.blade.php | 2 +- public/laravel/css/style.css | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/application/views/home/index.blade.php b/application/views/home/index.blade.php index dd26ad93..0d3ec538 100644 --- a/application/views/home/index.blade.php +++ b/application/views/home/index.blade.php @@ -39,7 +39,7 @@ Here are the basics:

-
    +