Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
zongerli committed Oct 18, 2017
0 parents commit d67d2c4
Show file tree
Hide file tree
Showing 716 changed files with 182,474 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

PUSHER_APP_ID=
PUSHER_KEY=
PUSHER_SECRET=
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto
*.css linguist-vendored
*.scss linguist-vendored
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/node_modules
/public/storage
/storage/*.key
/vendor
/.idea
Homestead.json
Homestead.yaml
.env
6 changes: 6 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
66,664 changes: 66,664 additions & 0 deletions .tags

Large diffs are not rendered by default.

66,664 changes: 66,664 additions & 0 deletions .tags_sorted_by_file

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions Kernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

namespace App\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array
*/
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
];

/**
* The application's route middleware groups.
*
* @var array
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
// \App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],

'api' => [
'throttle:60,1',
'bindings',
],
];

/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
*
* @var array
*/
protected $routeMiddleware = [
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
];
}
99 changes: 99 additions & 0 deletions app/Admin/Controllers/ArticleController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?php

namespace App\Admin\Controllers;

use App\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('header');
$content->description('description');

$content->body($this->grid());
});
// return view('admin/article/index')->withArticles(Article::all());
}

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

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

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

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

$content->header('header');
$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->id('ID')->sortable();

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

namespace App\Admin\Controllers;

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 ExampleController extends Controller
{
use ModelForm;

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

$content->header('header');
$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('header');
$content->description('description');

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

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

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

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

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

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

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

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

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

$form->display('created_at', 'Created At');
$form->display('updated_at', 'Updated At');
});
}
}
Loading

0 comments on commit d67d2c4

Please sign in to comment.