<commit_before>Bootstrap CMS
=============

## Installation

[PHP](https://php.net) 5.5+ or [HHVM](http://hhvm.com) 3.6+, a database server, and [Composer](https://getcomposer.org) are required.

1. There is one ways of grabbing the code:
  * Use Git: `git clone <EMAIL>:nixsolutions/phpsu-1496.git`
2. From a command line open in the folder, run `composer install --no-dev -o` and then `npm install`.
3. Create .env file (copy entry from config/env/.env.vagrant).
4. Provide database, socials credentials and another staff in .env configuration file.
5. Enter `./vendor/bin/homestead make` in command line.
6. Let vagrant environment up in command line `vagrant up` and than `vagrant ssh`.
7. From project root (as usual you can get it by typing cd {project folder name}) under vagrant run `php artisan app:install` followed by `gulp --production` to setup the application. 
8. You will need to enter your mail server details into `config/mail.php`.
  * You can disable verification emails in `config/credentials.php`
  * Mail is still required for other functions like password resets and the contact form
  * You must set the contact email in `config/contact.php`
  * I'd recommend [queuing](#setting-up-queing) email sending for greater performance (see below)

To launch site type in your browser address line `192.168.10.10`

If you want launch site using specific domain look [here](https://laravel.com/docs/5.3/homestead).

**Admin credentials** <EMAIL>/password

## Setting Up Queuing

Bootstrap CMS uses Laravel's queue system to offload jobs such as sending emails so your users don't have to wait for these activities to complete before their pages load. By default, we're using the "sync" queue driver.

1. Check out Laravel's [documentation](http://laravel.com/docs/master/queues#configuration).
2. Enter your queue server details into `config/queue.php`.


## Setting Up Caching

Bootstrap CMS provides caching functionality, and when enabled, requires a caching server.
Note that caching will not work with Laravel's `file` or `database` cache drivers.

1. Choose your poison - I'd recommend [Redis](http://redis.io).
2. Enter your cache server details into `config/cache.php`.
3. Setting the driver to array will effectively disable caching if you don't want the overhead.


## Setting Up Themes

Bootstrap CMS also ships with 18 themes, 16 from [Bootswatch](http://bootswatch.com).

1. You can set your theme in `config/theme.php`.
2. You can also set your navbar style in `config/theme.php`.
3. After making theme changes, you will have to run `php artisan app:update`.


## Setting Up Google Analytics

Bootstrap CMS natively supports [Google Analytics](http://www.google.com/analytics).

1. Setup a web property on [Google Analytics](http://www.google.com/analytics).
2. Enter your tracking id into `config/analytics.php`.
3. Enable Google Analytics in `config/analytics.php`.


## Setting Up CloudFlare Analytics

Bootstrap CMS can read [CloudFlare](https://www.cloudflare.com/) analytic data through a package.

1. Follow the install instructions for my [Laravel CloudFlare](https://github.com/BootstrapCMS/CloudFlare) package.
2. Bootstrap CMS will auto-detect the package, only allow admin access, and add links to the navigation bar.

## Sign in and up with socials

For this needs we use [Socialite package](https://github.com/laravel/socialite).
We provide auth through github. However socialite package offer wide range of socials you can implement.
Just follow steps from the [doc](https://github.com/laravel/socialite#configuration).

## Features in admin panel

 1. Users crud.
 2. Edit configuration from admin page.
 3. Categories crud.
 4. Comments management.
 5. Media crud.
 
## Comments management

To enable comments approvement set `COMMENTS_MODERATION` variable to `true` in .env file.

## Dynamic grid maker

To simplify this staff we wrapped [Nayjest/Grids](https://github.com/Nayjest/Grids) package.
For advanced options look in [package]((https://github.com/Nayjest/Grids)) docs.
 
See [demo](https://github.com/Nayjest/Grids#demo).

Provided features:

 * Render fields;
 * Pagination;
 * Excel and CSV export;
 * Show/hide columns UI control;
 * Filtering;
 * Refresh;
 * Render field with filter;
 * Sorting;

Usage example.

 1. In your template render method add following:
 
 ``` 
    $grid = new GridService(); 
    $user = new User();
    $gridComponent = $grid->generateGrid($user, ['first_name' => ['filter' => 'like'], 'last_name', 'email'], ['csv', 'exel', 'recordsPerPage', 'hider', 'refresher']);
    view('your_template',  compact('gridComponent'));
 ``` 
  
 2. In template add following:
 
 ```
   {!! $gridComponent !!}
 ```
 
 ### How to use:
 
 * Just render fields:
 
   ```
     $grid->generateGrid($user, ['first_name', 'last_name', 'email']);
   ```
   
 * Render field with filter flow:
 
   Filter options you can use:
    - `like`;
    - `eq`;
    - `n_eq`;
    - `gt`;
    - `lt`;
    - `ls_e`;
    - `gt_e`;
    - `in`;
 
   ```
      $grid->generateGrid($user, ['first_name' => ['filter' => 'ls_e']); 
   ```
     
   It will generate input for providing filter options.
  
 * Set components:
 
   Available components:
     * `csv`;
     * `exel`;
     * `recordsPerPage`;
     * `hider`;
     * `refresher`;
   
   ```$grid->generateGrid($user, ['first_name'], ['csv']);```
  
## Breadcrumbs

Breadcrumbs feature provides by [davejamesmiller/laravel-breadcrumbs](https://github.com/davejamesmiller/laravel-breadcrumbs)package.

Here is an example how to generate breadcrumb:

``` 
Breadcrumbs::register('account.register', function($breadcrumbs) {
      $breadcrumbs->push('Registration', route('account.register'));
});
``` 

In template add

```{!! Breadcrumbs::renderIfExists() !!}```

For advanced usage see [docs](https://laravel-breadcrumbs.readthedocs.io/en/latest/start.html).

## Flash messages

To show flash message: `flash('Message', 'info')`;
For more options look at [this](https://github.com/laracasts/flash#usage).

## Mailer
 
We override Mailer class for headers support.
To provide headers in mails just add in .env file for `MAIL_SMTP_HEADERS` variable something like this:

```MAIL_SMTP_HEADERS='{"PROJECT":"cms", "EMAILS":"<EMAIL>"}'```

## Minify css and js files

For minifying css and js files we use [gulp](https://github.com/gulpjs/gulp/tree/4.0).

## Dynamic crud maker

See [here](https://github.com/appzcoder/crud-generator) how to use package. It's already implemented. Just run
commands in command line.

## Admin panel

We use [Adminlte](https://almsaeedstudio.com/themes/AdminLTE/index2.html).

## Testing

Run in command line, from project root "./vendor/bin/phpunit"

## License

GNU AFFERO GENERAL PUBLIC LICENSE

Bootstrap CMS Is A PHP CMS Powered By Laravel 5 And Sentry

Copyright (C) 2013-2015 <NAME>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
<commit_msg>Fix docs<commit_after>Bootstrap CMS
=============

## Installation

[PHP](https://php.net) 5.5+ or [HHVM](http://hhvm.com) 3.6+, a database server, and [Composer](https://getcomposer.org) are required.

1. There is one ways of grabbing the code:
  * Use Git: `git clone <EMAIL>:nixsolutions/phpsu-1496.git`
2. From a command line open in the folder, run `composer install --no-dev -o` and then `npm install`.
3. Create .env file (copy entry from config/env/.env.vagrant).
4. Provide database, socials credentials and another staff in .env configuration file.
5. Enter `./vendor/bin/homestead make` in command line.
6. Let vagrant environment up in command line `vagrant up` and than `vagrant ssh`.
7. From project root (as usual you can get it by typing cd {project folder name}) under vagrant run `php artisan app:install` followed by `gulp --production` to setup the application. 
8. You will need to enter your mail server details into `config/mail.php`.
  * You can disable verification emails in `config/credentials.php`
  * Mail is still required for other functions like password resets and the contact form
  * You must set the contact email in `config/contact.php`
  * I'd recommend [queuing](#setting-up-queing) email sending for greater performance (see below)

To launch site type in your browser address line `192.168.10.10`

If you want launch site using specific domain look [here](https://laravel.com/docs/5.3/homestead).

**Admin credentials** <EMAIL>/password

## Setting Up Queuing

Bootstrap CMS uses Laravel's queue system to offload jobs such as sending emails so your users don't have to wait for these activities to complete before their pages load. By default, we're using the "sync" queue driver.

1. Check out Laravel's [documentation](http://laravel.com/docs/master/queues#configuration).
2. Enter your queue server details into `config/queue.php`.


## Setting Up Caching

Bootstrap CMS provides caching functionality, and when enabled, requires a caching server.
Note that caching will not work with Laravel's `file` or `database` cache drivers.

1. Choose your poison - I'd recommend [Redis](http://redis.io).
2. Enter your cache server details into `config/cache.php`.
3. Setting the driver to array will effectively disable caching if you don't want the overhead.


## Setting Up Themes

Bootstrap CMS also ships with 18 themes, 16 from [Bootswatch](http://bootswatch.com).

1. You can set your theme in `config/theme.php`.
2. You can also set your navbar style in `config/theme.php`.
3. After making theme changes, you will have to run `php artisan app:update`.


## Setting Up Google Analytics

Bootstrap CMS natively supports [Google Analytics](http://www.google.com/analytics).

1. Setup a web property on [Google Analytics](http://www.google.com/analytics).
2. Enter your tracking id into `config/analytics.php`.
3. Enable Google Analytics in `config/analytics.php`.


## Setting Up CloudFlare Analytics

Bootstrap CMS can read [CloudFlare](https://www.cloudflare.com/) analytic data through a package.

1. Follow the install instructions for my [Laravel CloudFlare](https://github.com/BootstrapCMS/CloudFlare) package.
2. Bootstrap CMS will auto-detect the package, only allow admin access, and add links to the navigation bar.

## Sign in and up with socials

For this needs we use [Socialite package](https://github.com/laravel/socialite).
We provide auth through github. However socialite package offer wide range of socials you can implement.
Just follow steps from the [doc](https://github.com/laravel/socialite#configuration).

## Features in admin panel

 1. Users crud.
 2. Edit configuration from admin page.
 3. Categories crud.
 4. Comments management.
 5. Media crud.
 
## Comments management

To enable comments approvement set `COMMENTS_MODERATION` variable to `true` in .env file.

## Dynamic grid maker

To simplify this staff we wrapped [Nayjest/Grids](https://github.com/Nayjest/Grids) package.
For advanced options look in [package]((https://github.com/Nayjest/Grids)) docs.
 
See [demo](https://github.com/Nayjest/Grids#demo).

Provided features:

 * Render fields;
 * Pagination;
 * Excel and CSV export;
 * Show/hide columns UI control;
 * Filtering;
 * Refresh;
 * Render field with filter;
 * Sorting;

Usage example.

 In your template render method add following:
 
 ``` 
    $grid = new GridService(); 
    $user = new User();
    $gridComponent = $grid->generateGrid($user, ['first_name' => ['filter' => 'like'], 'last_name', 'email'], ['csv', 'exel', 'recordsPerPage', 'hider', 'refresher']);
    view('your_template',  compact('gridComponent'));
 ``` 
  
 In template add following:
 
 ```
   {!! $gridComponent !!}
 ```
 
 **How to use:**
 
 1. Just render fields:
 
   ```
     $grid->generateGrid($user, ['first_name', 'last_name', 'email']);
   ```
   
 2. Render field with filter flow:
 
   Filter options you can use:
   
    * like;
    * eq;
    * n_eq;
    * gt;
    * lt;
    * ls_e;
    * gt_e;
    * in;
 
   ```
      $grid->generateGrid($user, ['first_name' => ['filter' => 'ls_e']); 
   ```
     
   It will generate input for providing filter options.
  
 3. Set components:
 
   Available components:
   
     * `csv`;
     * `exel`;
     * `recordsPerPage`;
     * `hider`;
     * `refresher`;
   
   ```$grid->generateGrid($user, ['first_name'], ['csv']);```
  
## Breadcrumbs

Breadcrumbs feature provides by [davejamesmiller/laravel-breadcrumbs](https://github.com/davejamesmiller/laravel-breadcrumbs)package.

Here is an example how to generate breadcrumb:

``` 
Breadcrumbs::register('account.register', function($breadcrumbs) {
      $breadcrumbs->push('Registration', route('account.register'));
});
``` 

In template add

```{!! Breadcrumbs::renderIfExists() !!}```

For advanced usage see [docs](https://laravel-breadcrumbs.readthedocs.io/en/latest/start.html).

## Flash messages

To show flash message: `flash('Message', 'info')`;
For more options look at [this](https://github.com/laracasts/flash#usage).

## Mailer
 
We override Mailer class for headers support.
To provide headers in mails just add in .env file for `MAIL_SMTP_HEADERS` variable something like this:

```MAIL_SMTP_HEADERS='{"PROJECT":"cms", "EMAILS":"<EMAIL>"}'```

## Minify css and js files

For minifying css and js files we use [gulp](https://github.com/gulpjs/gulp/tree/4.0).

## Dynamic crud maker

See [here](https://github.com/appzcoder/crud-generator) how to use package. It's already implemented. Just run
commands in command line.

## Admin panel

We use [Adminlte](https://almsaeedstudio.com/themes/AdminLTE/index2.html).

## Testing

Run in command line, from project root "./vendor/bin/phpunit"

## License

GNU AFFERO GENERAL PUBLIC LICENSE

Bootstrap CMS Is A PHP CMS Powered By Laravel 5 And Sentry

Copyright (C) 2013-2015 <NAME>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

{'fraction_non_alphanumeric': 0.11739072137302226, 'fraction_numerical': 0.008782515419683562, 'mean_word_length': 4.053184281842818, 'pattern_counts': {'":': 4, '<': 13, '<?xml version=': 0, '>': 31, 'https://': 32, 'lorem ipsum': 0, 'www.': 8, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5021617', 'n_tokens_mistral': 4625, 'n_tokens_neox': 4387, 'n_words': 1716}