404 Error
5 |The requested page was not found.
6 |├── .gitattributes ├── .gitignore ├── app ├── commands │ ├── .gitkeep │ ├── AppInstallCommand.php │ ├── AppRefreshCommand.php │ └── AppSeedCommand.php ├── config │ ├── app.php │ ├── auth.php │ ├── cache.php │ ├── compile.php │ ├── database.php │ ├── mail.php │ ├── packages │ │ └── .gitkeep │ ├── queue.php │ ├── session.php │ ├── testing │ │ ├── cache.php │ │ └── session.php │ ├── view.php │ └── workbench.php ├── controllers │ ├── .gitkeep │ ├── BaseController.php │ └── admin │ │ ├── ArticlesController.php │ │ ├── AuthController.php │ │ └── PagesController.php ├── database │ ├── migrations │ │ ├── .gitkeep │ │ ├── 2013_04_10_120429_create_articles_table.php │ │ └── 2013_04_10_120446_create_pages_table.php │ ├── production.sqlite │ └── seeds │ │ ├── .gitkeep │ │ ├── ContentSeeder.php │ │ ├── DatabaseSeeder.php │ │ └── SentrySeeder.php ├── facades │ └── ImageFacade.php ├── filters.php ├── lang │ └── en │ │ ├── pagination.php │ │ ├── reminders.php │ │ └── validation.php ├── models │ ├── Article.php │ ├── Page.php │ └── User.php ├── routes.php ├── services │ ├── Image.php │ └── validators │ │ ├── ArticleValidator.php │ │ ├── PageValidator.php │ │ └── Validator.php ├── start │ ├── artisan.php │ ├── global.php │ └── local.php ├── storage │ ├── .gitignore │ ├── cache │ │ └── .gitignore │ ├── logs │ │ └── .gitignore │ ├── meta │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ └── views │ │ └── .gitignore ├── tests │ ├── ExampleTest.php │ └── TestCase.php └── views │ ├── admin │ ├── _layouts │ │ └── default.blade.php │ ├── _partials │ │ ├── assets.blade.php │ │ ├── header.blade.php │ │ ├── navigation.blade.php │ │ └── notifications.blade.php │ ├── articles │ │ ├── create.blade.php │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ └── show.blade.php │ ├── auth │ │ └── login.blade.php │ └── pages │ │ ├── create.blade.php │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ └── show.blade.php │ ├── emails │ └── auth │ │ └── reminder.blade.php │ └── hello.blade.php ├── artisan ├── bootstrap ├── autoload.php ├── paths.php └── start.php ├── composer.json ├── public ├── .htaccess ├── assets │ ├── css │ │ ├── bootstrap-responsive.min.css │ │ ├── bootstrap.min.css │ │ └── main.css │ └── js │ │ ├── bootstrap.min.js │ │ └── script.js ├── favicon.ico ├── index.php ├── packages │ └── .gitkeep ├── robots.txt └── site │ ├── SiteServiceProvider.php │ ├── assets │ ├── css │ │ ├── main.css │ │ └── reset.css │ ├── img │ │ ├── bg.png │ │ └── l.gif │ └── js │ │ └── script.js │ ├── routes.php │ └── views │ ├── 404.blade.php │ ├── _partials │ ├── footer.blade.php │ ├── header.blade.php │ └── navigation.blade.php │ ├── article.blade.php │ ├── articles.blade.php │ ├── index.blade.php │ └── page.blade.php ├── readme.md └── server.php /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /bootstrap/compiled.php 2 | /vendor 3 | /public/uploads 4 | composer.phar 5 | composer.lock 6 | .DS_Store 7 | _article 8 | -------------------------------------------------------------------------------- /app/commands/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstrahija/l4-site-tutorial/15f34895815acf6a15d4a23009840327574c6ad3/app/commands/.gitkeep -------------------------------------------------------------------------------- /app/commands/AppInstallCommand.php: -------------------------------------------------------------------------------- 1 | call('migrate', array('--package' => 'cartalyst/sentry')); 44 | 45 | // App migraions 46 | $this->call('migrate'); 47 | 48 | // And seed it 49 | $this->call('app:seed'); 50 | 51 | echo 'Done.'.PHP_EOL; 52 | } 53 | 54 | /** 55 | * Get the console command arguments. 56 | * 57 | * @return array 58 | */ 59 | protected function getArguments() 60 | { 61 | return array(); 62 | } 63 | 64 | /** 65 | * Get the console command options. 66 | * 67 | * @return array 68 | */ 69 | protected function getOptions() 70 | { 71 | return array(); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /app/commands/AppRefreshCommand.php: -------------------------------------------------------------------------------- 1 | confirm('Are you sure you want to refresh your installation? You will loose all data stored in the database! [yes|no]')) 41 | { 42 | // First reset data 43 | echo 'Reseting DB...'.PHP_EOL; 44 | $this->call('migrate:reset'); 45 | echo 'Done.'.PHP_EOL.PHP_EOL; 46 | 47 | // Now install it again 48 | $this->call('app:install'); 49 | } 50 | } 51 | 52 | /** 53 | * Get the console command arguments. 54 | * 55 | * @return array 56 | */ 57 | protected function getArguments() 58 | { 59 | return array(); 60 | } 61 | 62 | /** 63 | * Get the console command options. 64 | * 65 | * @return array 66 | */ 67 | protected function getOptions() 68 | { 69 | return array(); 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /app/commands/AppSeedCommand.php: -------------------------------------------------------------------------------- 1 | call('db:seed'); 43 | echo 'Done.'.PHP_EOL.PHP_EOL; 44 | } 45 | 46 | /** 47 | * Get the console command arguments. 48 | * 49 | * @return array 50 | */ 51 | protected function getArguments() 52 | { 53 | return array(); 54 | } 55 | 56 | /** 57 | * Get the console command options. 58 | * 59 | * @return array 60 | */ 61 | protected function getOptions() 62 | { 63 | return array(); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /app/config/app.php: -------------------------------------------------------------------------------- 1 | true, 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Application URL 21 | |-------------------------------------------------------------------------- 22 | | 23 | | This URL is used by the console to properly generate URLs when using 24 | | the Artisan command line tool. You should set this to the root of 25 | | your application so that it is used when running Artisan tasks. 26 | | 27 | */ 28 | 29 | 'url' => '', 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Application Timezone 34 | |-------------------------------------------------------------------------- 35 | | 36 | | Here you may specify the default timezone for your application, which 37 | | will be used by the PHP date and date-time functions. We have gone 38 | | ahead and set this to a sensible default for you out of the box. 39 | | 40 | */ 41 | 42 | 'timezone' => 'UTC', 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Application Locale Configuration 47 | |-------------------------------------------------------------------------- 48 | | 49 | | The application locale determines the default locale that will be used 50 | | by the translation service provider. You are free to set this value 51 | | to any of the locales which will be supported by the application. 52 | | 53 | */ 54 | 55 | 'locale' => 'en', 56 | 57 | /* 58 | |-------------------------------------------------------------------------- 59 | | Encryption Key 60 | |-------------------------------------------------------------------------- 61 | | 62 | | This key is used by the Illuminate encrypter service and should be set 63 | | to a random, long string, otherwise these encrypted values will not 64 | | be safe. Make sure to change it before deploying any application! 65 | | 66 | */ 67 | 68 | 'key' => 'haxe0ghe5qua5fa4hyth9ri0fofu7biv', 69 | 70 | /* 71 | |-------------------------------------------------------------------------- 72 | | Autoloaded Service Providers 73 | |-------------------------------------------------------------------------- 74 | | 75 | | The service providers listed here will be automatically loaded on the 76 | | request to your application. Feel free to add your own services to 77 | | this array to grant expanded functionality to your applications. 78 | | 79 | */ 80 | 81 | 'providers' => array( 82 | 83 | 'Illuminate\Foundation\Providers\ArtisanServiceProvider', 84 | 'Illuminate\Auth\AuthServiceProvider', 85 | 'Illuminate\Cache\CacheServiceProvider', 86 | 'Illuminate\Foundation\Providers\CommandCreatorServiceProvider', 87 | 'Illuminate\Session\CommandsServiceProvider', 88 | 'Illuminate\Foundation\Providers\ComposerServiceProvider', 89 | 'Illuminate\Routing\ControllerServiceProvider', 90 | 'Illuminate\Cookie\CookieServiceProvider', 91 | 'Illuminate\Database\DatabaseServiceProvider', 92 | 'Illuminate\Encryption\EncryptionServiceProvider', 93 | 'Illuminate\Filesystem\FilesystemServiceProvider', 94 | 'Illuminate\Hashing\HashServiceProvider', 95 | 'Illuminate\Html\HtmlServiceProvider', 96 | 'Illuminate\Foundation\Providers\KeyGeneratorServiceProvider', 97 | 'Illuminate\Log\LogServiceProvider', 98 | 'Illuminate\Mail\MailServiceProvider', 99 | 'Illuminate\Foundation\Providers\MaintenanceServiceProvider', 100 | 'Illuminate\Database\MigrationServiceProvider', 101 | 'Illuminate\Foundation\Providers\OptimizeServiceProvider', 102 | 'Illuminate\Pagination\PaginationServiceProvider', 103 | 'Illuminate\Foundation\Providers\PublisherServiceProvider', 104 | 'Illuminate\Queue\QueueServiceProvider', 105 | 'Illuminate\Redis\RedisServiceProvider', 106 | 'Illuminate\Auth\Reminders\ReminderServiceProvider', 107 | 'Illuminate\Foundation\Providers\RouteListServiceProvider', 108 | 'Illuminate\Database\SeedServiceProvider', 109 | 'Illuminate\Foundation\Providers\ServerServiceProvider', 110 | 'Illuminate\Session\SessionServiceProvider', 111 | 'Illuminate\Foundation\Providers\TinkerServiceProvider', 112 | 'Illuminate\Translation\TranslationServiceProvider', 113 | 'Illuminate\Validation\ValidationServiceProvider', 114 | 'Illuminate\View\ViewServiceProvider', 115 | 'Illuminate\Workbench\WorkbenchServiceProvider', 116 | 'Cartalyst\Sentry\SentryServiceProvider', 117 | 'Krucas\Notification\NotificationServiceProvider', 118 | 'App\Site\SiteServiceProvider', 119 | 120 | ), 121 | 122 | /* 123 | |-------------------------------------------------------------------------- 124 | | Service Provider Manifest 125 | |-------------------------------------------------------------------------- 126 | | 127 | | The service provider manifest is used by Laravel to lazy load service 128 | | providers which are not needed for each request, as well to keep a 129 | | list of all of the services. Here, you may set its storage spot. 130 | | 131 | */ 132 | 133 | 'manifest' => storage_path().'/meta', 134 | 135 | /* 136 | |-------------------------------------------------------------------------- 137 | | Class Aliases 138 | |-------------------------------------------------------------------------- 139 | | 140 | | This array of class aliases will be registered when this application 141 | | is started. However, feel free to register as many as you wish as 142 | | the aliases are "lazy" loaded so they don't hinder performance. 143 | | 144 | */ 145 | 146 | 'aliases' => array( 147 | 148 | 'App' => 'Illuminate\Support\Facades\App', 149 | 'Artisan' => 'Illuminate\Support\Facades\Artisan', 150 | 'Auth' => 'Illuminate\Support\Facades\Auth', 151 | 'Blade' => 'Illuminate\Support\Facades\Blade', 152 | 'Cache' => 'Illuminate\Support\Facades\Cache', 153 | 'ClassLoader' => 'Illuminate\Support\ClassLoader', 154 | 'Config' => 'Illuminate\Support\Facades\Config', 155 | 'Controller' => 'Illuminate\Routing\Controllers\Controller', 156 | 'Cookie' => 'Illuminate\Support\Facades\Cookie', 157 | 'Crypt' => 'Illuminate\Support\Facades\Crypt', 158 | 'DB' => 'Illuminate\Support\Facades\DB', 159 | 'Eloquent' => 'Illuminate\Database\Eloquent\Model', 160 | 'Event' => 'Illuminate\Support\Facades\Event', 161 | 'File' => 'Illuminate\Support\Facades\File', 162 | 'Form' => 'Illuminate\Support\Facades\Form', 163 | 'Hash' => 'Illuminate\Support\Facades\Hash', 164 | 'HTML' => 'Illuminate\Support\Facades\HTML', 165 | 'Input' => 'Illuminate\Support\Facades\Input', 166 | 'Lang' => 'Illuminate\Support\Facades\Lang', 167 | 'Log' => 'Illuminate\Support\Facades\Log', 168 | 'Mail' => 'Illuminate\Support\Facades\Mail', 169 | 'Paginator' => 'Illuminate\Support\Facades\Paginator', 170 | 'Password' => 'Illuminate\Support\Facades\Password', 171 | 'Queue' => 'Illuminate\Support\Facades\Queue', 172 | 'Redirect' => 'Illuminate\Support\Facades\Redirect', 173 | 'Redis' => 'Illuminate\Support\Facades\Redis', 174 | 'Request' => 'Illuminate\Support\Facades\Request', 175 | 'Response' => 'Illuminate\Support\Facades\Response', 176 | 'Route' => 'Illuminate\Support\Facades\Route', 177 | 'Schema' => 'Illuminate\Support\Facades\Schema', 178 | 'Seeder' => 'Illuminate\Database\Seeder', 179 | 'Session' => 'Illuminate\Support\Facades\Session', 180 | 'Str' => 'Illuminate\Support\Str', 181 | 'URL' => 'Illuminate\Support\Facades\URL', 182 | 'Validator' => 'Illuminate\Support\Facades\Validator', 183 | 'View' => 'Illuminate\Support\Facades\View', 184 | 'Sentry' => 'Cartalyst\Sentry\Facades\Laravel\Sentry', 185 | 'Notification' => 'Krucas\Notification\Facades\Notification', 186 | 'Article' => 'App\Models\Article', 187 | 'Page' => 'App\Models\Page', 188 | 'Image' => 'App\Facades\ImageFacade', 189 | ), 190 | 191 | ); 192 | -------------------------------------------------------------------------------- /app/config/auth.php: -------------------------------------------------------------------------------- 1 | 'eloquent', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Authentication Model 23 | |-------------------------------------------------------------------------- 24 | | 25 | | When using the "Eloquent" authentication driver, we need to know which 26 | | Eloquent model should be used to retrieve your users. Of course, it 27 | | is often just the "User" model but you may use whatever you like. 28 | | 29 | */ 30 | 31 | 'model' => 'User', 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | Authentication Table 36 | |-------------------------------------------------------------------------- 37 | | 38 | | When using the "Database" authentication driver, we need to know which 39 | | table should be used to retrieve your users. We have chosen a basic 40 | | default value but you may easily change it to any table you like. 41 | | 42 | */ 43 | 44 | 'table' => 'users', 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Password Reminder Settings 49 | |-------------------------------------------------------------------------- 50 | | 51 | | Here you may set the settings for password reminders, including a view 52 | | that should be used as your password reminder e-mail. You will also 53 | | be able to set the name of the table that holds the reset tokens. 54 | | 55 | */ 56 | 57 | 'reminder' => array( 58 | 59 | 'email' => 'emails.auth.reminder', 'table' => 'password_reminders', 60 | 61 | ), 62 | 63 | ); -------------------------------------------------------------------------------- /app/config/cache.php: -------------------------------------------------------------------------------- 1 | 'file', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | File Cache Location 23 | |-------------------------------------------------------------------------- 24 | | 25 | | When using the "file" cache driver, we need a location where the cache 26 | | files may be stored. A sensible default has been specified, but you 27 | | are free to change it to any other place on disk that you desire. 28 | | 29 | */ 30 | 31 | 'path' => storage_path().'/cache', 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | Database Cache Connection 36 | |-------------------------------------------------------------------------- 37 | | 38 | | When using the "database" cache driver you may specify the connection 39 | | that should be used to store the cached items. When this option is 40 | | null the default database connection will be utilized for cache. 41 | | 42 | */ 43 | 44 | 'connection' => null, 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Database Cache Table 49 | |-------------------------------------------------------------------------- 50 | | 51 | | When using the "database" cache driver we need to know the table that 52 | | should be used to store the cached items. A default table name has 53 | | been provided but you're free to change it however you deem fit. 54 | | 55 | */ 56 | 57 | 'table' => 'cache', 58 | 59 | /* 60 | |-------------------------------------------------------------------------- 61 | | Memcached Servers 62 | |-------------------------------------------------------------------------- 63 | | 64 | | Now you may specify an array of your Memcached servers that should be 65 | | used when utilizing the Memcached cache driver. All of the servers 66 | | should contain a value for "host", "port", and "weight" options. 67 | | 68 | */ 69 | 70 | 'memcached' => array( 71 | 72 | array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100), 73 | 74 | ), 75 | 76 | /* 77 | |-------------------------------------------------------------------------- 78 | | Cache Key Prefix 79 | |-------------------------------------------------------------------------- 80 | | 81 | | When utilizing a RAM based store such as APC or Memcached, there might 82 | | be other applications utilizing the same cache. So, we'll specify a 83 | | value to get prefixed to all our keys so we can avoid collisions. 84 | | 85 | */ 86 | 87 | 'prefix' => 'laravel', 88 | 89 | ); 90 | -------------------------------------------------------------------------------- /app/config/compile.php: -------------------------------------------------------------------------------- 1 | PDO::FETCH_CLASS, 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Default Database Connection Name 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may specify which of the database connections below you wish 24 | | to use as your default connection for all database work. Of course 25 | | you may use many connections at once using the Database library. 26 | | 27 | */ 28 | 29 | 'default' => 'mysql', 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Database Connections 34 | |-------------------------------------------------------------------------- 35 | | 36 | | Here are each of the database connections setup for your application. 37 | | Of course, examples of configuring each database platform that is 38 | | supported by Laravel is shown below to make development simple. 39 | | 40 | | 41 | | All database work in Laravel is done through the PHP PDO facilities 42 | | so make sure you have the driver for your particular database of 43 | | choice installed on your machine before you begin development. 44 | | 45 | */ 46 | 47 | 'connections' => array( 48 | 49 | 'sqlite' => array( 50 | 'driver' => 'sqlite', 51 | 'database' => __DIR__.'/../database/production.sqlite', 52 | 'prefix' => '', 53 | ), 54 | 55 | 'mysql' => array( 56 | 'driver' => 'mysql', 57 | 'host' => 'localhost', 58 | 'database' => 'l4_site', 59 | 'username' => 'root', 60 | 'password' => 'root', 61 | 'charset' => 'utf8', 62 | 'collation' => 'utf8_unicode_ci', 63 | 'prefix' => '', 64 | ), 65 | 66 | 'pgsql' => array( 67 | 'driver' => 'pgsql', 68 | 'host' => 'localhost', 69 | 'database' => 'database', 70 | 'username' => 'root', 71 | 'password' => '', 72 | 'charset' => 'utf8', 73 | 'prefix' => '', 74 | 'schema' => 'public', 75 | ), 76 | 77 | 'sqlsrv' => array( 78 | 'driver' => 'sqlsrv', 79 | 'host' => 'localhost', 80 | 'database' => 'database', 81 | 'username' => 'root', 82 | 'password' => '', 83 | 'prefix' => '', 84 | ), 85 | 86 | ), 87 | 88 | /* 89 | |-------------------------------------------------------------------------- 90 | | Migration Repository Table 91 | |-------------------------------------------------------------------------- 92 | | 93 | | This table keeps track of all the migrations that have already run for 94 | | your application. Using this information, we can determine which of 95 | | the migrations on disk have not actually be run in the databases. 96 | | 97 | */ 98 | 99 | 'migrations' => 'migrations', 100 | 101 | /* 102 | |-------------------------------------------------------------------------- 103 | | Redis Databases 104 | |-------------------------------------------------------------------------- 105 | | 106 | | Redis is an open source, fast, and advanced key-value store that also 107 | | provides a richer set of commands than a typical key-value systems 108 | | such as APC or Memcached. Laravel makes it easy to dig right in. 109 | | 110 | */ 111 | 112 | 'redis' => array( 113 | 114 | 'cluster' => true, 115 | 116 | 'default' => array( 117 | 'host' => '127.0.0.1', 118 | 'port' => 6379, 119 | 'database' => 0, 120 | ), 121 | 122 | ), 123 | 124 | ); 125 | -------------------------------------------------------------------------------- /app/config/mail.php: -------------------------------------------------------------------------------- 1 | 'smtp', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | SMTP Host Address 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may provide the host address of the SMTP server used by your 26 | | applications. A default option is provided that is compatible with 27 | | the Postmark mail service, which will provide reliable delivery. 28 | | 29 | */ 30 | 31 | 'host' => 'smtp.mailgun.org', 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | SMTP Host Port 36 | |-------------------------------------------------------------------------- 37 | | 38 | | This is the SMTP port used by your application to delivery e-mails to 39 | | users of your application. Like the host we have set this value to 40 | | stay compatible with the Postmark e-mail application by default. 41 | | 42 | */ 43 | 44 | 'port' => 587, 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Global "From" Address 49 | |-------------------------------------------------------------------------- 50 | | 51 | | You may wish for all e-mails sent by your application to be sent from 52 | | the same address. Here, you may specify a name and address that is 53 | | used globally for all e-mails that are sent by your application. 54 | | 55 | */ 56 | 57 | 'from' => array('address' => null, 'name' => null), 58 | 59 | /* 60 | |-------------------------------------------------------------------------- 61 | | E-Mail Encryption Protocol 62 | |-------------------------------------------------------------------------- 63 | | 64 | | Here you may specify the encryption protocol that should be used when 65 | | the application send e-mail messages. A sensible default using the 66 | | transport layer security protocol should provide great security. 67 | | 68 | */ 69 | 70 | 'encryption' => 'tls', 71 | 72 | /* 73 | |-------------------------------------------------------------------------- 74 | | SMTP Server Username 75 | |-------------------------------------------------------------------------- 76 | | 77 | | If your SMTP server requires a username for authentication, you should 78 | | set it here. This will get used to authenticate with your server on 79 | | connection. You may also set the "password" value below this one. 80 | | 81 | */ 82 | 83 | 'username' => null, 84 | 85 | /* 86 | |-------------------------------------------------------------------------- 87 | | SMTP Server Password 88 | |-------------------------------------------------------------------------- 89 | | 90 | | Here you may set the password required by your SMTP server to send out 91 | | messages from your application. This will be given to the server on 92 | | connection so that the application will be able to send messages. 93 | | 94 | */ 95 | 96 | 'password' => null, 97 | 98 | /* 99 | |-------------------------------------------------------------------------- 100 | | Sendmail System Path 101 | |-------------------------------------------------------------------------- 102 | | 103 | | When using the "sendmail" driver to send e-mails, we will need to know 104 | | the path to where Sendmail lives on this server. A default path has 105 | | been provided here, which will work well on most of your systems. 106 | | 107 | */ 108 | 109 | 'sendmail' => '/usr/sbin/sendmail -bs', 110 | 111 | ); 112 | -------------------------------------------------------------------------------- /app/config/packages/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstrahija/l4-site-tutorial/15f34895815acf6a15d4a23009840327574c6ad3/app/config/packages/.gitkeep -------------------------------------------------------------------------------- /app/config/queue.php: -------------------------------------------------------------------------------- 1 | 'sync', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Queue Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may configure the connection information for each server that 26 | | is used by your application. A default configuration has been added 27 | | for each back-end shipped with Laravel. You are free to add more. 28 | | 29 | */ 30 | 31 | 'connections' => array( 32 | 33 | 'sync' => array( 34 | 'driver' => 'sync', 35 | ), 36 | 37 | 'beanstalkd' => array( 38 | 'driver' => 'beanstalkd', 39 | 'host' => 'localhost', 40 | 'queue' => 'default', 41 | ), 42 | 43 | 'sqs' => array( 44 | 'driver' => 'sqs', 45 | 'key' => 'your-public-key', 46 | 'secret' => 'your-secret-key', 47 | 'queue' => 'your-queue-url', 48 | 'region' => 'us-east-1', 49 | ), 50 | 51 | 'iron' => array( 52 | 'driver' => 'iron', 53 | 'project' => 'your-project-id', 54 | 'token' => 'your-token', 55 | 'queue' => 'your-queue-name', 56 | ), 57 | 58 | ), 59 | 60 | ); 61 | -------------------------------------------------------------------------------- /app/config/session.php: -------------------------------------------------------------------------------- 1 | 'native', 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Session Lifetime 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may specify the number of minutes that you wish the session 27 | | to be allowed to remain idle for it is expired. If you want them 28 | | to immediately expire when the browser closes, set it to zero. 29 | | 30 | */ 31 | 32 | 'lifetime' => 120, 33 | 34 | /* 35 | |-------------------------------------------------------------------------- 36 | | Session File Location 37 | |-------------------------------------------------------------------------- 38 | | 39 | | When using the native session driver, we need a location where session 40 | | files may be stored. A default has been set for you but a different 41 | | location may be specified. This is only needed for file sessions. 42 | | 43 | */ 44 | 45 | 'files' => storage_path().'/sessions', 46 | 47 | /* 48 | |-------------------------------------------------------------------------- 49 | | Session Database Connection 50 | |-------------------------------------------------------------------------- 51 | | 52 | | When using the "database" session driver, you may specify the database 53 | | connection that should be used to manage your sessions. This should 54 | | correspond to a connection in your "database" configuration file. 55 | | 56 | */ 57 | 58 | 'connection' => null, 59 | 60 | /* 61 | |-------------------------------------------------------------------------- 62 | | Session Database Table 63 | |-------------------------------------------------------------------------- 64 | | 65 | | When using the "database" session driver, you may specify the table we 66 | | should use to manage the sessions. Of course, a sensible default is 67 | | provided for you; however, you are free to change this as needed. 68 | | 69 | */ 70 | 71 | 'table' => 'sessions', 72 | 73 | /* 74 | |-------------------------------------------------------------------------- 75 | | Session Sweeping Lottery 76 | |-------------------------------------------------------------------------- 77 | | 78 | | Some session drivers must manually sweep their storage location to get 79 | | rid of old sessions from storage. Here are the chances that it will 80 | | happen on a given request. By default, the odds are 2 out of 100. 81 | | 82 | */ 83 | 84 | 'lottery' => array(2, 100), 85 | 86 | /* 87 | |-------------------------------------------------------------------------- 88 | | Session Cookie Name 89 | |-------------------------------------------------------------------------- 90 | | 91 | | Here you may change the name of the cookie used to identify a session 92 | | instance by ID. The name specified here will get used every time a 93 | | new session cookie is created by the framework for every driver. 94 | | 95 | */ 96 | 97 | 'cookie' => 'laravel_session', 98 | 99 | /* 100 | |-------------------------------------------------------------------------- 101 | | Session Cookie Path 102 | |-------------------------------------------------------------------------- 103 | | 104 | | The session cookie path determines the path for which the cookie will 105 | | be regarded as available. Typically, this will be the root path of 106 | | your application but you are free to change this when necessary. 107 | | 108 | */ 109 | 110 | 'path' => '/', 111 | 112 | /* 113 | |-------------------------------------------------------------------------- 114 | | Session Cookie Domain 115 | |-------------------------------------------------------------------------- 116 | | 117 | | Here you may change the domain of the cookie used to identify a session 118 | | in your application. This will determine which domains the cookie is 119 | | available to in your application. A sensible default has been set. 120 | | 121 | */ 122 | 123 | 'domain' => null, 124 | 125 | ); 126 | -------------------------------------------------------------------------------- /app/config/testing/cache.php: -------------------------------------------------------------------------------- 1 | 'array', 19 | 20 | ); -------------------------------------------------------------------------------- /app/config/testing/session.php: -------------------------------------------------------------------------------- 1 | 'array', 20 | 21 | ); -------------------------------------------------------------------------------- /app/config/view.php: -------------------------------------------------------------------------------- 1 | array(__DIR__.'/../views'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Pagination View 21 | |-------------------------------------------------------------------------- 22 | | 23 | | This view will be used to render the pagination link output, and can 24 | | be easily customized here to show any view you like. A clean view 25 | | compatible with Twitter's Bootstrap is given to you by default. 26 | | 27 | */ 28 | 29 | 'pagination' => 'pagination::slider', 30 | 31 | ); 32 | -------------------------------------------------------------------------------- /app/config/workbench.php: -------------------------------------------------------------------------------- 1 | '', 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Workbench Author E-Mail Address 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Like the option above, your e-mail address is used when generating new 24 | | workbench packages. The e-mail is placed in your composer.json file 25 | | automatically after the package is created by the workbench tool. 26 | | 27 | */ 28 | 29 | 'email' => '', 30 | 31 | ); -------------------------------------------------------------------------------- /app/controllers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstrahija/l4-site-tutorial/15f34895815acf6a15d4a23009840327574c6ad3/app/controllers/.gitkeep -------------------------------------------------------------------------------- /app/controllers/BaseController.php: -------------------------------------------------------------------------------- 1 | layout)) 13 | { 14 | $this->layout = View::make($this->layout); 15 | } 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /app/controllers/admin/ArticlesController.php: -------------------------------------------------------------------------------- 1 | with('articles', Article::all()); 12 | } 13 | 14 | public function show($id) 15 | { 16 | return \View::make('admin.articles.show')->with('article',Article::find($id)); 17 | } 18 | 19 | public function create() 20 | { 21 | return \View::make('admin.articles.create'); 22 | } 23 | 24 | public function store() 25 | { 26 | $validation = new ArticleValidator; 27 | 28 | if ($validation->passes()) 29 | { 30 | $article = new Article; 31 | $article->title = Input::get('title'); 32 | $article->slug = Str::slug(Input::get('title')); 33 | $article->body = Input::get('body'); 34 | $article->user_id = Sentry::getUser()->id; 35 | $article->save(); 36 | 37 | // Now that we have the article ID we need to move the image 38 | if (Input::hasFile('image')) 39 | { 40 | $article->image = Image::upload(Input::file('image'), 'articles/' . $article->id); 41 | $article->save(); 42 | } 43 | 44 | Notification::success('The article was saved.'); 45 | 46 | return Redirect::route('admin.articles.edit', $article->id); 47 | } 48 | 49 | return Redirect::back()->withInput()->withErrors($validation->errors); 50 | } 51 | 52 | public function edit($id) 53 | { 54 | return \View::make('admin.articles.edit')->with('article', Article::find($id)); 55 | } 56 | 57 | public function update($id) 58 | { 59 | $validation = new ArticleValidator; 60 | 61 | if ($validation->passes()) 62 | { 63 | $article = Article::find($id); 64 | $article->title = Input::get('title'); 65 | $article->slug = Str::slug(Input::get('title')); 66 | $article->body = Input::get('body'); 67 | $article->user_id = Sentry::getUser()->id; 68 | if (Input::hasFile('image')) $article->image = Image::upload(Input::file('image'), 'articles/' . $article->id); 69 | $article->save(); 70 | 71 | Notification::success('The article was saved.'); 72 | 73 | return Redirect::route('admin.articles.edit', $article->id); 74 | } 75 | 76 | return Redirect::back()->withInput()->withErrors($validation->errors); 77 | } 78 | 79 | public function destroy($id) 80 | { 81 | $article = Article::find($id); 82 | $article->delete(); 83 | 84 | Notification::success('The article was deleted.'); 85 | 86 | return Redirect::route('admin.articles.index'); 87 | } 88 | 89 | } 90 | 91 | -------------------------------------------------------------------------------- /app/controllers/admin/AuthController.php: -------------------------------------------------------------------------------- 1 | Input::get('email'), 24 | 'password' => Input::get('password') 25 | ); 26 | 27 | try 28 | { 29 | $user = Sentry::authenticate($credentials, false); 30 | 31 | if ($user) 32 | { 33 | return Redirect::route('admin.pages.index'); 34 | } 35 | } 36 | catch(\Exception $e) 37 | { 38 | return Redirect::route('admin.login')->withErrors(array('login' => $e->getMessage())); 39 | } 40 | } 41 | 42 | /** 43 | * Logout action 44 | * @return Redirect 45 | */ 46 | public function getLogout() 47 | { 48 | Sentry::logout(); 49 | 50 | return Redirect::route('admin.login'); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /app/controllers/admin/PagesController.php: -------------------------------------------------------------------------------- 1 | with('pages', Page::all()); 12 | } 13 | 14 | public function show($id) 15 | { 16 | return \View::make('admin.pages.show')->with('page', Page::find($id)); 17 | } 18 | 19 | public function create() 20 | { 21 | return \View::make('admin.pages.create'); 22 | } 23 | 24 | public function store() 25 | { 26 | $validation = new PageValidator; 27 | 28 | if ($validation->passes()) 29 | { 30 | $page = new Page; 31 | $page->title = Input::get('title'); 32 | $page->slug = Str::slug(Input::get('title')); 33 | $page->body = Input::get('body'); 34 | $page->user_id = Sentry::getUser()->id; 35 | $page->save(); 36 | 37 | Notification::success('The page was saved.'); 38 | 39 | return Redirect::route('admin.pages.edit', $page->id); 40 | } 41 | 42 | return Redirect::back()->withInput()->withErrors($validation->errors); 43 | } 44 | 45 | public function edit($id) 46 | { 47 | return \View::make('admin.pages.edit')->with('page', Page::find($id)); 48 | } 49 | 50 | public function update($id) 51 | { 52 | $validation = new PageValidator; 53 | 54 | if ($validation->passes()) 55 | { 56 | $page = Page::find($id); 57 | $page->title = Input::get('title'); 58 | $page->slug = Str::slug(Input::get('title')); 59 | $page->body = Input::get('body'); 60 | $page->user_id = Sentry::getUser()->id; 61 | $page->save(); 62 | 63 | Notification::success('The page was saved.'); 64 | 65 | return Redirect::route('admin.pages.edit', $page->id); 66 | } 67 | 68 | return Redirect::back()->withInput()->withErrors($validation->errors); 69 | } 70 | 71 | public function destroy($id) 72 | { 73 | $page = Page::find($id); 74 | //$page->delete(); 75 | 76 | Notification::success('The page was deleted.'); 77 | 78 | return Redirect::route('admin.pages.index'); 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /app/database/migrations/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstrahija/l4-site-tutorial/15f34895815acf6a15d4a23009840327574c6ad3/app/database/migrations/.gitkeep -------------------------------------------------------------------------------- /app/database/migrations/2013_04_10_120429_create_articles_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 13 | $table->string('title'); 14 | $table->string('slug'); 15 | $table->text('body')->nullable(); 16 | $table->string('image')->nullable(); 17 | $table->integer('user_id'); 18 | $table->timestamps(); 19 | }); 20 | } 21 | 22 | public function down() 23 | { 24 | Schema::drop('articles'); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /app/database/migrations/2013_04_10_120446_create_pages_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 13 | $table->string('title'); 14 | $table->string('slug'); 15 | $table->text('body')->nullable(); 16 | $table->integer('user_id'); 17 | $table->timestamps(); 18 | }); 19 | } 20 | 21 | public function down() 22 | { 23 | Schema::drop('pages'); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /app/database/production.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstrahija/l4-site-tutorial/15f34895815acf6a15d4a23009840327574c6ad3/app/database/production.sqlite -------------------------------------------------------------------------------- /app/database/seeds/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstrahija/l4-site-tutorial/15f34895815acf6a15d4a23009840327574c6ad3/app/database/seeds/.gitkeep -------------------------------------------------------------------------------- /app/database/seeds/ContentSeeder.php: -------------------------------------------------------------------------------- 1 | truncate(); // Using truncate function so all info will be cleared when re-seeding. 11 | DB::table('pages')->truncate(); 12 | 13 | Article::create(array( 14 | 'title' => 'First post', 15 | 'slug' => 'first-post', 16 | 'body' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', 17 | 'user_id' => 1, 18 | 'created_at' => Carbon\Carbon::now()->subWeek(), 19 | 'updated_at' => Carbon\Carbon::now()->subWeek(), 20 | )); 21 | Article::create(array( 22 | 'title' => '2nd post', 23 | 'slug' => '2nd-post', 24 | 'body' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', 25 | 'user_id' => 1, 26 | 'created_at' => Carbon\Carbon::now()->subDay(), 27 | 'updated_at' => Carbon\Carbon::now()->subDay(), 28 | )); 29 | Article::create(array( 30 | 'title' => 'Third post', 31 | 'slug' => 'third-post', 32 | 'body' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', 33 | 'user_id' => 1, 34 | )); 35 | 36 | Page::create(array( 37 | 'title' => 'Welcome', 38 | 'slug' => 'welcome', 39 | 'body' => 'Welcome to the site', 40 | 'user_id' => 1, 41 | )); 42 | Page::create(array( 43 | 'title' => 'About us', 44 | 'slug' => 'about-us', 45 | 'body' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', 46 | 'user_id' => 1, 47 | )); 48 | Page::create(array( 49 | 'title' => 'Contact', 50 | 'slug' => 'contact', 51 | 'body' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', 52 | 'user_id' => 1, 53 | )); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /app/database/seeds/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call('SentrySeeder'); 10 | $this->command->info('Sentry tables seeded!'); 11 | 12 | $this->call('ContentSeeder'); 13 | $this->command->info('Content tables seeded!'); 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /app/database/seeds/SentrySeeder.php: -------------------------------------------------------------------------------- 1 | truncate(); // Using truncate function so all info will be cleared when re-seeding. 10 | DB::table('groups')->truncate(); 11 | DB::table('users_groups')->truncate(); 12 | 13 | Sentry::getUserProvider()->create(array( 14 | 'email' => 'admin@admin.com', 15 | 'password' => "admin", 16 | 'first_name' => 'John', 17 | 'last_name' => 'McClane', 18 | 'activated' => 1, 19 | )); 20 | 21 | Sentry::getGroupProvider()->create(array( 22 | 'name' => 'Admin', 23 | 'permissions' => array('admin' => 1), 24 | )); 25 | 26 | // Assign user permissions 27 | $adminUser = Sentry::getUserProvider()->findByLogin('admin@admin.com'); 28 | $adminGroup = Sentry::getGroupProvider()->findByName('Admin'); 29 | $adminUser->addGroup($adminGroup); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /app/facades/ImageFacade.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 18 | 'next' => 'Next »', 19 | 20 | ); -------------------------------------------------------------------------------- /app/lang/en/reminders.php: -------------------------------------------------------------------------------- 1 | "Passwords must be six characters and match the confirmation.", 17 | 18 | "user" => "We can't find a user with that e-mail address.", 19 | 20 | "token" => "This password reset token is invalid.", 21 | 22 | ); -------------------------------------------------------------------------------- /app/lang/en/validation.php: -------------------------------------------------------------------------------- 1 | "The :attribute must be accepted.", 17 | "active_url" => "The :attribute is not a valid URL.", 18 | "after" => "The :attribute must be a date after :date.", 19 | "alpha" => "The :attribute may only contain letters.", 20 | "alpha_dash" => "The :attribute may only contain letters, numbers, and dashes.", 21 | "alpha_num" => "The :attribute may only contain letters and numbers.", 22 | "before" => "The :attribute must be a date before :date.", 23 | "between" => array( 24 | "numeric" => "The :attribute must be between :min - :max.", 25 | "file" => "The :attribute must be between :min - :max kilobytes.", 26 | "string" => "The :attribute must be between :min - :max characters.", 27 | ), 28 | "confirmed" => "The :attribute confirmation does not match.", 29 | "date" => "The :attribute is not a valid date.", 30 | "date_format" => "The :attribute does not match the format :format.", 31 | "different" => "The :attribute and :other must be different.", 32 | "digits" => "The :attribute must be :digits digits.", 33 | "digits_between" => "The :attribute must be between :min and :max digits.", 34 | "email" => "The :attribute format is invalid.", 35 | "exists" => "The selected :attribute is invalid.", 36 | "image" => "The :attribute must be an image.", 37 | "in" => "The selected :attribute is invalid.", 38 | "integer" => "The :attribute must be an integer.", 39 | "ip" => "The :attribute must be a valid IP address.", 40 | "max" => array( 41 | "numeric" => "The :attribute may not be greater than :max.", 42 | "file" => "The :attribute may not be greater than :max kilobytes.", 43 | "string" => "The :attribute may not be greater than :max characters.", 44 | ), 45 | "mimes" => "The :attribute must be a file of type: :values.", 46 | "min" => array( 47 | "numeric" => "The :attribute must be at least :min.", 48 | "file" => "The :attribute must be at least :min kilobytes.", 49 | "string" => "The :attribute must be at least :min characters.", 50 | ), 51 | "not_in" => "The selected :attribute is invalid.", 52 | "numeric" => "The :attribute must be a number.", 53 | "regex" => "The :attribute format is invalid.", 54 | "required" => "The :attribute field is required.", 55 | "required_if" => "The :attribute field is required when :other is :value.", 56 | "required_with" => "The :attribute field is required when :values is present.", 57 | "required_without" => "The :attribute field is required when :values is not present.", 58 | "same" => "The :attribute and :other must match.", 59 | "size" => array( 60 | "numeric" => "The :attribute must be :size.", 61 | "file" => "The :attribute must be :size kilobytes.", 62 | "string" => "The :attribute must be :size characters.", 63 | ), 64 | "unique" => "The :attribute has already been taken.", 65 | "url" => "The :attribute format is invalid.", 66 | 67 | /* 68 | |-------------------------------------------------------------------------- 69 | | Custom Validation Language Lines 70 | |-------------------------------------------------------------------------- 71 | | 72 | | Here you may specify custom validation messages for attributes using the 73 | | convention "attribute.rule" to name the lines. This makes it quick to 74 | | specify a specific custom language line for a given attribute rule. 75 | | 76 | */ 77 | 78 | 'custom' => array(), 79 | 80 | /* 81 | |-------------------------------------------------------------------------- 82 | | Custom Validation Attributes 83 | |-------------------------------------------------------------------------- 84 | | 85 | | The following language lines are used to swap attribute place-holders 86 | | with something more reader friendly such as E-Mail Address instead 87 | | of "email". This simply helps us make messages a little cleaner. 88 | | 89 | */ 90 | 91 | 'attributes' => array(), 92 | 93 | ); 94 | -------------------------------------------------------------------------------- /app/models/Article.php: -------------------------------------------------------------------------------- 1 | belongsTo('App\Models\User', 'user_id'); 10 | } 11 | 12 | } 13 | 14 | -------------------------------------------------------------------------------- /app/models/Page.php: -------------------------------------------------------------------------------- 1 | belongsTo('App\Models\User', 'user_id'); 10 | } 11 | 12 | } 13 | 14 | -------------------------------------------------------------------------------- /app/models/User.php: -------------------------------------------------------------------------------- 1 | getKey(); 31 | } 32 | 33 | /** 34 | * Get the password for the user. 35 | * 36 | * @return string 37 | */ 38 | public function getAuthPassword() 39 | { 40 | return $this->password; 41 | } 42 | 43 | /** 44 | * Get the e-mail address where password reminders are sent. 45 | * 46 | * @return string 47 | */ 48 | public function getReminderEmail() 49 | { 50 | return $this->email; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /app/routes.php: -------------------------------------------------------------------------------- 1 | 'admin.logout', 'uses' => 'App\Controllers\Admin\AuthController@getLogout')); 15 | Route::get('admin/login', array('as' => 'admin.login', 'uses' => 'App\Controllers\Admin\AuthController@getLogin')); 16 | Route::post('admin/login', array('as' => 'admin.login.post', 'uses' => 'App\Controllers\Admin\AuthController@postLogin')); 17 | 18 | Route::group(array('prefix' => 'admin', 'before' => 'auth.admin'), function() 19 | { 20 | Route::any('/', 'App\Controllers\Admin\PagesController@index'); 21 | Route::resource('articles', 'App\Controllers\Admin\ArticlesController'); 22 | Route::resource('pages', 'App\Controllers\Admin\PagesController'); 23 | }); 24 | -------------------------------------------------------------------------------- /app/services/Image.php: -------------------------------------------------------------------------------- 1 | imagine) 38 | { 39 | $this->library = $library ? $library : null; 40 | 41 | // Use image magick if available 42 | if ( ! $this->library and class_exists('Imagick')) $this->library = 'imagick'; 43 | else $this->library = 'gd'; 44 | 45 | // Now create instance 46 | if ($this->library == 'imagick') $this->imagine = new \Imagine\Imagick\Imagine(); 47 | elseif ($this->library == 'gmagick') $this->imagine = new \Imagine\Gmagick\Imagine(); 48 | elseif ($this->library == 'gd') $this->imagine = new \Imagine\Gd\Imagine(); 49 | else $this->imagine = new \Imagine\Gd\Imagine(); 50 | } 51 | } 52 | 53 | /** 54 | * Resize an image 55 | * @param string $url 56 | * @param integer $width 57 | * @param integer $height 58 | * @param boolean $crop 59 | * @return string 60 | */ 61 | public function resize($url, $width = 100, $height = null, $crop = false, $quality = null) 62 | { 63 | if ($url) 64 | { 65 | // URL info 66 | $info = pathinfo($url); 67 | 68 | // The size 69 | if ( ! $height) $height = $width; 70 | 71 | // Quality 72 | $quality = ($quality) ? $quality : $this->quality; 73 | 74 | // Directories and file names 75 | $fileName = $info['basename']; 76 | $sourceDirPath = public_path() . $info['dirname']; 77 | $sourceFilePath = $sourceDirPath . '/' . $fileName; 78 | $targetDirName = $width . 'x' . $height . ($crop ? '_crop' : ''); 79 | $targetDirPath = $sourceDirPath . '/' . $targetDirName . '/'; 80 | $targetFilePath = $targetDirPath . $fileName; 81 | $targetUrl = asset($info['dirname'] . '/' . $targetDirName . '/' . $fileName); 82 | 83 | // Create directory if missing 84 | try 85 | { 86 | // Create dir if missing 87 | if ( ! File::isDirectory($targetDirPath) and $targetDirPath) @File::makeDirectory($targetDirPath); 88 | 89 | // Set the size 90 | $size = new \Imagine\Image\Box($width, $height); 91 | 92 | // Now the mode 93 | $mode = $crop ? \Imagine\Image\ImageInterface::THUMBNAIL_OUTBOUND : \Imagine\Image\ImageInterface::THUMBNAIL_INSET; 94 | 95 | if ($this->overwrite or ! File::exists($targetFilePath) or (File::lastModified($targetFilePath) < File::lastModified($sourceFilePath))) 96 | { 97 | $this->imagine->open($sourceFilePath) 98 | ->thumbnail($size, $mode) 99 | ->save($targetFilePath, array('quality' => $quality)); 100 | } 101 | } 102 | catch (\Exception $e) 103 | { 104 | Log::error('[IMAGE SERVICE] Failed to resize image "' . $url . '" [' . $e->getMessage() . ']'); 105 | } 106 | 107 | return $targetUrl; 108 | } 109 | } 110 | 111 | /** 112 | * Helper for creating thumbs 113 | * @param string $url 114 | * @param integer $width 115 | * @param integer $height 116 | * @return string 117 | */ 118 | public function thumb($url, $width, $height = null) 119 | { 120 | return $this->resize($url, $width, $height, true); 121 | } 122 | 123 | /** 124 | * Upload an image to the public storage 125 | * @param File $file 126 | * @return string 127 | */ 128 | public function upload($file, $dir = null) 129 | { 130 | if ($file) 131 | { 132 | // Generate random dir 133 | if ( ! $dir) $dir = str_random(8); 134 | 135 | // Get file info and try to move 136 | $destination = public_path() . '/uploads/' . $dir; 137 | $filename = $file->getClientOriginalName(); 138 | $path = '/uploads/' . $dir . '/' . $filename; 139 | $uploaded = $file->move($destination, $filename); 140 | 141 | if ($uploaded) return $path; 142 | } 143 | } 144 | 145 | } 146 | -------------------------------------------------------------------------------- /app/services/validators/ArticleValidator.php: -------------------------------------------------------------------------------- 1 | 'required', 7 | 'body' => 'required', 8 | ); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /app/services/validators/PageValidator.php: -------------------------------------------------------------------------------- 1 | 'required', 7 | 'body' => 'required', 8 | ); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /app/services/validators/Validator.php: -------------------------------------------------------------------------------- 1 | data = $data ?: \Input::all(); 30 | } 31 | 32 | /** 33 | * Check if validation passes 34 | * @return bool 35 | */ 36 | public function passes() 37 | { 38 | $validation = \Validator::make($this->data, static::$rules); 39 | 40 | if ($validation->passes()) return true; 41 | 42 | $this->errors = $validation->messages(); 43 | 44 | return false; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /app/start/artisan.php: -------------------------------------------------------------------------------- 1 | client->request('GET', '/'); 13 | 14 | $this->assertTrue($this->client->getResponse()->isOk()); 15 | 16 | $this->assertCount(1, $crawler->filter('h1:contains("Hello World!")')); 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /app/tests/TestCase.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |# | 17 |Title | 18 |When | 19 |20 | |
---|---|---|---|
{{ $article->id }} | 26 |{{ $article->title }} | 27 |{{ $article->created_at }} | 28 |29 | Edit 30 | 31 | {{ Form::open(array('route' => array('admin.articles.destroy', $article->id), 'method' => 'delete', 'data-confirm' => 'Are you sure?')) }} 32 | 33 | {{ Form::close() }} 34 | | 35 |
# | 17 |Title | 18 |When | 19 |20 | |
---|---|---|---|
{{ $page->id }} | 26 |{{ $page->title }} | 27 |{{ $page->created_at }} | 28 |29 | Edit 30 | 31 | {{ Form::open(array('route' => array('admin.pages.destroy', $page->id), 'method' => 'delete', 'data-confirm' => 'Are you sure?')) }} 32 | 33 | {{ Form::close() }} 34 | | 35 |
Nothing to see here, proceed to login.
61 |The requested page was not found.
6 |