Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
z-song committed Oct 11, 2017
0 parents commit 216700b
Show file tree
Hide file tree
Showing 732 changed files with 102,477 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* text=auto
*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored
CHANGELOG.md export-ignore
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/node_modules
/public/hot
/public/storage
/public/uploads
/storage/*.key
/vendor
/.idea
/.vagrant
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
.env
56 changes: 56 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Release Notes

## v5.4.23 (2017-05-11)

### Added
- Added SQL Server connection ([#4253](https://github.com/laravel/laravel/pull/4253), [#4254](https://github.com/laravel/laravel/pull/4254))

### Changed
- Switch to using meta
- Use CSRF token from `meta` tag, instead of `window.Laravel` object ([#4260](https://github.com/laravel/laravel/pull/4260))
- Log console error if CSRF token cannot be found ([1155245](https://github.com/laravel/laravel/commit/1155245a596113dc2cd0e9083603fa11df2eacd9))

### Fixed
- Added missing `ipv4` and `ipv6` validation messages ([#4261](https://github.com/laravel/laravel/pull/4261))


## v5.4.21 (2017-04-28)

### Added
- Added `FILESYSTEM_DRIVER` and `FILESYSTEM_CLOUD` environment variables ([#4236](https://github.com/laravel/laravel/pull/4236))

### Changed
- Use lowercase doctype ([#4241](https://github.com/laravel/laravel/pull/4241))


## v5.4.19 (2017-04-20)

### Added
- Added `optimize-autoloader` to `config` in `composer.json` ([#4189](https://github.com/laravel/laravel/pull/4189))
- Added `.vagrant` directory to `.gitignore` ([#4191](https://github.com/laravel/laravel/pull/4191))
- Added `npm run development` and `npm run prod` commands ([#4190](https://github.com/laravel/laravel/pull/4190), [#4193](https://github.com/laravel/laravel/pull/4193))
- Added `APP_NAME` environment variable ([#4204](https://github.com/laravel/laravel/pull/4204))

### Changed
- Changed Laravel Mix version to `0.*` ([#4188](https://github.com/laravel/laravel/pull/4188))
- Add to axios defaults instead of overwriting them ([#4208](https://github.com/laravel/laravel/pull/4208))
- Added `string` validation rule to `RegisterController` ([#4212](https://github.com/laravel/laravel/pull/4212))
- Moved Vue inclusion from `bootstrap.js` to `app.js` ([17ec5c5](https://github.com/laravel/laravel/commit/17ec5c51d60bb05985f287f09041c56fcd41d9ce))
- Only load libraries if present ([d905b2e](https://github.com/laravel/laravel/commit/d905b2e7bede2967d37ed7b260cd9d526bb9cabd))
- Ignore the NPM debug log ([#4232](https://github.com/laravel/laravel/pull/4232))
- Use fluent middleware definition in `LoginController` ([#4229](https://github.com/laravel/laravel/pull/4229))


## v5.4.16 (2017-03-17)

### Added
- Added `unix_socket` to `mysql` in `config/database.php` ()[#4179](https://github.com/laravel/laravel/pull/4179))
- Added Pusher example code to `bootstrap.js` ([31c2623](https://github.com/laravel/laravel/commit/31c262301899b6cd1a4ce2631ad0e313b444b131))

### Changed
- Use `smtp.mailtrap.io` as default `MAIL_HOST` ([#4182](https://github.com/laravel/laravel/pull/4182))
- Use `resource_path()` in `config/view.php` ([#4165](https://github.com/laravel/laravel/pull/4165))
- Use `cross-env` binary ([#4167](https://github.com/laravel/laravel/pull/4167))

### Removed
- Remove index from password reset `token` column ([#4180](https://github.com/laravel/laravel/pull/4180))
109 changes: 109 additions & 0 deletions app/Admin/Controllers/ArticleController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?php

namespace App\Admin\Controllers;

use App\Models\Article;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Facades\Admin;
use Encore\Admin\Layout\Content;
use App\Http\Controllers\Controller;
use Encore\Admin\Controllers\ModelForm;

class ArticleController extends Controller
{
use ModelForm;

/**
* Index interface.
*
* @return Content
*/
public function index()
{
return Admin::content(function (Content $content) {

$content->header('Orderable articles');
$content->description('description');

$content->body($this->grid());
});
}

/**
* Edit interface.
*
* @param $id
* @return Content
*/
public function edit($id)
{
return Admin::content(function (Content $content) use ($id) {

$content->header('Orderable articles');
$content->description('description');

$content->body($this->form()->edit($id));
});
}

/**
* Create interface.
*
* @return Content
*/
public function create()
{
return Admin::content(function (Content $content) {

$content->header('Orderable articles');
$content->description('description');

$content->body($this->form());
});
}

/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Admin::grid(Article::class, function (Grid $grid) {

$grid->model()->ordered();

$grid->id('ID')->sortable();

$grid->title()->editable();
$grid->content()->editable();
$grid->picture()->image();

$grid->order()->orderable();

$grid->created_at();
$grid->updated_at();
});
}

/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Admin::form(Article::class, function (Form $form) {

$form->display('id', 'ID');

$form->text('title')->rules('required');
$form->textarea('content')->rules('required');
$form->image('picture');

$form->display('created_at', 'Created At');
$form->display('updated_at', 'Updated At');
});
}
}
102 changes: 102 additions & 0 deletions app/Admin/Controllers/CategoryController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?php

namespace App\Admin\Controllers;

use App\Http\Controllers\Controller;
use App\Models\Category;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Facades\Admin;
use Encore\Admin\Layout\Content;
use Encore\Admin\Controllers\ModelForm;
use Encore\Admin\Tree;

class CategoryController extends Controller
{
use ModelForm;

/**
* Index interface.
*
* @return Content
*/
public function index()
{
return Admin::content(function (Content $content) {
$content->header('All categories');

$content->body($this->tree());
});
}

/**
* Edit interface.
*
* @param $id
* @return Content
*/
public function edit($id)
{
return Admin::content(function (Content $content) use ($id) {
$content->header('Edit category');
$content->body($this->form()->edit($id));
});
}

/**
* Create interface.
*
* @return Content
*/
public function create()
{
return Admin::content(function (Content $content) {
$content->header('Create new category');
$content->body($this->form());
});
}

/**
* Make a grid builder.
*
* @return Grid
*/
protected function tree()
{
return Category::tree(function (Tree $tree) {

$tree->branch(function ($branch) {

$src = config('admin.upload.host') . '/' . $branch['logo'] ;

$logo = "<img src='$src' style='max-width:30px;max-height:30px' class='img'/>";

return "{$branch['id']} - {$branch['title']} $logo";

});

});
}

/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Category::form(function (Form $form) {

$form->display('id', 'ID');

$form->select('parent_id')->options(Category::selectOptions());

$form->text('title')->rules('required');
$form->textarea('desc')->rules('required');
$form->image('logo');

$form->display('created_at', 'Created At');
$form->display('updated_at', 'Updated At');
});
}
}
65 changes: 65 additions & 0 deletions app/Admin/Controllers/China/ChinaController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php

namespace App\Admin\Controllers\China;

use App\Http\Controllers\Controller;
use App\Models\ChinaArea;
use Encore\Admin\Facades\Admin;
use Encore\Admin\Layout\Content;
use Encore\Admin\Widgets\Box;
use Encore\Admin\Widgets\Form;
use Encore\Admin\Widgets\Table;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class ChinaController extends Controller
{
public function cascading(Request $request)
{
return Admin::content(function (Content $content) use ($request) {

$content->header('Cascading select');

$form = new Form($request->all());
$form->method('GET');
$form->action('/demo/china/cascading-select');

$form->select('province')->options(

ChinaArea::province()->pluck('name', 'id')

)->load('city', '/demo/api/china/city');

$form->select('city')->options(function ($id) {

return ChinaArea::options($id);

})->load('district', '/demo/api/china/district');

$form->select('district')->options(function ($id) {

return ChinaArea::options($id);

});
$content->row(new Box('Form', $form));

if ($request->has('province')) {
$content->row(new Box('Query', new Table(['key', 'value'], $request->only(['province', 'city', 'district']))));
}
});
}

public function city(Request $request)
{
$provinceId = $request->get('q');

return ChinaArea::city()->where('parent_id', $provinceId)->get(['id', DB::raw('name as text')]);
}

public function district(Request $request)
{
$cityId = $request->get('q');

return ChinaArea::district()->where('parent_id', $cityId)->get(['id', DB::raw('name as text')]);
}
}
Loading

0 comments on commit 216700b

Please sign in to comment.