-
Notifications
You must be signed in to change notification settings - Fork 4
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 0cfad85
Showing
177 changed files
with
20,930 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,3 @@ | ||
* text=auto | ||
*.css linguist-vendored | ||
*.less linguist-vendored |
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 @@ | ||
/vendor | ||
/node_modules | ||
/.idea | ||
_ide_helper.php | ||
.env |
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,21 @@ | ||
<?php namespace App; | ||
|
||
use Kalnoy\Nestedset\Node; | ||
|
||
/** | ||
* Class Category | ||
* | ||
* @param string $title | ||
* | ||
* @package App | ||
*/ | ||
class Category extends Node { | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $fillable = [ | ||
'title', 'parent_id', | ||
]; | ||
|
||
} |
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,7 @@ | ||
<?php namespace App\Commands; | ||
|
||
abstract class Command { | ||
|
||
// | ||
|
||
} |
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,18 @@ | ||
<?php | ||
|
||
namespace App\Composers; | ||
|
||
use App\Category; | ||
use Illuminate\View\View; | ||
|
||
class CategoriesProvider { | ||
|
||
/** | ||
* @param View $view | ||
*/ | ||
public function compose(View $view) | ||
{ | ||
$view->categories = Category::defaultOrder()->get()->toTree(); | ||
} | ||
|
||
} |
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,32 @@ | ||
<?php namespace App\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Illuminate\Foundation\Inspiring; | ||
|
||
class Inspire extends Command { | ||
|
||
/** | ||
* The console command name. | ||
* | ||
* @var string | ||
*/ | ||
protected $name = 'inspire'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Display an inspiring quote'; | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL); | ||
} | ||
|
||
} |
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,29 @@ | ||
<?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 = [ | ||
'App\Console\Commands\Inspire', | ||
]; | ||
|
||
/** | ||
* Define the application's command schedule. | ||
* | ||
* @param \Illuminate\Console\Scheduling\Schedule $schedule | ||
* @return void | ||
*/ | ||
protected function schedule(Schedule $schedule) | ||
{ | ||
$schedule->command('inspire') | ||
->hourly(); | ||
} | ||
|
||
} |
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,7 @@ | ||
<?php namespace App\Events; | ||
|
||
abstract class Event { | ||
|
||
// | ||
|
||
} |
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,42 @@ | ||
<?php namespace App\Exceptions; | ||
|
||
use Exception; | ||
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 = [ | ||
'Symfony\Component\HttpKernel\Exception\HttpException' | ||
]; | ||
|
||
/** | ||
* Report or log an exception. | ||
* | ||
* This is a great spot to send exceptions to Sentry, Bugsnag, etc. | ||
* | ||
* @param \Exception $e | ||
* @return void | ||
*/ | ||
public function report(Exception $e) | ||
{ | ||
return parent::report($e); | ||
} | ||
|
||
/** | ||
* Render an exception into an HTTP response. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Exception $e | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function render($request, Exception $e) | ||
{ | ||
return parent::render($request, $e); | ||
} | ||
|
||
} |
Empty file.
Empty file.
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,38 @@ | ||
<?php namespace App\Http\Controllers\Auth; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Contracts\Auth\Guard; | ||
use Illuminate\Contracts\Auth\Registrar; | ||
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers; | ||
|
||
class AuthController extends Controller { | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Registration & Login Controller | ||
|-------------------------------------------------------------------------- | ||
| | ||
| This controller handles the registration of new users, as well as the | ||
| authentication of existing users. By default, this controller uses | ||
| a simple trait to add these behaviors. Why don't you explore it? | ||
| | ||
*/ | ||
|
||
use AuthenticatesAndRegistersUsers; | ||
|
||
/** | ||
* Create a new authentication controller instance. | ||
* | ||
* @param \Illuminate\Contracts\Auth\Guard $auth | ||
* @param \Illuminate\Contracts\Auth\Registrar $registrar | ||
* @return void | ||
*/ | ||
public function __construct(Guard $auth, Registrar $registrar) | ||
{ | ||
$this->auth = $auth; | ||
$this->registrar = $registrar; | ||
|
||
$this->middleware('guest', ['except' => 'getLogout']); | ||
} | ||
|
||
} |
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,38 @@ | ||
<?php namespace App\Http\Controllers\Auth; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Contracts\Auth\Guard; | ||
use Illuminate\Contracts\Auth\PasswordBroker; | ||
use Illuminate\Foundation\Auth\ResetsPasswords; | ||
|
||
class PasswordController extends Controller { | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Password Reset Controller | ||
|-------------------------------------------------------------------------- | ||
| | ||
| This controller is responsible for handling password reset requests | ||
| and uses a simple trait to include this behavior. You're free to | ||
| explore this trait and override any methods you wish to tweak. | ||
| | ||
*/ | ||
|
||
use ResetsPasswords; | ||
|
||
/** | ||
* Create a new password controller instance. | ||
* | ||
* @param \Illuminate\Contracts\Auth\Guard $auth | ||
* @param \Illuminate\Contracts\Auth\PasswordBroker $passwords | ||
* @return void | ||
*/ | ||
public function __construct(Guard $auth, PasswordBroker $passwords) | ||
{ | ||
$this->auth = $auth; | ||
$this->passwords = $passwords; | ||
|
||
$this->middleware('guest'); | ||
} | ||
|
||
} |
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,132 @@ | ||
<?php namespace App\Http\Controllers; | ||
|
||
use App\Category; | ||
use App\Http\Requests; | ||
use App\Http\Controllers\Controller; | ||
|
||
use App\Http\Requests\PostCategoryRequest; | ||
use Illuminate\Http\Request; | ||
use Kalnoy\Nestedset\Collection; | ||
|
||
class CategoriesController extends Controller { | ||
|
||
/** | ||
* Display a listing of the resource. | ||
* | ||
* @return Response | ||
*/ | ||
public function index() | ||
{ | ||
return view('categories.index'); | ||
} | ||
|
||
/** | ||
* Show the form for creating a new resource. | ||
* | ||
* @return Response | ||
*/ | ||
public function create(Request $input) | ||
{ | ||
$data = $input->only('parent_id'); | ||
|
||
$categories = $this->getCategoryOptions(); | ||
|
||
return view('categories.create', compact('data', 'categories')); | ||
} | ||
|
||
/** | ||
* Store a newly created resource in storage. | ||
* | ||
* @param PostCategoryRequest $input | ||
* | ||
* @return Response | ||
*/ | ||
public function store(PostCategoryRequest $input) | ||
{ | ||
$category = Category::create($input->all()); | ||
|
||
return redirect() | ||
->route('categories.show', [ $category->getKey() ]) | ||
->with('success', 'Category successfully created!'); | ||
} | ||
|
||
/** | ||
* Display the specified resource. | ||
* | ||
* @param int $id | ||
* @return Response | ||
*/ | ||
public function show($id) | ||
{ | ||
$category = Category::findOrFail($id); | ||
|
||
return view('categories.show', compact('category')); | ||
} | ||
|
||
/** | ||
* Show the form for editing the specified resource. | ||
* | ||
* @param int $id | ||
* @return Response | ||
*/ | ||
public function edit($id) | ||
{ | ||
/** @var Category $category */ | ||
$category = Category::findOrFail($id); | ||
|
||
$categories = $this->getCategoryOptions($category); | ||
|
||
return view('categories.edit', compact('category', 'categories')); | ||
} | ||
|
||
/** | ||
* Update the specified resource in storage. | ||
* | ||
* @param int $id | ||
* @return Response | ||
*/ | ||
public function update(PostCategoryRequest $input, $id) | ||
{ | ||
/** @var Category $category */ | ||
$category = Category::findOrFail($id); | ||
|
||
$category->update($input->all()); | ||
|
||
return redirect()->route('categories.show', [ $id ])->with('success', 'Category successfully updated!'); | ||
} | ||
|
||
/** | ||
* @param Collection $items | ||
* | ||
* @return static | ||
*/ | ||
protected function makeOptions(Collection $items) | ||
{ | ||
$options = [ '' => 'Root' ]; | ||
|
||
foreach ($items as $item) | ||
{ | ||
$options[$item->getKey()] = str_repeat('‒', $item->depth + 1).' '.$item->title; | ||
} | ||
|
||
return $options; | ||
} | ||
|
||
/** | ||
* @param Category $except | ||
* | ||
* @return CategoriesController | ||
*/ | ||
protected function getCategoryOptions($except = null) | ||
{ | ||
/** @var \Kalnoy\Nestedset\QueryBuilder $query */ | ||
$query = Category::select('id', 'title')->withDepth(); | ||
|
||
if ($except) | ||
{ | ||
$query->whereNotDescendantOf($except)->where('id', '<>', $except->id); | ||
} | ||
|
||
return $this->makeOptions($query->get()); | ||
} | ||
} |
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,11 @@ | ||
<?php namespace App\Http\Controllers; | ||
|
||
use Illuminate\Foundation\Bus\DispatchesCommands; | ||
use Illuminate\Routing\Controller as BaseController; | ||
use Illuminate\Foundation\Validation\ValidatesRequests; | ||
|
||
abstract class Controller extends BaseController { | ||
|
||
use DispatchesCommands, ValidatesRequests; | ||
|
||
} |
Oops, something went wrong.