-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f0eee3c
Showing
664 changed files
with
285,138 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/node_modules | ||
/public/hot | ||
/public/storage | ||
/storage/*.key | ||
/vendor | ||
/.idea | ||
/.vagrant | ||
Homestead.json | ||
Homestead.yaml | ||
npm-debug.log | ||
yarn-error.log | ||
.env | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace App\Console; | ||
|
||
use Illuminate\Console\Scheduling\Schedule; | ||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel; | ||
|
||
class Kernel extends ConsoleKernel | ||
{ | ||
/** | ||
* The Artisan commands provided by your application. | ||
* | ||
* @var array | ||
*/ | ||
protected $commands = [ | ||
// | ||
]; | ||
|
||
/** | ||
* Define the application's command schedule. | ||
* | ||
* @param \Illuminate\Console\Scheduling\Schedule $schedule | ||
* @return void | ||
*/ | ||
protected function schedule(Schedule $schedule) | ||
{ | ||
// $schedule->command('inspire') | ||
// ->hourly(); | ||
} | ||
|
||
/** | ||
* Register the Closure based commands for the application. | ||
* | ||
* @return void | ||
*/ | ||
protected function commands() | ||
{ | ||
require base_path('routes/console.php'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
namespace App\Exceptions; | ||
|
||
use Exception; | ||
use Illuminate\Auth\AuthenticationException; | ||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | ||
|
||
class Handler extends ExceptionHandler | ||
{ | ||
/** | ||
* A list of the exception types that should not be reported. | ||
* | ||
* @var array | ||
*/ | ||
protected $dontReport = [ | ||
\Illuminate\Auth\AuthenticationException::class, | ||
\Illuminate\Auth\Access\AuthorizationException::class, | ||
\Symfony\Component\HttpKernel\Exception\HttpException::class, | ||
\Illuminate\Database\Eloquent\ModelNotFoundException::class, | ||
\Illuminate\Session\TokenMismatchException::class, | ||
\Illuminate\Validation\ValidationException::class, | ||
]; | ||
|
||
/** | ||
* Report or log an exception. | ||
* | ||
* This is a great spot to send exceptions to Sentry, Bugsnag, etc. | ||
* | ||
* @param \Exception $exception | ||
* @return void | ||
*/ | ||
public function report(Exception $exception) | ||
{ | ||
parent::report($exception); | ||
} | ||
|
||
/** | ||
* Render an exception into an HTTP response. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Exception $exception | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function render($request, Exception $exception) | ||
{ | ||
return parent::render($request, $exception); | ||
} | ||
|
||
/** | ||
* Convert an authentication exception into an unauthenticated response. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Illuminate\Auth\AuthenticationException $exception | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
protected function unauthenticated($request, AuthenticationException $exception) | ||
{ | ||
if ($request->expectsJson()) { | ||
return response()->json(['error' => 'Unauthenticated.'], 401); | ||
} | ||
|
||
return redirect()->guest(route('login')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Admin; | ||
|
||
use Illuminate\Http\Request; | ||
use App\Http\Controllers\Controller; | ||
use App\Models\Column; | ||
use Illuminate\Filesystem\Filesystem; | ||
|
||
class ColumnsController extends Controller | ||
{ | ||
public function index(Column $columns){ | ||
$columns = $columns->where('parent_id',0)->orderBy('sort','desc')->get(); | ||
|
||
return view('admin.column.index',['columns'=>$columns,'page'=>'columns']); | ||
} | ||
public function create(Request $request){ | ||
$file = new Filesystem; | ||
if($request->id){ | ||
$column = Column::where('id',$request->id)->first(); | ||
}else{ | ||
$column = false; | ||
} | ||
$page = 'columns'; | ||
$columns = Column::select(['id','title'])->orderBy('sort','desc')->get(); | ||
$dirFiles = $file->files(base_path().'/resources/views'); | ||
$tpls = array(); | ||
|
||
foreach ($dirFiles as $fl){ | ||
$match = array(); | ||
preg_match('/([\w\-]+)\./',$fl,$match); | ||
$tpls[] = $match[1]; | ||
} | ||
|
||
return view('admin.column.create',compact('columns','column','page','tpls')); | ||
} | ||
public function store(Request $request){ | ||
$messages = [ | ||
'title.required' => '栏目名称 不能为空.' | ||
]; | ||
var_dump($request->path); | ||
$this->validate($request,[ | ||
'title' => 'required|max:300', | ||
'path' => array('max:200','unique:columns'), | ||
'sort' => 'max:255', | ||
'template' => 'required' | ||
],$messages); | ||
$column = new Column; | ||
$column->title = $request->title; | ||
$column->parent_id = $request->parentId ? $request->parentId : 0; | ||
$column->sort = $request->sort ? $request->sort : 0; | ||
$column->path = $request->path ? $request->path : ''; | ||
$column->pic = $request->pic ? $request->pic : ''; | ||
$column->bigPic = $request->bigPic ? $request->bigPic : ''; | ||
$column->intro = $request->intro ? $request->intro : ''; | ||
$column->template = $request->template; | ||
$column->contents = $request->contents ? $request->contents : ''; | ||
|
||
$bool = $column->save(); | ||
if($bool){ | ||
return redirect()->route('columns.index'); | ||
}else{ | ||
return redirect()->back()->with([ | ||
'danger' => '很抱歉,添加栏目失败' | ||
]); | ||
} | ||
} | ||
public function edit(Column $column){ | ||
$page = 'columns'; | ||
$tpls = array(); | ||
$file = new Filesystem; | ||
$dirFiles = $file->files(base_path().'/resources/views'); | ||
|
||
foreach ($dirFiles as $fl){ | ||
$match = array(); | ||
preg_match('/([\w\-]+)\./',$fl,$match); | ||
$tpls[] = $match[1]; | ||
} | ||
$columns = $column->select(['id','title'])->orderBy('sort','desc')->get(); | ||
//var_dump($columns); | ||
return view('admin.column.edit',compact('column','columns','page','tpls')); | ||
} | ||
public function update(Column $column,Request $request){ | ||
$messages = [ | ||
'title.required' => '栏目名称 不能为空.' | ||
]; | ||
$this->validate($request,[ | ||
'title' => 'required|max:300', | ||
'path' => array('max:200'), | ||
'sort' => 'max:255', | ||
'template' => 'required' | ||
],$messages); | ||
$column->update([ | ||
'title' => $request->title, | ||
'parent_id' => $request->parentId ? $request->parentId : 0, | ||
'sort' => $request->sort ? $request->sort : 0, | ||
'path' => $request->path ? $request->path : '', | ||
'pic' => $request->pic ? $request->pic : '', | ||
'bigPic'=> $request->bigPic ? $request->bigPic : '', | ||
'intro'=> $request->intro ? $request->intro : '', | ||
'template' => $request->template, | ||
'contents'=> $request->contents ? $request->contents : '' | ||
]); | ||
session()->flash('success','栏目更新成功'); | ||
return redirect()->route('columns.index'); | ||
} | ||
public function destroy(Column $column){ | ||
if($column->id){ | ||
$column->delete(); | ||
} | ||
return redirect()->route('columns.index'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Admin; | ||
|
||
use App\Models\Column; | ||
use App\Models\Content; | ||
use Illuminate\Http\Request; | ||
use App\Http\Controllers\Controller; | ||
use Illuminate\Filesystem\Filesystem; | ||
|
||
class ContentsController extends Controller | ||
{ | ||
// | ||
public function index(Request $request,Column $column,Content $content){ | ||
if($request->colId){ | ||
$content = Column::find($request->colId)->allContents; | ||
$column = $column->find($request->colId); | ||
}else{ | ||
$content = $content->orderBy('sort','desc')->get(); | ||
} | ||
$page = 'contents'; | ||
return view('admin.content.index',compact('column','content','page')); | ||
} | ||
public function create(Request $request,Column $column){ | ||
$file = new Filesystem; | ||
$colId = $request->colId; | ||
$page = 'contents'; | ||
|
||
$dirFiles = $file->files(base_path().'/resources/views'); | ||
$tpls = array(); | ||
foreach ($dirFiles as $fl){ | ||
$match = array(); | ||
preg_match('/([\w\-]+)\./',$fl,$match); | ||
$tpls[] = $match[1]; | ||
} | ||
if($colId){ | ||
$column = Column::select(['id','title'])->where('id',$colId)->first(); | ||
}else{ | ||
$column = $column->select(['id','title'])->orderBy('sort','desc')->get(); | ||
} | ||
return view('admin.content.create',compact('column','colId','page','tpls')); | ||
} | ||
public function store(Request $request,Content $contents){ | ||
$this->validate($request,[ | ||
'title' => 'required|max:300', | ||
'path' => array('max:200','unique:contents'), | ||
'sort' => 'max:255', | ||
'columnId' => 'required', | ||
'template' => 'required' | ||
]); | ||
$contents->title = $request->title; | ||
$contents->column_id = $request->columnId; | ||
$contents->sort = $request->sort ? $request->sort : 0; | ||
$contents->path = $request->path ? $request->path : ''; | ||
$contents->pic = $request->pic ? $request->pic : ''; | ||
$contents->recommend = $request->recommend ? 1 : 0; | ||
$contents->intro = $request->intro ? $request->intro : ''; | ||
$contents->template = $request->template; | ||
|
||
$contents->desc = $request->desc ? $request->desc : ''; | ||
$bool = $contents->save(); | ||
|
||
if($bool){ | ||
return redirect()->route('contents.index',['colId'=>$request->columnId]); | ||
}else{ | ||
return redirect()->back()->with([ | ||
'danger' => '很抱歉,添加文章失败' | ||
]); | ||
} | ||
} | ||
public function edit(Content $content,Column $column){ | ||
//文章所属类目 | ||
$file = new Filesystem; | ||
$pcol = $content->column; | ||
$page = 'contents'; | ||
$column = $column->all(); | ||
$dirFiles = $file->files(base_path().'/resources/views'); | ||
|
||
foreach ($dirFiles as $fl){ | ||
$match = array(); | ||
preg_match('/([\w\-]+)\./',$fl,$match); | ||
$tpls[] = $match[1]; | ||
} | ||
return view('admin.content.edit',compact('content','pcol','column','page','tpls')); | ||
} | ||
public function update(Content $content,Request $request){ | ||
$this->validate($request,[ | ||
'title' => 'required|max:300', | ||
'path' => array('max:200','unique:contents'), | ||
'sort' => 'max:255', | ||
'columnId' => 'required', | ||
'template' => 'required' | ||
]); | ||
//dd($request->desc); | ||
$content->update([ | ||
'title' => $request->title, | ||
'column_id' => $request->columnId, | ||
'sort' => $request->sort ? $request->sort : 0, | ||
'path' => $request->path ? $request->path : '', | ||
'pic' => $request->pic ? $request->pic : '', | ||
'recommend' => $request->recommend ? 1 : 0, | ||
'intro'=> $request->intro ? $request->intro : '', | ||
'template' => $request->template, | ||
'desc'=> $request->desc ? $request->desc : '' | ||
]); | ||
session()->flash('success','更新成功'); | ||
return redirect()->route('contents.index'); | ||
} | ||
public function destroy(Request $request,Content $content){ | ||
if($content->id){ | ||
$content->delete(); | ||
} | ||
return redirect()->route('contents.index'); | ||
} | ||
} |
Oops, something went wrong.