├── .gitattributes
├── .gitignore
├── app
├── Console
│ ├── Commands
│ │ └── Inspire.php
│ └── Kernel.php
├── Events
│ ├── Event.php
│ └── GenerateBook.php
├── Exceptions
│ └── Handler.php
├── Http
│ ├── Controllers
│ │ ├── Admin
│ │ │ ├── BooksController.php
│ │ │ ├── CategoriesController.php
│ │ │ ├── ChaptersController.php
│ │ │ ├── PermissionsController.php
│ │ │ ├── RolesController.php
│ │ │ └── UsersController.php
│ │ ├── Auth
│ │ │ ├── AuthController.php
│ │ │ └── PasswordController.php
│ │ ├── Controller.php
│ │ ├── HomeController.php
│ │ └── StoreController.php
│ ├── Kernel.php
│ ├── Middleware
│ │ ├── Authenticate.php
│ │ ├── EncryptCookies.php
│ │ ├── RedirectIfAuthenticated.php
│ │ └── VerifyCsrfToken.php
│ ├── Requests
│ │ └── Request.php
│ └── routes.php
├── Jobs
│ └── Job.php
├── Listeners
│ ├── .gitkeep
│ └── ExportBook.php
├── Models
│ ├── Book.php
│ ├── BookInterface.php
│ ├── Category.php
│ ├── Chapter.php
│ ├── Order.php
│ ├── Permission.php
│ ├── Role.php
│ └── User.php
├── Policies
│ ├── .gitkeep
│ ├── BookPolicy.php
│ └── ChapterPolicy.php
├── Providers
│ ├── AppServiceProvider.php
│ ├── AuthServiceProvider.php
│ ├── EventServiceProvider.php
│ └── RouteServiceProvider.php
├── Services
│ ├── BookService.php
│ └── OrderService.php
└── Util
│ └── ExtendedZip.php
├── artisan
├── bootstrap
├── app.php
├── autoload.php
└── cache
│ └── .gitignore
├── composer.json
├── composer.lock
├── config
├── app.php
├── auth.php
├── broadcasting.php
├── cache.php
├── compile.php
├── database.php
├── filesystems.php
├── image.php
├── mail.php
├── queue.php
├── services.php
├── session.php
└── view.php
├── database
├── .gitignore
├── factories
│ └── ModelFactory.php
├── migrations
│ ├── .gitkeep
│ ├── 2014_10_12_000000_create_users_table.php
│ ├── 2014_10_12_100000_create_password_resets_table.php
│ ├── 2016_02_06_180247_create_permissions_table.php
│ ├── 2016_02_06_180637_create_roles_table.php
│ ├── 2016_02_07_172956_create_categories_table.php
│ ├── 2016_02_07_192008_create_books_table.php
│ ├── 2016_02_08_183033_create_chapters_table.php
│ ├── 2016_02_08_203854_create_jobs_table.php
│ ├── 2016_02_09_183753_cashier_tables.php
│ ├── 2016_02_09_193023_create_orders_table.php
│ └── 2016_02_09_200315_add_slug_column_on_books.php
└── seeds
│ ├── .gitkeep
│ ├── BookTableSeeder.php
│ ├── CategoriesTableSeeder.php
│ ├── DatabaseSeeder.php
│ └── UsersRolesPermissionsSeeder.php
├── gulpfile.js
├── package.json
├── phpunit.xml
├── public
├── .htaccess
├── books
│ └── thumbs
│ │ └── 1.jpg
├── css
│ └── style.css
├── favicon.ico
├── img
│ ├── background.png
│ ├── bar-green.png
│ ├── bar-transp.png
│ ├── book.png
│ ├── cellphone.png
│ ├── comments.png
│ ├── computer.png
│ ├── connection.png
│ ├── earth.png
│ ├── facebook.png
│ ├── foto.png
│ ├── foto01.png
│ ├── google.png
│ ├── icon.png
│ ├── ipad-cell.png
│ ├── ipad.png
│ ├── l1.png
│ ├── l2.png
│ ├── l3.png
│ ├── l4.png
│ ├── l5.png
│ ├── logo.png
│ ├── sombra.png
│ └── twitter.png
├── index.php
├── robots.txt
├── vendor
│ └── folklore
│ │ └── image
│ │ ├── .gitkeep
│ │ └── js
│ │ └── image.js
└── web.config
├── readme.md
├── resources
├── assets
│ └── sass
│ │ └── app.scss
├── lang
│ └── en
│ │ ├── auth.php
│ │ ├── pagination.php
│ │ ├── passwords.php
│ │ └── validation.php
└── views
│ ├── admin
│ ├── books
│ │ ├── _form.blade.php
│ │ ├── cover.blade.php
│ │ ├── create.blade.php
│ │ ├── edit.blade.php
│ │ └── index.blade.php
│ ├── categories
│ │ ├── _form.blade.php
│ │ ├── create.blade.php
│ │ ├── edit.blade.php
│ │ └── index.blade.php
│ ├── chapters
│ │ ├── _form.blade.php
│ │ ├── create.blade.php
│ │ ├── edit.blade.php
│ │ └── index.blade.php
│ ├── permissions
│ │ ├── _form.blade.php
│ │ ├── create.blade.php
│ │ ├── edit.blade.php
│ │ └── index.blade.php
│ ├── roles
│ │ ├── _form.blade.php
│ │ ├── create.blade.php
│ │ ├── edit.blade.php
│ │ ├── index.blade.php
│ │ └── permissions.blade.php
│ └── users
│ │ ├── _form.blade.php
│ │ ├── create.blade.php
│ │ ├── edit.blade.php
│ │ ├── index.blade.php
│ │ └── roles.blade.php
│ ├── auth
│ ├── emails
│ │ └── password.blade.php
│ ├── login.blade.php
│ ├── passwords
│ │ ├── email.blade.php
│ │ └── reset.blade.php
│ └── register.blade.php
│ ├── errors
│ └── 503.blade.php
│ ├── home.blade.php
│ ├── layouts
│ └── app.blade.php
│ ├── store
│ ├── _banner.blade.php
│ ├── _menu.blade.php
│ ├── book.blade.php
│ ├── category.blade.php
│ ├── checkout.blade.php
│ ├── home.blade.php
│ ├── orders.blade.php
│ ├── process.blade.php
│ └── search.blade.php
│ ├── vendor
│ └── .gitkeep
│ └── welcome.blade.php
├── server.php
├── storage
├── app
│ └── .gitignore
├── books
│ ├── 1
│ │ ├── .DS_Store
│ │ ├── Contents
│ │ │ ├── 1.md
│ │ │ ├── 2.md
│ │ │ └── dedication.md
│ │ ├── Output
│ │ │ ├── ebook
│ │ │ │ └── book.epub
│ │ │ ├── kindle
│ │ │ │ └── book.mobi
│ │ │ └── print
│ │ │ │ └── book.pdf
│ │ ├── Resources
│ │ │ └── Templates
│ │ │ │ ├── cover.jpg
│ │ │ │ ├── ebook
│ │ │ │ └── cover.jpg
│ │ │ │ └── print
│ │ │ │ └── cover.pdf
│ │ └── config.yml
│ └── template
│ │ └── config.yml
├── framework
│ ├── .gitignore
│ ├── cache
│ │ └── .gitignore
│ ├── sessions
│ │ └── .gitignore
│ └── views
│ │ └── .gitignore
└── logs
│ └── .gitignore
└── tests
├── ExampleTest.php
└── TestCase.php
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 | *.css linguist-vendored
3 | *.less linguist-vendored
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /vendor
2 | /node_modules
3 | Homestead.yaml
4 | Homestead.json
5 | .env
6 | .idea
7 | /easybook
8 | /public/books
9 | /storage/books
--------------------------------------------------------------------------------
/app/Console/Commands/Inspire.php:
--------------------------------------------------------------------------------
1 | comment(PHP_EOL.Inspiring::quote().PHP_EOL);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/app/Console/Kernel.php:
--------------------------------------------------------------------------------
1 | command('inspire')
28 | // ->hourly();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/Events/Event.php:
--------------------------------------------------------------------------------
1 | book = $book;
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/app/Exceptions/Handler.php:
--------------------------------------------------------------------------------
1 | user()->can('book_manage_all')) {
21 | $books = Book::all();
22 | } else {
23 | $books = Book::whereUserId(auth()->user()->id)->get();
24 | }
25 |
26 | return view('admin.books.index', compact('books'));
27 | }
28 |
29 | public function create()
30 | {
31 | $categories = Category::lists('name', 'id');
32 | return view('admin.books.create', compact('categories'));
33 | }
34 |
35 | public function store(Request $request)
36 | {
37 | $input = $request->all();
38 | $input['user_id'] = auth()->user()->id;
39 | Book::create($input);
40 | return redirect()->route('admin.books.index');
41 | }
42 |
43 | public function edit($id)
44 | {
45 | $book = Book::find($id);
46 |
47 | if (Gate::denies('manage', $book)) {
48 | abort(403, 'You dont own this book');
49 | }
50 |
51 | $categories = Category::lists('name', 'id');
52 | return view('admin.books.edit', compact('book', 'categories'));
53 | }
54 |
55 | public function update(Request $request, $id)
56 | {
57 | $book = Book::find($id);
58 |
59 | if (Gate::denies('manage', $book)) {
60 | abort(403, 'You dont own this book');
61 | }
62 |
63 | $book->update($request->all());
64 | return redirect()->route('admin.books.index');
65 | }
66 |
67 | public function destroy($id)
68 | {
69 | $book = Book::find($id);
70 |
71 | if (Gate::denies('manage', $book)) {
72 | abort(403, 'You dont own this book');
73 | }
74 |
75 | $book->delete();
76 | return redirect()->route('admin.books.index');
77 | }
78 |
79 | public function cover($id)
80 | {
81 | $book = Book::find($id);
82 |
83 | if (Gate::denies('manage', $book)) {
84 | abort(403, 'You dont own this book');
85 | }
86 |
87 | return view('admin.books.cover', compact('book'));
88 | }
89 |
90 | public function coverStore(Request $request, $id)
91 | {
92 | $book = Book::find($id);
93 |
94 | if (Gate::denies('manage', $book)) {
95 | abort(403, 'You dont own this book');
96 | }
97 |
98 | $bookService = app()->make(BookService::class);
99 | $bookService->storeCover($book, $request->file('file'));
100 |
101 | return redirect()->back();
102 | }
103 |
104 | public function export($id)
105 | {
106 | $book = Book::find($id);
107 |
108 | if (Gate::denies('manage', $book)) {
109 | abort(403, 'You dont own this book');
110 | }
111 |
112 | Event::fire(new GenerateBook($book));
113 |
114 | return redirect()->route('admin.books.index');
115 | }
116 |
117 | public function download($id)
118 | {
119 | $book = Book::find($id);
120 |
121 | if (Gate::denies('manage', $book)) {
122 | abort(403, 'You dont own this book');
123 | }
124 |
125 | if(file_exists(storage_path("books/{$book->id}/book.zip"))) {
126 | return response()->download(storage_path("books/{$book->id}/book.zip"));
127 | }
128 |
129 | return redirect()->route('admin.books.index');
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Admin/CategoriesController.php:
--------------------------------------------------------------------------------
1 | all());
27 | return redirect()->route('admin.categories.index');
28 | }
29 |
30 | public function edit($id)
31 | {
32 | $category = Category::find($id);
33 | return view('admin.categories.edit', compact('category'));
34 | }
35 |
36 | public function update(Request $request, $id)
37 | {
38 | Category::find($id)->update($request->all());
39 | return redirect()->route('admin.categories.index');
40 | }
41 |
42 | public function destroy($id)
43 | {
44 | Category::find($id)->delete();
45 | return redirect()->route('admin.categories.index');
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Admin/ChaptersController.php:
--------------------------------------------------------------------------------
1 | chapters()->orderBy('order', 'asc')->get();
24 | return view('admin.chapters.index', compact('chapters', 'book'));
25 | }
26 |
27 | public function create($id)
28 | {
29 | $book = Book::findOrFail($id);
30 |
31 | if (Gate::denies('manage', $book)) {
32 | abort(403, "you do not own this book");
33 | }
34 |
35 | return view('admin.chapters.create', compact('book'));
36 | }
37 |
38 | public function store(Request $request, $id)
39 | {
40 | $book = Book::findOrFail($id);
41 |
42 | if (Gate::denies('manage', $book)) {
43 | abort(403, "you do not own this book");
44 | }
45 |
46 | $book->chapters()->create($request->all());
47 | return redirect()->route('admin.books.chapters.index', ['id' => $book->id]);
48 | }
49 |
50 | public function edit($id, $chapter_id)
51 | {
52 | $book = Book::findOrFail($id);
53 |
54 | $chapter = Chapter::find($chapter_id);
55 |
56 | if (Gate::denies('manage', $chapter)) {
57 | abort(403, "you do not own this book/chapter");
58 | }
59 | return view('admin.chapters.edit', compact('chapter','book'));
60 | }
61 |
62 | public function update(Request $request, $id, $chapter_id)
63 | {
64 | $chapter = Chapter::find($chapter_id);
65 |
66 | if (Gate::denies('manage', $chapter)) {
67 | abort(403, "you do not own this book/chapter");
68 | }
69 |
70 | $chapter->update($request->all());
71 | return redirect()->route('admin.books.chapters.index',['id'=>$id]);
72 | }
73 |
74 | public function destroy($id, $chapter_id)
75 | {
76 | $chapter = Chapter::find($chapter_id);
77 |
78 | if (Gate::denies('manage', $chapter)) {
79 | abort(403, "you do not own this book/chapter");
80 | }
81 |
82 | $chapter->delete();
83 |
84 | return redirect()->route('admin.books.chapters.index',['id'=>$id]);
85 | }
86 |
87 | }
88 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Admin/PermissionsController.php:
--------------------------------------------------------------------------------
1 | runningInConsole() )
19 | {
20 | $this->authorize('permission_admin');
21 | }
22 | }
23 | public function index()
24 | {
25 | $permissions = Permission::all();
26 | return view('admin.permissions.index', compact('permissions'));
27 | }
28 |
29 | public function create()
30 | {
31 | return view('admin.permissions.create');
32 | }
33 |
34 | public function store(Request $request)
35 | {
36 | Permission::create($request->all());
37 | return redirect()->route('admin.permissions.index');
38 | }
39 |
40 | public function edit($id)
41 | {
42 | $permission = Permission::find($id);
43 | return view('admin.permissions.edit', compact('permission'));
44 | }
45 |
46 | public function update(Request $request, $id)
47 | {
48 | Permission::find($id)->update($request->all());
49 | return redirect()->route('admin.permissions.index');
50 | }
51 |
52 | public function destroy($id)
53 | {
54 | Permission::find($id)->delete();
55 | return redirect()->route('admin.permissions.index');
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Admin/RolesController.php:
--------------------------------------------------------------------------------
1 | runningInConsole() ) {
19 | $this->authorize('role_admin');
20 | }
21 | }
22 |
23 | public function index()
24 | {
25 | $roles = Role::all();
26 | return view('admin.roles.index', compact('roles'));
27 | }
28 |
29 | public function create()
30 | {
31 | return view('admin.roles.create');
32 | }
33 |
34 | public function store(Request $request)
35 | {
36 | Role::create($request->all());
37 | return redirect()->route('admin.roles.index');
38 | }
39 |
40 | public function edit($id)
41 | {
42 | $role = Role::find($id);
43 | return view('admin.roles.edit', compact('role'));
44 | }
45 |
46 | public function update(Request $request, $id)
47 | {
48 | Role::find($id)->update($request->all());
49 | return redirect()->route('admin.roles.index');
50 | }
51 |
52 | public function destroy($id)
53 | {
54 | Role::find($id)->delete();
55 | return redirect()->route('admin.roles.index');
56 | }
57 |
58 | public function permissions($id)
59 | {
60 | $role = Role::find($id);
61 | $permissions = Permission::all();
62 |
63 | return view('admin.roles.permissions', compact('role', 'permissions'));
64 | }
65 |
66 | public function storePermission(Request $request, $id)
67 | {
68 | $role = Role::find($id);
69 |
70 | $permission = Permission::findOrFail($request->all()['permission_id']);
71 | $role->addPermission($permission);
72 |
73 | return redirect()->back();
74 | }
75 |
76 | public function revokePermission($id, $permission_id)
77 | {
78 | $role = Role::find($id);
79 | $permission = Permission::find($permission_id);
80 | $role->revokePermission($permission);
81 |
82 | return redirect()->back();
83 |
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Admin/UsersController.php:
--------------------------------------------------------------------------------
1 | authorize('user_list');
19 | $users = User::all();
20 | return view('admin.users.index', compact('users'));
21 | }
22 |
23 | public function create()
24 | {
25 | $this->authorize('user_add');
26 | return view('admin.users.create');
27 | }
28 |
29 | public function store(Request $request)
30 | {
31 | $this->authorize('user_add');
32 | $input = $this->prepareFields($request);
33 | User::create($input);
34 | return redirect()->route('admin.users.index');
35 | }
36 |
37 | public function edit($id)
38 | {
39 | $this->authorize('user_edit');
40 | $user = User::find($id);
41 | return view('admin.users.edit', compact('user'));
42 | }
43 |
44 | public function update(Request $request, $id)
45 | {
46 | $this->authorize('user_edit');
47 | $input = $this->prepareFields($request);
48 | User::find($id)->update($input);
49 | return redirect()->route('admin.users.index');
50 | }
51 |
52 | public function destroy($id)
53 | {
54 | $this->authorize('user_destroy');
55 | User::find($id)->delete();
56 | return redirect()->route('admin.users.index');
57 | }
58 |
59 | public function roles($id)
60 | {
61 | $this->authorize('user_view_roles');
62 | $user = User::find($id);
63 | $roles = Role::all();
64 | return view('admin.users.roles', compact('user', 'roles'));
65 | }
66 |
67 | public function storeRole(Request $request, $id)
68 | {
69 | $this->authorize('user_add_role');
70 | $user = User::find($id);
71 | $role = Role::findOrFail($request->all()['role_id']);
72 | $user->addRole($role);
73 | return redirect()->back();
74 | }
75 |
76 | public function revokeRole($id, $role_id)
77 | {
78 | $this->authorize('user_revoke_role');
79 | $user = User::find($id);
80 | $role = Role::findOrFail($role_id);
81 | $user->revokeRole($role);
82 | return redirect()->back();
83 | }
84 |
85 | private function prepareFields(Request $request)
86 | {
87 | $input = $request->all();
88 | if (isset($input['password'])) {
89 | $input['password'] = bcrypt($input['password']);
90 | return $input;
91 | }
92 | return $input;
93 | }
94 |
95 | }
96 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/AuthController.php:
--------------------------------------------------------------------------------
1 | middleware('guest', ['except' => 'logout']);
41 | }
42 |
43 | /**
44 | * Get a validator for an incoming registration request.
45 | *
46 | * @param array $data
47 | * @return \Illuminate\Contracts\Validation\Validator
48 | */
49 | protected function validator(array $data)
50 | {
51 | return Validator::make($data, [
52 | 'name' => 'required|max:255',
53 | 'email' => 'required|email|max:255|unique:users',
54 | 'password' => 'required|confirmed|min:6',
55 | ]);
56 | }
57 |
58 | /**
59 | * Create a new user instance after a valid registration.
60 | *
61 | * @param array $data
62 | * @return User
63 | */
64 | protected function create(array $data)
65 | {
66 | return User::create([
67 | 'name' => $data['name'],
68 | 'email' => $data['email'],
69 | 'password' => bcrypt($data['password']),
70 | ]);
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/PasswordController.php:
--------------------------------------------------------------------------------
1 | middleware('guest');
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Controller.php:
--------------------------------------------------------------------------------
1 | middleware('auth');
18 | }
19 |
20 | /**
21 | * Show the application dashboard.
22 | *
23 | * @return \Illuminate\Http\Response
24 | */
25 | public function index()
26 | {
27 | return view('home');
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/app/Http/Controllers/StoreController.php:
--------------------------------------------------------------------------------
1 | get();
21 |
22 | return view('store.home', compact('books', 'categories'));
23 | }
24 |
25 | public function view($slug)
26 | {
27 | $categories = Category::all();
28 | $book = Book::findBySlug($slug);
29 | return view('store.book', compact('book', 'categories'));
30 | }
31 |
32 | public function category($id)
33 | {
34 | $categories = Category::all();
35 | $category = Category::find($id);
36 | $books = $category->books()->where('published', 1)->get();
37 |
38 | return view('store.category', compact('category', 'categories', 'books'));
39 | }
40 |
41 | public function search()
42 | {
43 | $str = Input::get('str');
44 | $categories = Category::all();
45 | $books = Book::like('title', $str)->get();
46 | return view('store.search', compact('categories', 'books'));
47 | }
48 |
49 | public function checkout($id)
50 | {
51 | $book = Book::findOrFail($id);
52 | return view('store.checkout', compact('book'));
53 | }
54 |
55 | public function process($id)
56 | {
57 | $book = Book::findOrFail($id);
58 |
59 | $token = Input::get('stripeToken');
60 |
61 | $user = auth()->user();
62 |
63 | $orderService = app()->make(OrderService::class);
64 | $status = $orderService->process($book, $user, $token);
65 |
66 | return view('store.process', compact('book', 'status'));
67 | }
68 |
69 | public function orders()
70 | {
71 | $orders = Order::whereUserId(auth()->user()->id)->get();
72 | //$orders = auth()->user()->orders;
73 |
74 | return view('store.orders', compact('orders'));
75 | }
76 |
77 | public function download($id)
78 | {
79 | $order = Order::find($id);
80 | if ($order->user_id == auth()->user()->id) {
81 |
82 | $book = $order->book;
83 |
84 | if (file_exists(storage_path("books/{$book->id}/book.zip"))) {
85 | return response()->download(storage_path("books/{$book->id}/book.zip"));
86 | }
87 | }
88 | }
89 |
90 | }
91 |
--------------------------------------------------------------------------------
/app/Http/Kernel.php:
--------------------------------------------------------------------------------
1 | [
27 | \CodePub\Http\Middleware\EncryptCookies::class,
28 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
29 | \Illuminate\Session\Middleware\StartSession::class,
30 | \Illuminate\View\Middleware\ShareErrorsFromSession::class,
31 | \CodePub\Http\Middleware\VerifyCsrfToken::class,
32 | ],
33 |
34 | 'api' => [
35 | 'throttle:60,1',
36 | ],
37 | ];
38 |
39 | /**
40 | * The application's route middleware.
41 | *
42 | * These middleware may be assigned to groups or used individually.
43 | *
44 | * @var array
45 | */
46 | protected $routeMiddleware = [
47 | 'auth' => \CodePub\Http\Middleware\Authenticate::class,
48 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
49 | 'guest' => \CodePub\Http\Middleware\RedirectIfAuthenticated::class,
50 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
51 | ];
52 | }
53 |
--------------------------------------------------------------------------------
/app/Http/Middleware/Authenticate.php:
--------------------------------------------------------------------------------
1 | guest()) {
21 | if ($request->ajax() || $request->wantsJson()) {
22 | return response('Unauthorized.', 401);
23 | } else {
24 | return redirect()->guest('login');
25 | }
26 | }
27 |
28 | return $next($request);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/Http/Middleware/EncryptCookies.php:
--------------------------------------------------------------------------------
1 | check()) {
21 | return redirect('/');
22 | }
23 |
24 | return $next($request);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/Http/Middleware/VerifyCsrfToken.php:
--------------------------------------------------------------------------------
1 | ['web']], function () {
4 | Route::auth();
5 | Route::get('/', ['uses' => 'StoreController@index', 'as' => 'store']);
6 | Route::get('/book/{slug}', ['uses' => 'StoreController@view', 'as' => 'store.view']);
7 | Route::get('/category/{id}', ['uses' => 'StoreController@category', 'as' => 'store.category']);
8 | Route::get('/search', ['uses' => 'StoreController@search', 'as' => 'store.search']);
9 |
10 | Route::group(['middleware' => ['auth']], function () {
11 | Route::get('/checkout/{id}', ['uses' => 'StoreController@checkout', 'as' => 'store.checkout']);
12 | Route::post('/checkout/process/{id}', ['uses' => 'StoreController@process', 'as' => 'store.process']);
13 | Route::get('/orders', ['uses' => 'StoreController@orders', 'as' => 'store.orders']);
14 | Route::get('/download/{id}', ['uses' => 'StoreController@download', 'as' => 'store.download']);
15 | });
16 |
17 |
18 | });
19 |
20 |
21 | Route::group(['prefix' => 'admin', 'as' => 'admin.', 'middleware' => 'web'], function () {
22 |
23 | Route::get('roles', ['as' => 'roles.index', 'uses' => 'Admin\RolesController@index']);
24 | Route::get('roles/new', ['as' => 'roles.create', 'uses' => 'Admin\RolesController@create']);
25 | Route::post('roles/store', ['as' => 'roles.store', 'uses' => 'Admin\RolesController@store']);
26 | Route::get('roles/edit/{id}', ['as' => 'roles.edit', 'uses' => 'Admin\RolesController@edit']);
27 | Route::put('roles/update/{id}', ['as' => 'roles.update', 'uses' => 'Admin\RolesController@update']);
28 | Route::get('roles/destroy/{id}', ['as' => 'roles.destroy', 'uses' => 'Admin\RolesController@destroy']);
29 | Route::get('roles/permissions/{id}', ['as' => 'roles.permissions', 'uses' => 'Admin\RolesController@permissions']);
30 | Route::post('roles/permissions/{id}/store', ['as' => 'roles.permissions.store', 'uses' => 'Admin\RolesController@storePermission']);
31 | Route::get('roles/permissions/{id}/revoke/{permission_id}', ['as' => 'roles.permissions.revoke', 'uses' => 'Admin\RolesController@revokePermission']);
32 |
33 | Route::get('permissions', ['as' => 'permissions.index', 'uses' => 'Admin\PermissionsController@index']);
34 | Route::get('permissions/new', ['as' => 'permissions.create', 'uses' => 'Admin\PermissionsController@create']);
35 | Route::post('permissions/store', ['as' => 'permissions.store', 'uses' => 'Admin\PermissionsController@store']);
36 | Route::get('permissions/edit/{id}', ['as' => 'permissions.edit', 'uses' => 'Admin\PermissionsController@edit']);
37 | Route::put('permissions/update/{id}', ['as' => 'permissions.update', 'uses' => 'Admin\PermissionsController@update']);
38 | Route::get('permissions/destroy/{id}', ['as' => 'permissions.destroy', 'uses' => 'Admin\PermissionsController@destroy']);
39 |
40 | Route::get('users', ['as' => 'users.index', 'uses' => 'Admin\UsersController@index']);
41 | Route::get('users/new', ['as' => 'users.create', 'uses' => 'Admin\UsersController@create']);
42 | Route::post('users/store', ['as' => 'users.store', 'uses' => 'Admin\UsersController@store']);
43 | Route::get('users/edit/{id}', ['as' => 'users.edit', 'uses' => 'Admin\UsersController@edit']);
44 | Route::put('users/update/{id}', ['as' => 'users.update', 'uses' => 'Admin\UsersController@update']);
45 | Route::get('users/destroy/{id}', ['as' => 'users.destroy', 'uses' => 'Admin\UsersController@destroy']);
46 | Route::get('users/roles/{id}', ['as' => 'users.roles', 'uses' => 'Admin\UsersController@roles']);
47 | Route::post('users/roles/{id}/store', ['as' => 'users.roles.store', 'uses' => 'Admin\UsersController@storeRole']);
48 | Route::get('users/roles/{id}/revoke/{role_id}', ['as' => 'users.roles.revoke', 'uses' => 'Admin\UsersController@revokeRole']);
49 |
50 | Route::get('categories', ['as' => 'categories.index', 'uses' => 'Admin\CategoriesController@index']);
51 | Route::get('categories/new', ['as' => 'categories.create', 'uses' => 'Admin\CategoriesController@create']);
52 | Route::post('categories/store', ['as' => 'categories.store', 'uses' => 'Admin\CategoriesController@store']);
53 | Route::get('categories/edit/{id}', ['as' => 'categories.edit', 'uses' => 'Admin\CategoriesController@edit']);
54 | Route::put('categories/update/{id}', ['as' => 'categories.update', 'uses' => 'Admin\CategoriesController@update']);
55 | Route::get('categories/destroy/{id}', ['as' => 'categories.destroy', 'uses' => 'Admin\CategoriesController@destroy']);
56 |
57 | Route::get('books', ['as' => 'books.index', 'uses' => 'Admin\BooksController@index']);
58 | Route::get('books/new', ['as' => 'books.create', 'uses' => 'Admin\BooksController@create']);
59 | Route::post('books/store', ['as' => 'books.store', 'uses' => 'Admin\BooksController@store']);
60 | Route::get('books/edit/{id}', ['as' => 'books.edit', 'uses' => 'Admin\BooksController@edit']);
61 | Route::put('books/update/{id}', ['as' => 'books.update', 'uses' => 'Admin\BooksController@update']);
62 | Route::get('books/destroy/{id}', ['as' => 'books.destroy', 'uses' => 'Admin\BooksController@destroy']);
63 | Route::get('books/cover/{id}', ['as' => 'books.cover', 'uses' => 'Admin\BooksController@cover']);
64 | Route::post('books/cover/{id}', ['as' => 'books.cover.store', 'uses' => 'Admin\BooksController@coverStore']);
65 | Route::get('books/export/{id}', ['as' => 'books.export', 'uses' => 'Admin\BooksController@export']);
66 | Route::get('books/download/{id}', ['as' => 'books.download', 'uses' => 'Admin\BooksController@download']);
67 |
68 |
69 | Route::group(['prefix' => 'books', 'as' => 'books.'], function () {
70 | Route::get('{id}/chapters', ['as' => 'chapters.index', 'uses' => 'Admin\ChaptersController@index']);
71 | Route::get('{id}/chapters/create', ['as' => 'chapters.create', 'uses' => 'Admin\ChaptersController@create']);
72 | Route::post('{id}/chapters/store', ['as' => 'chapters.store', 'uses' => 'Admin\ChaptersController@store']);
73 | Route::get('{id}/chapters/edit/{chapter_id}', ['as' => 'chapters.edit', 'uses' => 'Admin\ChaptersController@edit']);
74 | Route::put('{id}/chapters/update/{chapter_id}', ['as' => 'chapters.update', 'uses' => 'Admin\ChaptersController@update']);
75 | Route::get('{id}/chapters/destroy/{chapter_id}', ['as' => 'chapters.destroy', 'uses' => 'Admin\ChaptersController@destroy']);
76 | });
77 | });
78 |
79 |
--------------------------------------------------------------------------------
/app/Jobs/Job.php:
--------------------------------------------------------------------------------
1 | bookService = $bookService;
27 | }
28 |
29 | /**
30 | * Handle the event.
31 | *
32 | * @param GenerateBook $event
33 | * @return void
34 | */
35 | public function handle(GenerateBook $event)
36 | {
37 | $book = $event->book;
38 |
39 | $this->bookService->export($book);
40 | exec("php " . base_path("easybook/book publish {$book->id} print"));
41 | exec("php " . base_path("easybook/book publish {$book->id} kindle"));
42 | exec("php " . base_path("easybook/book publish {$book->id} ebook"));
43 | $this->bookService->compress($book);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/app/Models/Book.php:
--------------------------------------------------------------------------------
1 | 'title',
16 | 'save_to' => 'slug',
17 | ];
18 |
19 | protected $fillable = [
20 | 'user_id',
21 | 'category_id',
22 | 'title',
23 | 'subtitle',
24 | 'dedication',
25 | 'description',
26 | 'website',
27 | 'percent_complete',
28 | 'price',
29 | 'published'
30 | ];
31 |
32 | public function scopePublished($query)
33 | {
34 | return $query->where('published',1);
35 | }
36 |
37 | public function scopeHome($query)
38 | {
39 | return $query->where('published',1)->take(12)->orderBy('id','desc');
40 | }
41 |
42 | public function scopeLike($query, $field, $value)
43 | {
44 | return $query->where($field,'LIKE',"%{$value}%");
45 | }
46 |
47 |
48 | public function category()
49 | {
50 | return $this->belongsTo(Category::class);
51 | }
52 |
53 | public function author()
54 | {
55 | return $this->belongsTo(User::class, 'user_id');
56 | }
57 |
58 | public function chapters()
59 | {
60 | return $this->hasMany(Chapter::class);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/app/Models/BookInterface.php:
--------------------------------------------------------------------------------
1 | hasMany(Book::class);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/app/Models/Chapter.php:
--------------------------------------------------------------------------------
1 | belongsTo(Book::class);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/app/Models/Order.php:
--------------------------------------------------------------------------------
1 | belongsTo(Book::class);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/app/Models/Permission.php:
--------------------------------------------------------------------------------
1 | belongsToMany(Role::class);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/app/Models/Role.php:
--------------------------------------------------------------------------------
1 | belongsToMany(Permission::class);
18 | }
19 |
20 | public function addPermission(Permission $permission)
21 | {
22 | return $this->permissions()->save($permission);
23 | }
24 |
25 | public function revokePermission(Permission $permission)
26 | {
27 | return $this->permissions()->detach($permission);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/app/Models/User.php:
--------------------------------------------------------------------------------
1 | hasMany(Order::class);
33 | }
34 |
35 | public function roles()
36 | {
37 | return $this->belongsToMany(Role::class);
38 | }
39 |
40 | public function books()
41 | {
42 | return $this->hasMany(Book::class);
43 | }
44 |
45 | //$user->addRole('Admin')
46 | //$user->addRole($role);
47 | public function addRole($role)
48 | {
49 | if (is_string($role)) {
50 | return $this->roles()->save(
51 | Role::whereName($role)->firstOrFail()
52 | );
53 | }
54 |
55 | return $this->roles()->save(
56 | Role::whereName($role->name)->firstOrFail()
57 | );
58 |
59 | }
60 |
61 | public function revokeRole($role)
62 | {
63 | if (is_string($role)) {
64 | return $this->roles()->detach(
65 | Role::whereName($role)->firstOrFail()
66 | );
67 | }
68 |
69 | return $this->roles()->detach($role);
70 | }
71 |
72 | public function hasRole($role)
73 | {
74 | if (is_string($role)) {
75 | return $this->roles->contains('name', $role);
76 | }
77 |
78 | // if(is_array($role)) {
79 | // foreach($role as $r) {
80 | // if($this->roles->contains('name', $r)) {
81 | // return true;
82 | // }
83 | // }
84 | // return false;
85 | // }
86 |
87 | return $role->intersect($this->roles)->count();
88 | }
89 |
90 | public function isAdmin()
91 | {
92 | return $this->hasRole('Admin');
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/app/Policies/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/app/Policies/.gitkeep
--------------------------------------------------------------------------------
/app/Policies/BookPolicy.php:
--------------------------------------------------------------------------------
1 | id == $book->user_id;
15 | }
16 |
17 | public function before(User $user, $ability)
18 | {
19 | if($user->can('book_manage_all')) {
20 | return true;
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/app/Policies/ChapterPolicy.php:
--------------------------------------------------------------------------------
1 | book->user_id == $user->id;
16 | }
17 |
18 | public function before(User $user, $ability)
19 | {
20 | if($user->can('book_manage_all')) {
21 | return true;
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/Providers/AppServiceProvider.php:
--------------------------------------------------------------------------------
1 | app->singleton(BookInterface::class, Book::class);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/Providers/AuthServiceProvider.php:
--------------------------------------------------------------------------------
1 | 'CodePub\Policies\ModelPolicy',
25 | Book::class => BookPolicy::class,
26 | Chapter::class => ChapterPolicy::class
27 | ];
28 |
29 | /**
30 | * Register any application authentication / authorization services.
31 | *
32 | * @param \Illuminate\Contracts\Auth\Access\Gate $gate
33 | * @return void
34 | */
35 | public function boot(GateContract $gate)
36 | {
37 | $this->registerPolicies($gate);
38 |
39 | if( !App::runningInConsole() ){
40 | foreach($this->getPermissions() as $permission) {
41 | $gate->define($permission->name, function($user) use($permission) {
42 | return $user->hasRole($permission->roles) || $user->isAdmin();
43 | });
44 | }
45 | }
46 |
47 | }
48 |
49 | public function getPermissions()
50 | {
51 | return Permission::with('roles')->get();
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/app/Providers/EventServiceProvider.php:
--------------------------------------------------------------------------------
1 | [
17 | 'CodePub\Listeners\ExportBook',
18 | ],
19 | ];
20 |
21 | /**
22 | * Register any other events for your application.
23 | *
24 | * @param \Illuminate\Contracts\Events\Dispatcher $events
25 | * @return void
26 | */
27 | public function boot(DispatcherContract $events)
28 | {
29 | parent::boot($events);
30 |
31 | //
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/app/Providers/RouteServiceProvider.php:
--------------------------------------------------------------------------------
1 | group(['namespace' => $this->namespace], function ($router) {
41 | require app_path('Http/routes.php');
42 | });
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/app/Services/BookService.php:
--------------------------------------------------------------------------------
1 | parser = $parser;
30 | $this->dumper = $dumper;
31 | }
32 |
33 | public function storeCover(BookInterface $book, $cover)
34 | {
35 | Storage::disk('book_local')->put("{$book->id}/Resources/Templates/ebook/cover.jpg",
36 | File::get($cover));
37 | Storage::disk('book_local')->put("{$book->id}/Resources/Templates/cover.jpg",
38 | File::get($cover));
39 |
40 | $print_path = storage_path("books/{$book->id}/Resources/Templates/print");
41 |
42 | if (!is_dir($print_path)) {
43 | mkdir($print_path, 0775, true);
44 | }
45 |
46 | $img = new \Imagick(storage_path("books/{$book->id}/Resources/Templates/ebook/cover.jpg"));
47 | $img->setImageFormat("pdf");
48 | $img->writeImage(storage_path("books/{$book->id}/Resources/Templates/print/cover.pdf"));
49 |
50 | $thumbnail = \Image::open(storage_path("books/{$book->id}/Resources/Templates/ebook/cover.jpg"))
51 | ->thumbnail(new Box(356, 522));
52 | $thumbnail->save(public_path("books/thumbs/{$book->id}.jpg"));
53 |
54 | $thumbnail = \Image::open(storage_path("books/{$book->id}/Resources/Templates/ebook/cover.jpg"))
55 | ->thumbnail(new Box(138, 230));
56 | $thumbnail->save(public_path("books/thumbs/{$book->id}_small.jpg"));
57 | }
58 |
59 | public function export(BookInterface $book)
60 | {
61 | $this->exportContent($book);
62 | $config = $this->parser->parse(file_get_contents(storage_path('books/template/config.yml')));
63 | $config['book']['title'] = $book->title;
64 | $config['book']['author'] = $book->author->name;
65 |
66 | file_put_contents(storage_path("books/{$book->id}/Contents/dedication.md"), $book->dedication);
67 |
68 | foreach ($this->getChapters($book) as $chapter) {
69 | $ch['element'] = "chapter";
70 | $ch['number'] = $chapter->order;
71 | $ch['content'] = $chapter->order . ".md";
72 | array_push($config['book']['contents'], $ch);
73 | }
74 |
75 | $yml = $this->dumper->dump($config, 4);
76 |
77 | file_put_contents(storage_path("books/{$book->id}/config.yml"), $yml);
78 | }
79 |
80 | public function compress(BookInterface $book)
81 | {
82 | if (is_dir(storage_path("books/{$book->id}/Output"))) {
83 | ExtendedZip::zipTree(storage_path("books/{$book->id}/Output"),
84 | storage_path("books/{$book->id}/book.zip"),
85 | ExtendedZip::CREATE
86 | );
87 | }
88 | }
89 |
90 | private function getChapters(BookInterface $book)
91 | {
92 | return $book->chapters()->orderBy('order', 'asc')->get();
93 | }
94 |
95 | private function exportContent(BookInterface $book)
96 | {
97 | if (!is_dir(storage_path("books/{$book->id}/Contents/"))) {
98 | mkdir(storage_path("books/{$book->id}/Contents/"), 0775, true);
99 | }
100 | foreach ($this->getChapters($book) as $chapter) {
101 | file_put_contents(storage_path("books/{$book->id}/Contents/{$chapter->order}.md"), $chapter->content);
102 | }
103 | }
104 |
105 | }
--------------------------------------------------------------------------------
/app/Services/OrderService.php:
--------------------------------------------------------------------------------
1 | charge(number_format($book->price, 2, "", ""), [
17 | 'source' => $token,
18 | 'receipt_email' => $user->email
19 | ]);
20 |
21 | if ($charge) {
22 | Order::create([
23 | 'user_id' => $user->id,
24 | 'book_id' => $book->id,
25 | 'price' => $book->price
26 | ]);
27 | return true;
28 | }
29 | return false;
30 | }
31 | }
--------------------------------------------------------------------------------
/app/Util/ExtendedZip.php:
--------------------------------------------------------------------------------
1 | addEmptyDir($localname);
14 | $this->_addTree($dirname, $localname);
15 | }
16 |
17 | // Internal function, to recurse
18 | protected function _addTree($dirname, $localname) {
19 | $dir = opendir($dirname);
20 | while ($filename = readdir($dir)) {
21 | // Discard . and ..
22 | if ($filename == '.' || $filename == '..')
23 | continue;
24 |
25 | // Proceed according to type
26 | $path = $dirname . '/' . $filename;
27 | $localpath = $localname ? ($localname . '/' . $filename) : $filename;
28 | if (is_dir($path)) {
29 | // Directory: add & recurse
30 | $this->addEmptyDir($localpath);
31 | $this->_addTree($path, $localpath);
32 | }
33 | else if (is_file($path)) {
34 | // File: just add
35 | $this->addFile($path, $localpath);
36 | }
37 | }
38 | closedir($dir);
39 | }
40 |
41 | // Helper function
42 | public static function zipTree($dirname, $zipFilename, $flags = 0, $localname = '') {
43 | $zip = new self();
44 | $zip->open($zipFilename, $flags);
45 | $zip->addTree($dirname, $localname);
46 | $zip->close();
47 | }
48 | }
--------------------------------------------------------------------------------
/artisan:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 | make(Illuminate\Contracts\Console\Kernel::class);
32 |
33 | $status = $kernel->handle(
34 | $input = new Symfony\Component\Console\Input\ArgvInput,
35 | new Symfony\Component\Console\Output\ConsoleOutput
36 | );
37 |
38 | /*
39 | |--------------------------------------------------------------------------
40 | | Shutdown The Application
41 | |--------------------------------------------------------------------------
42 | |
43 | | Once Artisan has finished running. We will fire off the shutdown events
44 | | so that any final work may be done by the application before we shut
45 | | down the process. This is the last thing to happen to the request.
46 | |
47 | */
48 |
49 | $kernel->terminate($input, $status);
50 |
51 | exit($status);
52 |
--------------------------------------------------------------------------------
/bootstrap/app.php:
--------------------------------------------------------------------------------
1 | singleton(
30 | Illuminate\Contracts\Http\Kernel::class,
31 | CodePub\Http\Kernel::class
32 | );
33 |
34 | $app->singleton(
35 | Illuminate\Contracts\Console\Kernel::class,
36 | CodePub\Console\Kernel::class
37 | );
38 |
39 | $app->singleton(
40 | Illuminate\Contracts\Debug\ExceptionHandler::class,
41 | CodePub\Exceptions\Handler::class
42 | );
43 |
44 | /*
45 | |--------------------------------------------------------------------------
46 | | Return The Application
47 | |--------------------------------------------------------------------------
48 | |
49 | | This script returns the application instance. The instance is given to
50 | | the calling script so we can separate the building of the instances
51 | | from the actual running of the application and sending responses.
52 | |
53 | */
54 |
55 | return $app;
56 |
--------------------------------------------------------------------------------
/bootstrap/autoload.php:
--------------------------------------------------------------------------------
1 | =5.5.9",
9 | "laravel/framework": "5.2.*",
10 | "laravelcollective/html": "5.2.*",
11 | "folklore/image": "0.3.*",
12 | "laravel/cashier": "~6.0",
13 | "cviebrock/eloquent-sluggable": "^3.1"
14 | },
15 | "require-dev": {
16 | "fzaninotto/faker": "~1.4",
17 | "mockery/mockery": "0.9.*",
18 | "phpunit/phpunit": "~4.0",
19 | "symfony/css-selector": "2.8.*|3.0.*",
20 | "symfony/dom-crawler": "2.8.*|3.0.*"
21 | },
22 | "autoload": {
23 | "classmap": [
24 | "database"
25 | ],
26 | "psr-4": {
27 | "CodePub\\": "app/"
28 | }
29 | },
30 | "autoload-dev": {
31 | "classmap": [
32 | "tests/TestCase.php"
33 | ]
34 | },
35 | "scripts": {
36 | "post-root-package-install": [
37 | "php -r \"copy('.env.example', '.env');\""
38 | ],
39 | "post-create-project-cmd": [
40 | "php artisan key:generate"
41 | ],
42 | "post-install-cmd": [
43 | "php artisan clear-compiled",
44 | "php artisan optimize"
45 | ],
46 | "pre-update-cmd": [
47 | "php artisan clear-compiled"
48 | ],
49 | "post-update-cmd": [
50 | "php artisan optimize"
51 | ]
52 | },
53 | "config": {
54 | "preferred-install": "dist"
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/config/auth.php:
--------------------------------------------------------------------------------
1 | [
17 | 'guard' => 'web',
18 | 'passwords' => 'users',
19 | ],
20 |
21 | /*
22 | |--------------------------------------------------------------------------
23 | | Authentication Guards
24 | |--------------------------------------------------------------------------
25 | |
26 | | Next, you may define every authentication guard for your application.
27 | | Of course, a great default configuration has been defined for you
28 | | here which uses session storage and the Eloquent user provider.
29 | |
30 | | All authentication drivers have a user provider. This defines how the
31 | | users are actually retrieved out of your database or other storage
32 | | mechanisms used by this application to persist your user's data.
33 | |
34 | | Supported: "session", "token"
35 | |
36 | */
37 |
38 | 'guards' => [
39 | 'web' => [
40 | 'driver' => 'session',
41 | 'provider' => 'users',
42 | ],
43 |
44 | 'api' => [
45 | 'driver' => 'token',
46 | 'provider' => 'users',
47 | ],
48 | ],
49 |
50 | /*
51 | |--------------------------------------------------------------------------
52 | | User Providers
53 | |--------------------------------------------------------------------------
54 | |
55 | | All authentication drivers have a user provider. This defines how the
56 | | users are actually retrieved out of your database or other storage
57 | | mechanisms used by this application to persist your user's data.
58 | |
59 | | If you have multiple user tables or models you may configure multiple
60 | | sources which represent each model / table. These sources may then
61 | | be assigned to any extra authentication guards you have defined.
62 | |
63 | | Supported: "database", "eloquent"
64 | |
65 | */
66 |
67 | 'providers' => [
68 | 'users' => [
69 | 'driver' => 'eloquent',
70 | 'model' => CodePub\Models\User::class,
71 | ],
72 |
73 | // 'users' => [
74 | // 'driver' => 'database',
75 | // 'table' => 'users',
76 | // ],
77 | ],
78 |
79 | /*
80 | |--------------------------------------------------------------------------
81 | | Resetting Passwords
82 | |--------------------------------------------------------------------------
83 | |
84 | | Here you may set the options for resetting passwords including the view
85 | | that is your password reset e-mail. You may also set the name of the
86 | | table that maintains all of the reset tokens for your application.
87 | |
88 | | You may specify multiple password reset configurations if you have more
89 | | than one user table or model in the application and you want to have
90 | | separate password reset settings based on the specific user types.
91 | |
92 | | The expire time is the number of minutes that the reset token should be
93 | | considered valid. This security feature keeps tokens short-lived so
94 | | they have less time to be guessed. You may change this as needed.
95 | |
96 | */
97 |
98 | 'passwords' => [
99 | 'users' => [
100 | 'provider' => 'users',
101 | 'email' => 'auth.emails.password',
102 | 'table' => 'password_resets',
103 | 'expire' => 60,
104 | ],
105 | ],
106 |
107 | ];
108 |
--------------------------------------------------------------------------------
/config/broadcasting.php:
--------------------------------------------------------------------------------
1 | env('BROADCAST_DRIVER', 'pusher'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Broadcast Connections
21 | |--------------------------------------------------------------------------
22 | |
23 | | Here you may define all of the broadcast connections that will be used
24 | | to broadcast events to other systems or over websockets. Samples of
25 | | each available type of connection are provided inside this array.
26 | |
27 | */
28 |
29 | 'connections' => [
30 |
31 | 'pusher' => [
32 | 'driver' => 'pusher',
33 | 'key' => env('PUSHER_KEY'),
34 | 'secret' => env('PUSHER_SECRET'),
35 | 'app_id' => env('PUSHER_APP_ID'),
36 | 'options' => [
37 | //
38 | ],
39 | ],
40 |
41 | 'redis' => [
42 | 'driver' => 'redis',
43 | 'connection' => 'default',
44 | ],
45 |
46 | 'log' => [
47 | 'driver' => 'log',
48 | ],
49 |
50 | ],
51 |
52 | ];
53 |
--------------------------------------------------------------------------------
/config/cache.php:
--------------------------------------------------------------------------------
1 | env('CACHE_DRIVER', 'file'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Cache Stores
21 | |--------------------------------------------------------------------------
22 | |
23 | | Here you may define all of the cache "stores" for your application as
24 | | well as their drivers. You may even define multiple stores for the
25 | | same cache driver to group types of items stored in your caches.
26 | |
27 | */
28 |
29 | 'stores' => [
30 |
31 | 'apc' => [
32 | 'driver' => 'apc',
33 | ],
34 |
35 | 'array' => [
36 | 'driver' => 'array',
37 | ],
38 |
39 | 'database' => [
40 | 'driver' => 'database',
41 | 'table' => 'cache',
42 | 'connection' => null,
43 | ],
44 |
45 | 'file' => [
46 | 'driver' => 'file',
47 | 'path' => storage_path('framework/cache'),
48 | ],
49 |
50 | 'memcached' => [
51 | 'driver' => 'memcached',
52 | 'servers' => [
53 | [
54 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'),
55 | 'port' => env('MEMCACHED_PORT', 11211),
56 | 'weight' => 100,
57 | ],
58 | ],
59 | ],
60 |
61 | 'redis' => [
62 | 'driver' => 'redis',
63 | 'connection' => 'default',
64 | ],
65 |
66 | ],
67 |
68 | /*
69 | |--------------------------------------------------------------------------
70 | | Cache Key Prefix
71 | |--------------------------------------------------------------------------
72 | |
73 | | When utilizing a RAM based store such as APC or Memcached, there might
74 | | be other applications utilizing the same cache. So, we'll specify a
75 | | value to get prefixed to all our keys so we can avoid collisions.
76 | |
77 | */
78 |
79 | 'prefix' => 'laravel',
80 |
81 | ];
82 |
--------------------------------------------------------------------------------
/config/compile.php:
--------------------------------------------------------------------------------
1 | [
17 | //
18 | ],
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Compiled File Providers
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may list service providers which define a "compiles" function
26 | | that returns additional files that should be compiled, providing an
27 | | easy way to get common files from any packages you are utilizing.
28 | |
29 | */
30 |
31 | 'providers' => [
32 | //
33 | ],
34 |
35 | ];
36 |
--------------------------------------------------------------------------------
/config/database.php:
--------------------------------------------------------------------------------
1 | PDO::FETCH_CLASS,
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Default Database Connection Name
21 | |--------------------------------------------------------------------------
22 | |
23 | | Here you may specify which of the database connections below you wish
24 | | to use as your default connection for all database work. Of course
25 | | you may use many connections at once using the Database library.
26 | |
27 | */
28 |
29 | 'default' => env('DB_CONNECTION', 'mysql'),
30 |
31 | /*
32 | |--------------------------------------------------------------------------
33 | | Database Connections
34 | |--------------------------------------------------------------------------
35 | |
36 | | Here are each of the database connections setup for your application.
37 | | Of course, examples of configuring each database platform that is
38 | | supported by Laravel is shown below to make development simple.
39 | |
40 | |
41 | | All database work in Laravel is done through the PHP PDO facilities
42 | | so make sure you have the driver for your particular database of
43 | | choice installed on your machine before you begin development.
44 | |
45 | */
46 |
47 | 'connections' => [
48 |
49 | 'sqlite' => [
50 | 'driver' => 'sqlite',
51 | 'database' => database_path('database.sqlite'),
52 | 'prefix' => '',
53 | ],
54 |
55 | 'mysql' => [
56 | 'driver' => 'mysql',
57 | 'host' => env('DB_HOST', 'localhost'),
58 | 'database' => env('DB_DATABASE', 'forge'),
59 | 'username' => env('DB_USERNAME', 'forge'),
60 | 'password' => env('DB_PASSWORD', ''),
61 | 'charset' => 'utf8',
62 | 'collation' => 'utf8_unicode_ci',
63 | 'prefix' => '',
64 | 'strict' => false,
65 | 'engine' => null,
66 | ],
67 |
68 | 'pgsql' => [
69 | 'driver' => 'pgsql',
70 | 'host' => env('DB_HOST', 'localhost'),
71 | 'database' => env('DB_DATABASE', 'forge'),
72 | 'username' => env('DB_USERNAME', 'forge'),
73 | 'password' => env('DB_PASSWORD', ''),
74 | 'charset' => 'utf8',
75 | 'prefix' => '',
76 | 'schema' => 'public',
77 | ],
78 |
79 | 'sqlsrv' => [
80 | 'driver' => 'sqlsrv',
81 | 'host' => env('DB_HOST', 'localhost'),
82 | 'database' => env('DB_DATABASE', 'forge'),
83 | 'username' => env('DB_USERNAME', 'forge'),
84 | 'password' => env('DB_PASSWORD', ''),
85 | 'charset' => 'utf8',
86 | 'prefix' => '',
87 | ],
88 |
89 | ],
90 |
91 | /*
92 | |--------------------------------------------------------------------------
93 | | Migration Repository Table
94 | |--------------------------------------------------------------------------
95 | |
96 | | This table keeps track of all the migrations that have already run for
97 | | your application. Using this information, we can determine which of
98 | | the migrations on disk haven't actually been run in the database.
99 | |
100 | */
101 |
102 | 'migrations' => 'migrations',
103 |
104 | /*
105 | |--------------------------------------------------------------------------
106 | | Redis Databases
107 | |--------------------------------------------------------------------------
108 | |
109 | | Redis is an open source, fast, and advanced key-value store that also
110 | | provides a richer set of commands than a typical key-value systems
111 | | such as APC or Memcached. Laravel makes it easy to dig right in.
112 | |
113 | */
114 |
115 | 'redis' => [
116 |
117 | 'cluster' => false,
118 |
119 | 'default' => [
120 | 'host' => env('REDIS_HOST', 'localhost'),
121 | 'password' => env('REDIS_PASSWORD', null),
122 | 'port' => env('REDIS_PORT', 6379),
123 | 'database' => 0,
124 | ],
125 |
126 | ],
127 |
128 | ];
129 |
--------------------------------------------------------------------------------
/config/filesystems.php:
--------------------------------------------------------------------------------
1 | 'local',
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Default Cloud Filesystem Disk
23 | |--------------------------------------------------------------------------
24 | |
25 | | Many applications store files both locally and in the cloud. For this
26 | | reason, you may specify a default "cloud" driver here. This driver
27 | | will be bound as the Cloud disk implementation in the container.
28 | |
29 | */
30 |
31 | 'cloud' => 's3',
32 |
33 | /*
34 | |--------------------------------------------------------------------------
35 | | Filesystem Disks
36 | |--------------------------------------------------------------------------
37 | |
38 | | Here you may configure as many filesystem "disks" as you wish, and you
39 | | may even configure multiple disks of the same driver. Defaults have
40 | | been setup for each driver as an example of the required options.
41 | |
42 | */
43 |
44 | 'disks' => [
45 |
46 | 'local' => [
47 | 'driver' => 'local',
48 | 'root' => storage_path('app'),
49 | ],
50 | 'book_local' => [
51 | 'driver' => 'local',
52 | 'root' => storage_path('books'),
53 | ],
54 |
55 | 'ftp' => [
56 | 'driver' => 'ftp',
57 | 'host' => 'ftp.example.com',
58 | 'username' => 'your-username',
59 | 'password' => 'your-password',
60 |
61 | // Optional FTP Settings...
62 | // 'port' => 21,
63 | // 'root' => '',
64 | // 'passive' => true,
65 | // 'ssl' => true,
66 | // 'timeout' => 30,
67 | ],
68 |
69 | 's3' => [
70 | 'driver' => 's3',
71 | 'key' => 'your-key',
72 | 'secret' => 'your-secret',
73 | 'region' => 'your-region',
74 | 'bucket' => 'your-bucket',
75 | ],
76 |
77 | 'rackspace' => [
78 | 'driver' => 'rackspace',
79 | 'username' => 'your-username',
80 | 'key' => 'your-key',
81 | 'container' => 'your-container',
82 | 'endpoint' => 'https://identity.api.rackspacecloud.com/v2.0/',
83 | 'region' => 'IAD',
84 | 'url_type' => 'publicURL',
85 | ],
86 |
87 | ],
88 |
89 | ];
90 |
--------------------------------------------------------------------------------
/config/image.php:
--------------------------------------------------------------------------------
1 | 'gd',
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Host
23 | |--------------------------------------------------------------------------
24 | |
25 | | The http host where the image are served. Used by the Image::url() method
26 | | to generate the right URL.
27 | |
28 | */
29 | 'host' => '',
30 |
31 | /*
32 | |--------------------------------------------------------------------------
33 | | Source directories
34 | |--------------------------------------------------------------------------
35 | |
36 | | A list a directories to look for images
37 | |
38 | */
39 | 'src_dirs' => array(
40 | public_path()
41 | ),
42 |
43 | /*
44 | |--------------------------------------------------------------------------
45 | | URL parameter
46 | |--------------------------------------------------------------------------
47 | |
48 | | The URL parameter that will be appended to your image filename containing
49 | | all the options for image manipulation. You have to put {options} where
50 | | you want options to be placed. Keep in mind that this parameter is used
51 | | in an url so all characters should be URL safe.
52 | |
53 | | Default: -image({options})
54 | |
55 | | Example: /uploads/photo-image(300x300-grayscale).jpg
56 | |
57 | */
58 | 'url_parameter' => '-image({options})',
59 |
60 | /*
61 | |--------------------------------------------------------------------------
62 | | URL parameter separator
63 | |--------------------------------------------------------------------------
64 | |
65 | | The URL parameter separator is used to build the parameters string
66 | | that will replace {options} in url_parameter
67 | |
68 | | Default: -
69 | |
70 | | Example: /uploads/photo-image(300x300-grayscale).jpg
71 | |
72 | */
73 | 'url_parameter_separator' => '-',
74 |
75 | /*
76 | |--------------------------------------------------------------------------
77 | | Serve image
78 | |--------------------------------------------------------------------------
79 | |
80 | | If true, a route will be added to catch image containing the
81 | | URL parameter above.
82 | |
83 | */
84 | 'serve_image' => true,
85 |
86 | /*
87 | |--------------------------------------------------------------------------
88 | | Serve custom Filters only
89 | |--------------------------------------------------------------------------
90 | |
91 | | Restrict options in url to custom filters only. This prevent direct
92 | | manipulation of the image.
93 | |
94 | */
95 | 'serve_custom_filters_only' => false,
96 |
97 | /*
98 | |--------------------------------------------------------------------------
99 | | Write image
100 | |--------------------------------------------------------------------------
101 | |
102 | | When serving an image, write the manipulated image in the same directory
103 | | as the original image so the next request will serve this static file
104 | |
105 | */
106 | 'write_image' => false,
107 |
108 | /*
109 | |--------------------------------------------------------------------------
110 | | Write path
111 | |--------------------------------------------------------------------------
112 | |
113 | | By default, the manipulated images are saved in the same path as the
114 | | as the original image, you can override this path here
115 | |
116 | */
117 | 'write_path' => null,
118 |
119 | /*
120 | |--------------------------------------------------------------------------
121 | | Memory limit
122 | |--------------------------------------------------------------------------
123 | |
124 | | When manipulating an image, the memory limit is increased to this value
125 | |
126 | */
127 | 'memory_limit' => '128M'
128 |
129 | );
130 |
--------------------------------------------------------------------------------
/config/mail.php:
--------------------------------------------------------------------------------
1 | env('MAIL_DRIVER', 'smtp'),
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | SMTP Host Address
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may provide the host address of the SMTP server used by your
26 | | applications. A default option is provided that is compatible with
27 | | the Mailgun mail service which will provide reliable deliveries.
28 | |
29 | */
30 |
31 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
32 |
33 | /*
34 | |--------------------------------------------------------------------------
35 | | SMTP Host Port
36 | |--------------------------------------------------------------------------
37 | |
38 | | This is the SMTP port used by your application to deliver e-mails to
39 | | users of the application. Like the host we have set this value to
40 | | stay compatible with the Mailgun e-mail application by default.
41 | |
42 | */
43 |
44 | 'port' => env('MAIL_PORT', 587),
45 |
46 | /*
47 | |--------------------------------------------------------------------------
48 | | Global "From" Address
49 | |--------------------------------------------------------------------------
50 | |
51 | | You may wish for all e-mails sent by your application to be sent from
52 | | the same address. Here, you may specify a name and address that is
53 | | used globally for all e-mails that are sent by your application.
54 | |
55 | */
56 |
57 | 'from' => ['address' => null, 'name' => null],
58 |
59 | /*
60 | |--------------------------------------------------------------------------
61 | | E-Mail Encryption Protocol
62 | |--------------------------------------------------------------------------
63 | |
64 | | Here you may specify the encryption protocol that should be used when
65 | | the application send e-mail messages. A sensible default using the
66 | | transport layer security protocol should provide great security.
67 | |
68 | */
69 |
70 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'),
71 |
72 | /*
73 | |--------------------------------------------------------------------------
74 | | SMTP Server Username
75 | |--------------------------------------------------------------------------
76 | |
77 | | If your SMTP server requires a username for authentication, you should
78 | | set it here. This will get used to authenticate with your server on
79 | | connection. You may also set the "password" value below this one.
80 | |
81 | */
82 |
83 | 'username' => env('MAIL_USERNAME'),
84 |
85 | /*
86 | |--------------------------------------------------------------------------
87 | | SMTP Server Password
88 | |--------------------------------------------------------------------------
89 | |
90 | | Here you may set the password required by your SMTP server to send out
91 | | messages from your application. This will be given to the server on
92 | | connection so that the application will be able to send messages.
93 | |
94 | */
95 |
96 | 'password' => env('MAIL_PASSWORD'),
97 |
98 | /*
99 | |--------------------------------------------------------------------------
100 | | Sendmail System Path
101 | |--------------------------------------------------------------------------
102 | |
103 | | When using the "sendmail" driver to send e-mails, we will need to know
104 | | the path to where Sendmail lives on this server. A default path has
105 | | been provided here, which will work well on most of your systems.
106 | |
107 | */
108 |
109 | 'sendmail' => '/usr/sbin/sendmail -bs',
110 |
111 | ];
112 |
--------------------------------------------------------------------------------
/config/queue.php:
--------------------------------------------------------------------------------
1 | env('QUEUE_DRIVER', 'database'),
20 |
21 | /*
22 | |--------------------------------------------------------------------------
23 | | Queue Connections
24 | |--------------------------------------------------------------------------
25 | |
26 | | Here you may configure the connection information for each server that
27 | | is used by your application. A default configuration has been added
28 | | for each back-end shipped with Laravel. You are free to add more.
29 | |
30 | */
31 |
32 | 'connections' => [
33 |
34 | 'sync' => [
35 | 'driver' => 'sync',
36 | ],
37 |
38 | 'database' => [
39 | 'driver' => 'database',
40 | 'table' => 'jobs',
41 | 'queue' => 'default',
42 | 'expire' => 60,
43 | ],
44 |
45 | 'beanstalkd' => [
46 | 'driver' => 'beanstalkd',
47 | 'host' => 'localhost',
48 | 'queue' => 'default',
49 | 'ttr' => 60,
50 | ],
51 |
52 | 'sqs' => [
53 | 'driver' => 'sqs',
54 | 'key' => 'your-public-key',
55 | 'secret' => 'your-secret-key',
56 | 'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id',
57 | 'queue' => 'your-queue-name',
58 | 'region' => 'us-east-1',
59 | ],
60 |
61 | 'redis' => [
62 | 'driver' => 'redis',
63 | 'connection' => 'default',
64 | 'queue' => 'default',
65 | 'expire' => 60,
66 | ],
67 |
68 | ],
69 |
70 | /*
71 | |--------------------------------------------------------------------------
72 | | Failed Queue Jobs
73 | |--------------------------------------------------------------------------
74 | |
75 | | These options configure the behavior of failed queue job logging so you
76 | | can control which database and table are used to store the jobs that
77 | | have failed. You may change them to any database / table you wish.
78 | |
79 | */
80 |
81 | 'failed' => [
82 | 'database' => env('DB_CONNECTION', 'mysql'),
83 | 'table' => 'failed_jobs',
84 | ],
85 |
86 | ];
87 |
--------------------------------------------------------------------------------
/config/services.php:
--------------------------------------------------------------------------------
1 | [
18 | 'domain' => env('MAILGUN_DOMAIN'),
19 | 'secret' => env('MAILGUN_SECRET'),
20 | ],
21 |
22 | 'mandrill' => [
23 | 'secret' => env('MANDRILL_SECRET'),
24 | ],
25 |
26 | 'ses' => [
27 | 'key' => env('SES_KEY'),
28 | 'secret' => env('SES_SECRET'),
29 | 'region' => 'us-east-1',
30 | ],
31 |
32 | 'stripe' => [
33 | 'model' => CodePub\Models\User::class,
34 | 'key' => env('STRIPE_KEY'),
35 | 'secret' => env('STRIPE_SECRET'),
36 | ],
37 |
38 | ];
39 |
--------------------------------------------------------------------------------
/config/session.php:
--------------------------------------------------------------------------------
1 | env('SESSION_DRIVER', 'file'),
20 |
21 | /*
22 | |--------------------------------------------------------------------------
23 | | Session Lifetime
24 | |--------------------------------------------------------------------------
25 | |
26 | | Here you may specify the number of minutes that you wish the session
27 | | to be allowed to remain idle before it expires. If you want them
28 | | to immediately expire on the browser closing, set that option.
29 | |
30 | */
31 |
32 | 'lifetime' => 120,
33 |
34 | 'expire_on_close' => false,
35 |
36 | /*
37 | |--------------------------------------------------------------------------
38 | | Session Encryption
39 | |--------------------------------------------------------------------------
40 | |
41 | | This option allows you to easily specify that all of your session data
42 | | should be encrypted before it is stored. All encryption will be run
43 | | automatically by Laravel and you can use the Session like normal.
44 | |
45 | */
46 |
47 | 'encrypt' => false,
48 |
49 | /*
50 | |--------------------------------------------------------------------------
51 | | Session File Location
52 | |--------------------------------------------------------------------------
53 | |
54 | | When using the native session driver, we need a location where session
55 | | files may be stored. A default has been set for you but a different
56 | | location may be specified. This is only needed for file sessions.
57 | |
58 | */
59 |
60 | 'files' => storage_path('framework/sessions'),
61 |
62 | /*
63 | |--------------------------------------------------------------------------
64 | | Session Database Connection
65 | |--------------------------------------------------------------------------
66 | |
67 | | When using the "database" or "redis" session drivers, you may specify a
68 | | connection that should be used to manage these sessions. This should
69 | | correspond to a connection in your database configuration options.
70 | |
71 | */
72 |
73 | 'connection' => null,
74 |
75 | /*
76 | |--------------------------------------------------------------------------
77 | | Session Database Table
78 | |--------------------------------------------------------------------------
79 | |
80 | | When using the "database" session driver, you may specify the table we
81 | | should use to manage the sessions. Of course, a sensible default is
82 | | provided for you; however, you are free to change this as needed.
83 | |
84 | */
85 |
86 | 'table' => 'sessions',
87 |
88 | /*
89 | |--------------------------------------------------------------------------
90 | | Session Sweeping Lottery
91 | |--------------------------------------------------------------------------
92 | |
93 | | Some session drivers must manually sweep their storage location to get
94 | | rid of old sessions from storage. Here are the chances that it will
95 | | happen on a given request. By default, the odds are 2 out of 100.
96 | |
97 | */
98 |
99 | 'lottery' => [2, 100],
100 |
101 | /*
102 | |--------------------------------------------------------------------------
103 | | Session Cookie Name
104 | |--------------------------------------------------------------------------
105 | |
106 | | Here you may change the name of the cookie used to identify a session
107 | | instance by ID. The name specified here will get used every time a
108 | | new session cookie is created by the framework for every driver.
109 | |
110 | */
111 |
112 | 'cookie' => 'laravel_session',
113 |
114 | /*
115 | |--------------------------------------------------------------------------
116 | | Session Cookie Path
117 | |--------------------------------------------------------------------------
118 | |
119 | | The session cookie path determines the path for which the cookie will
120 | | be regarded as available. Typically, this will be the root path of
121 | | your application but you are free to change this when necessary.
122 | |
123 | */
124 |
125 | 'path' => '/',
126 |
127 | /*
128 | |--------------------------------------------------------------------------
129 | | Session Cookie Domain
130 | |--------------------------------------------------------------------------
131 | |
132 | | Here you may change the domain of the cookie used to identify a session
133 | | in your application. This will determine which domains the cookie is
134 | | available to in your application. A sensible default has been set.
135 | |
136 | */
137 |
138 | 'domain' => null,
139 |
140 | /*
141 | |--------------------------------------------------------------------------
142 | | HTTPS Only Cookies
143 | |--------------------------------------------------------------------------
144 | |
145 | | By setting this option to true, session cookies will only be sent back
146 | | to the server if the browser has a HTTPS connection. This will keep
147 | | the cookie from being sent to you if it can not be done securely.
148 | |
149 | */
150 |
151 | 'secure' => false,
152 |
153 | ];
154 |
--------------------------------------------------------------------------------
/config/view.php:
--------------------------------------------------------------------------------
1 | [
17 | realpath(base_path('resources/views')),
18 | ],
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Compiled View Path
23 | |--------------------------------------------------------------------------
24 | |
25 | | This option determines where all the compiled Blade templates will be
26 | | stored for your application. Typically, this is within the storage
27 | | directory. However, as usual, you are free to change this value.
28 | |
29 | */
30 |
31 | 'compiled' => realpath(storage_path('framework/views')),
32 |
33 | ];
34 |
--------------------------------------------------------------------------------
/database/.gitignore:
--------------------------------------------------------------------------------
1 | *.sqlite
2 |
--------------------------------------------------------------------------------
/database/factories/ModelFactory.php:
--------------------------------------------------------------------------------
1 | define(CodePub\Models\User::class, function (Faker\Generator $faker) {
15 | return [
16 | 'name' => $faker->name,
17 | 'email' => $faker->email,
18 | 'password' => bcrypt(str_random(10)),
19 | 'remember_token' => str_random(10),
20 | ];
21 | });
22 |
23 | $factory->define(CodePub\Models\Permission::class, function (Faker\Generator $faker) {
24 | return [
25 | 'name' => $faker->word,
26 | 'description' => $faker->sentence,
27 | ];
28 | });
29 |
30 | $factory->define(CodePub\Models\Role::class, function (Faker\Generator $faker) {
31 | return [
32 | 'name' => $faker->word,
33 | 'description' => $faker->sentence,
34 | ];
35 | });
36 |
37 | $factory->define(CodePub\Models\Category::class, function (Faker\Generator $faker) {
38 | return [
39 | 'name' => $faker->word,
40 | ];
41 | });
42 |
43 | $factory->define(CodePub\Models\Book::class, function (Faker\Generator $faker) {
44 | return [
45 | 'user_id' => 1,
46 | 'category_id' => 1,
47 | 'title' => $faker->sentence,
48 | 'subtitle' => $faker->sentence,
49 | 'dedication' => $faker->sentence,
50 | 'description' => $faker->paragraph,
51 | 'website' => $faker->url,
52 | 'percent_complete' => rand(1, 100),
53 | 'price' => 100.76,
54 | 'published' => false
55 | ];
56 | });
57 |
--------------------------------------------------------------------------------
/database/migrations/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/database/migrations/.gitkeep
--------------------------------------------------------------------------------
/database/migrations/2014_10_12_000000_create_users_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
17 | $table->string('name');
18 | $table->string('email')->unique();
19 | $table->string('password', 60);
20 | $table->rememberToken();
21 | $table->timestamps();
22 | });
23 | }
24 |
25 | /**
26 | * Reverse the migrations.
27 | *
28 | * @return void
29 | */
30 | public function down()
31 | {
32 | Schema::drop('users');
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/database/migrations/2014_10_12_100000_create_password_resets_table.php:
--------------------------------------------------------------------------------
1 | string('email')->index();
17 | $table->string('token')->index();
18 | $table->timestamp('created_at');
19 | });
20 | }
21 |
22 | /**
23 | * Reverse the migrations.
24 | *
25 | * @return void
26 | */
27 | public function down()
28 | {
29 | Schema::drop('password_resets');
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/database/migrations/2016_02_06_180247_create_permissions_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
17 | $table->string('name');
18 | $table->string('description')->nullable();
19 | $table->timestamps();
20 | });
21 | }
22 |
23 | /**
24 | * Reverse the migrations.
25 | *
26 | * @return void
27 | */
28 | public function down()
29 | {
30 | Schema::drop('permissions');
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/database/migrations/2016_02_06_180637_create_roles_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
17 | $table->string('name');
18 | $table->string('description')->nullable();
19 | $table->timestamps();
20 | });
21 |
22 | Schema::create('permission_role', function (Blueprint $table) {
23 | $table->integer('permission_id')->unsigned();
24 | $table->integer('role_id')->unsigned();
25 |
26 | $table->foreign('permission_id')->references('id')->on('permissions')->onDelete('cascade');
27 | $table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade');
28 |
29 | $table->primary(['permission_id','role_id']);
30 | });
31 |
32 | Schema::create('role_user', function (Blueprint $table) {
33 | $table->integer('role_id')->unsigned();
34 | $table->integer('user_id')->unsigned();
35 |
36 | $table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade');
37 | $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
38 |
39 |
40 | $table->primary(['role_id','user_id']);
41 | });
42 | }
43 |
44 | /**
45 | * Reverse the migrations.
46 | *
47 | * @return void
48 | */
49 | public function down()
50 | {
51 | Schema::drop('role_user');
52 | Schema::drop('permission_role');
53 | Schema::drop('roles');
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/database/migrations/2016_02_07_172956_create_categories_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
17 | $table->string('name');
18 | $table->timestamps();
19 | });
20 | }
21 |
22 | /**
23 | * Reverse the migrations.
24 | *
25 | * @return void
26 | */
27 | public function down()
28 | {
29 | Schema::drop('categories');
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/database/migrations/2016_02_07_192008_create_books_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
17 |
18 | $table->integer('user_id')->unsigned();
19 | $table->foreign('user_id')->references('id')->on('users');
20 |
21 | $table->integer('category_id')->unsigned();
22 | $table->foreign('category_id')->references('id')->on('categories');
23 |
24 | $table->string('title');
25 | $table->string('subtitle');
26 | $table->text('dedication');
27 | $table->text('description');
28 | $table->string('website')->nullable();
29 | $table->integer('percent_complete');
30 | $table->decimal('price', 8, 2);
31 | $table->boolean('published');
32 |
33 | $table->timestamps();
34 | });
35 | }
36 |
37 | /**
38 | * Reverse the migrations.
39 | *
40 | * @return void
41 | */
42 | public function down()
43 | {
44 | Schema::drop('books');
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/database/migrations/2016_02_08_183033_create_chapters_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
17 | $table->integer('book_id')->unsigned();
18 | $table->foreign('book_id')->references('id')->on('books')->onDelete('cascade');
19 | $table->string('name');
20 | $table->text('content');
21 | $table->integer('order')->default(1);
22 | $table->timestamps();
23 | });
24 | }
25 |
26 | /**
27 | * Reverse the migrations.
28 | *
29 | * @return void
30 | */
31 | public function down()
32 | {
33 | Schema::drop('chapters');
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/database/migrations/2016_02_08_203854_create_jobs_table.php:
--------------------------------------------------------------------------------
1 | bigIncrements('id');
17 | $table->string('queue');
18 | $table->longText('payload');
19 | $table->tinyInteger('attempts')->unsigned();
20 | $table->tinyInteger('reserved')->unsigned();
21 | $table->unsignedInteger('reserved_at')->nullable();
22 | $table->unsignedInteger('available_at');
23 | $table->unsignedInteger('created_at');
24 | $table->index(['queue', 'reserved', 'reserved_at']);
25 | });
26 | }
27 |
28 | /**
29 | * Reverse the migrations.
30 | *
31 | * @return void
32 | */
33 | public function down()
34 | {
35 | Schema::drop('jobs');
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/database/migrations/2016_02_09_183753_cashier_tables.php:
--------------------------------------------------------------------------------
1 | string('stripe_id')->nullable();
17 | $table->string('card_brand')->nullable();
18 | $table->string('card_last_four')->nullable();
19 | });
20 |
21 | Schema::create('subscriptions', function ($table) {
22 | $table->increments('id');
23 | $table->integer('user_id');
24 | $table->string('name');
25 | $table->string('stripe_id');
26 | $table->string('stripe_plan');
27 | $table->integer('quantity');
28 | $table->timestamp('trial_ends_at')->nullable();
29 | $table->timestamp('ends_at')->nullable();
30 | $table->timestamps();
31 | });
32 | }
33 |
34 | /**
35 | * Reverse the migrations.
36 | *
37 | * @return void
38 | */
39 | public function down()
40 | {
41 | Schema::drop('subscriptions');
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/database/migrations/2016_02_09_193023_create_orders_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
17 |
18 | $table->integer('user_id')->unsigned();
19 | $table->foreign('user_id')->references('id')->on('users');
20 |
21 | $table->integer('book_id')->unsigned();
22 | $table->foreign('book_id')->references('id')->on('books')->onDelete('cascade');
23 |
24 | $table->decimal('price');
25 |
26 | $table->timestamps();
27 | });
28 | }
29 |
30 | /**
31 | * Reverse the migrations.
32 | *
33 | * @return void
34 | */
35 | public function down()
36 | {
37 | Schema::drop('orders');
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/database/migrations/2016_02_09_200315_add_slug_column_on_books.php:
--------------------------------------------------------------------------------
1 | string('slug');
17 | });
18 | }
19 |
20 | /**
21 | * Reverse the migrations.
22 | *
23 | * @return void
24 | */
25 | public function down()
26 | {
27 | //
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/database/seeds/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/database/seeds/.gitkeep
--------------------------------------------------------------------------------
/database/seeds/BookTableSeeder.php:
--------------------------------------------------------------------------------
1 | create([
15 | 'name' => 'Author da Silva',
16 | 'email'=>'author@admin.com',
17 | 'password'=>bcrypt(123456)
18 | ]);
19 |
20 | $author2 = factory(\CodePub\Models\User::class)->create([
21 | 'name' => 'Author 2 da Silva',
22 | 'email'=>'author2@admin.com',
23 | 'password'=>bcrypt(123456)
24 | ]);
25 |
26 | factory(\CodePub\Models\Book::class, 2)->create([
27 | 'user_id'=>$author->id
28 | ]);
29 |
30 | factory(\CodePub\Models\Book::class, 2)->create([
31 | 'user_id'=>$author2->id
32 | ]);
33 |
34 | $book_manage = factory(\CodePub\Models\Permission::class)->create([
35 | 'name'=>'book_manage_all',
36 | 'description'=>'Can Manage All books'
37 | ]);
38 |
39 | $roleManager = \CodePub\Models\Role::whereName('Manager')->first();
40 | $roleManager->addPermission($book_manage);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/database/seeds/CategoriesTableSeeder.php:
--------------------------------------------------------------------------------
1 | create([
15 | 'name'=>'Art'
16 | ]);
17 |
18 | factory(\CodePub\Models\Category::class)->create([
19 | 'name'=>'Tech'
20 | ]);
21 |
22 | factory(\CodePub\Models\Category::class)->create([
23 | 'name'=>'Business'
24 | ]);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/database/seeds/DatabaseSeeder.php:
--------------------------------------------------------------------------------
1 | call(UsersRolesPermissionsSeeder::class);
15 | $this->call(CategoriesTableSeeder::class);
16 | $this->call(BookTableSeeder::class);
17 |
18 |
19 |
20 |
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/database/seeds/UsersRolesPermissionsSeeder.php:
--------------------------------------------------------------------------------
1 | create([
15 | 'name' => 'Admin da Silva',
16 | 'email' => 'admin@admin.com',
17 | 'password' => bcrypt(123456)
18 | ]);
19 |
20 | $roleAdmin = factory(\CodePub\Models\Role::class)->create([
21 | 'name' => 'Admin',
22 | 'description' => 'System Administrator'
23 | ]);
24 |
25 | $user->addRole($roleAdmin);
26 |
27 | $userManager = factory(\CodePub\Models\User::class)->create([
28 | 'name' => 'Manager da Silva',
29 | 'email' => 'manager@admin.com',
30 | 'password' => bcrypt(123456)
31 | ]);
32 |
33 | $roleManager = factory(\CodePub\Models\Role::class)->create([
34 | 'name' => 'Manager',
35 | 'description' => 'System Manager'
36 | ]);
37 |
38 | $userManager->addRole($roleManager);
39 |
40 | $userSupervisor = factory(\CodePub\Models\User::class)->create([
41 | 'name' => 'Supervisor da Silva',
42 | 'email' => 'supervisor@admin.com',
43 | 'password' => bcrypt(123456)
44 | ]);
45 |
46 | $roleSupervisor = factory(\CodePub\Models\Role::class)->create([
47 | 'name' => 'Supervisor',
48 | 'description' => 'System Supervisor'
49 | ]);
50 |
51 | $userSupervisor->addRole($roleSupervisor);
52 |
53 |
54 | $userList = factory(\CodePub\Models\Permission::class)->create([
55 | 'name'=>'user_list',
56 | 'description' => 'Can list all users'
57 | ]);
58 |
59 | $userAdd = factory(\CodePub\Models\Permission::class)->create([
60 | 'name'=>'user_add',
61 | 'description' => 'Can add users'
62 | ]);
63 |
64 | $userEdit = factory(\CodePub\Models\Permission::class)->create([
65 | 'name'=>'user_edit',
66 | 'description' => 'Can edit users'
67 | ]);
68 |
69 | $userDestroy = factory(\CodePub\Models\Permission::class)->create([
70 | 'name'=>'user_destroy',
71 | 'description' => 'Can destroy an user'
72 | ]);
73 |
74 | $userViewRoles = factory(\CodePub\Models\Permission::class)->create([
75 | 'name'=>'user_view_roles',
76 | 'description' => 'Can view the users roles'
77 | ]);
78 |
79 | $userAddRole = factory(\CodePub\Models\Permission::class)->create([
80 | 'name'=>'user_add_role',
81 | 'description' => 'Can add a new role for an user'
82 | ]);
83 |
84 | $userRevokeRole = factory(\CodePub\Models\Permission::class)->create([
85 | 'name'=>'user_revoke_role',
86 | 'description' => 'Can revoke a role for an user'
87 | ]);
88 |
89 | $managePermissions = factory(\CodePub\Models\Permission::class)->create([
90 | 'name'=>'permission_admin',
91 | 'description' => 'Can admin all permissions'
92 | ]);
93 |
94 | $AdminRoles = factory(\CodePub\Models\Permission::class)->create([
95 | 'name'=>'role_admin',
96 | 'description' => 'Can admin all roles'
97 | ]);
98 |
99 | $roleManager->addPermission($userList);
100 | $roleManager->addPermission($userEdit);
101 | $roleManager->addPermission($userAdd);
102 | $roleManager->addPermission($userViewRoles);
103 |
104 | $roleSupervisor->addPermission($userList);
105 | $roleSupervisor->addPermission($userViewRoles);
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/gulpfile.js:
--------------------------------------------------------------------------------
1 | var elixir = require('laravel-elixir');
2 |
3 | /*
4 | |--------------------------------------------------------------------------
5 | | Elixir Asset Management
6 | |--------------------------------------------------------------------------
7 | |
8 | | Elixir provides a clean, fluent API for defining some basic Gulp tasks
9 | | for your Laravel application. By default, we are compiling the Sass
10 | | file for our application, as well as publishing vendor resources.
11 | |
12 | */
13 |
14 | elixir(function(mix) {
15 | mix.sass('app.scss');
16 | });
17 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "devDependencies": {
4 | "gulp": "^3.8.8"
5 | },
6 | "dependencies": {
7 | "laravel-elixir": "^4.0.0",
8 | "bootstrap-sass": "^3.0.0"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 | ./tests/
14 |
15 |
16 |
17 |
18 | app/
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/public/.htaccess:
--------------------------------------------------------------------------------
1 |
2 |
3 | Options -MultiViews
4 |
5 |
6 | RewriteEngine On
7 |
8 | # Redirect Trailing Slashes If Not A Folder...
9 | RewriteCond %{REQUEST_FILENAME} !-d
10 | RewriteRule ^(.*)/$ /$1 [L,R=301]
11 |
12 | # Handle Front Controller...
13 | RewriteCond %{REQUEST_FILENAME} !-d
14 | RewriteCond %{REQUEST_FILENAME} !-f
15 | RewriteRule ^ index.php [L]
16 |
17 | # Handle Authorization Header
18 | RewriteCond %{HTTP:Authorization} .
19 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
20 |
21 |
--------------------------------------------------------------------------------
/public/books/thumbs/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/books/thumbs/1.jpg
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/favicon.ico
--------------------------------------------------------------------------------
/public/img/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/img/background.png
--------------------------------------------------------------------------------
/public/img/bar-green.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/img/bar-green.png
--------------------------------------------------------------------------------
/public/img/bar-transp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/img/bar-transp.png
--------------------------------------------------------------------------------
/public/img/book.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/img/book.png
--------------------------------------------------------------------------------
/public/img/cellphone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/img/cellphone.png
--------------------------------------------------------------------------------
/public/img/comments.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/img/comments.png
--------------------------------------------------------------------------------
/public/img/computer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/img/computer.png
--------------------------------------------------------------------------------
/public/img/connection.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/img/connection.png
--------------------------------------------------------------------------------
/public/img/earth.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/img/earth.png
--------------------------------------------------------------------------------
/public/img/facebook.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/img/facebook.png
--------------------------------------------------------------------------------
/public/img/foto.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/img/foto.png
--------------------------------------------------------------------------------
/public/img/foto01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/img/foto01.png
--------------------------------------------------------------------------------
/public/img/google.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/img/google.png
--------------------------------------------------------------------------------
/public/img/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/img/icon.png
--------------------------------------------------------------------------------
/public/img/ipad-cell.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/img/ipad-cell.png
--------------------------------------------------------------------------------
/public/img/ipad.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/img/ipad.png
--------------------------------------------------------------------------------
/public/img/l1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/img/l1.png
--------------------------------------------------------------------------------
/public/img/l2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/img/l2.png
--------------------------------------------------------------------------------
/public/img/l3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/img/l3.png
--------------------------------------------------------------------------------
/public/img/l4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/img/l4.png
--------------------------------------------------------------------------------
/public/img/l5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/img/l5.png
--------------------------------------------------------------------------------
/public/img/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/img/logo.png
--------------------------------------------------------------------------------
/public/img/sombra.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/img/sombra.png
--------------------------------------------------------------------------------
/public/img/twitter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/img/twitter.png
--------------------------------------------------------------------------------
/public/index.php:
--------------------------------------------------------------------------------
1 |
8 | */
9 |
10 | /*
11 | |--------------------------------------------------------------------------
12 | | Register The Auto Loader
13 | |--------------------------------------------------------------------------
14 | |
15 | | Composer provides a convenient, automatically generated class loader for
16 | | our application. We just need to utilize it! We'll simply require it
17 | | into the script here so that we don't have to worry about manual
18 | | loading any of our classes later on. It feels nice to relax.
19 | |
20 | */
21 |
22 | require __DIR__.'/../bootstrap/autoload.php';
23 |
24 | /*
25 | |--------------------------------------------------------------------------
26 | | Turn On The Lights
27 | |--------------------------------------------------------------------------
28 | |
29 | | We need to illuminate PHP development, so let us turn on the lights.
30 | | This bootstraps the framework and gets it ready for use, then it
31 | | will load up this application so that we can run it and send
32 | | the responses back to the browser and delight our users.
33 | |
34 | */
35 |
36 | $app = require_once __DIR__.'/../bootstrap/app.php';
37 |
38 | /*
39 | |--------------------------------------------------------------------------
40 | | Run The Application
41 | |--------------------------------------------------------------------------
42 | |
43 | | Once we have the application, we can handle the incoming request
44 | | through the kernel, and send the associated response back to
45 | | the client's browser allowing them to enjoy the creative
46 | | and wonderful application we have prepared for them.
47 | |
48 | */
49 |
50 | $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
51 |
52 | $response = $kernel->handle(
53 | $request = Illuminate\Http\Request::capture()
54 | );
55 |
56 | $response->send();
57 |
58 | $kernel->terminate($request, $response);
59 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 | Disallow:
3 |
--------------------------------------------------------------------------------
/public/vendor/folklore/image/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/public/vendor/folklore/image/.gitkeep
--------------------------------------------------------------------------------
/public/vendor/folklore/image/js/image.js:
--------------------------------------------------------------------------------
1 | (function (root, factory) {
2 | if (typeof define === 'function' && define.amd) {
3 | // AMD. Register as an anonymous module.
4 | define([], factory);
5 | } else if (typeof exports === 'object') {
6 | // Node. Does not work with strict CommonJS, but
7 | // only CommonJS-like environments that support module.exports,
8 | // like Node.
9 | module.exports = factory();
10 | } else {
11 | // Browser globals (root is window)
12 | if(typeof(root.Folklore) === 'undefined') {
13 | root.Folklore = {};
14 | }
15 | root.Folklore.Image = factory();
16 | }
17 | }(this, function () {
18 |
19 | 'use strict';
20 |
21 | var URL_PARAMETER = '-image({options})';
22 |
23 | // Build a image formatted URL
24 | function url(src, width, height, options) {
25 |
26 | // Don't allow empty strings
27 | if (!src || !src.length) return;
28 |
29 | //If width parameter is an array, use it as options
30 | if(width instanceof Object)
31 | {
32 | options = width;
33 | width = null;
34 | height = null;
35 | }
36 |
37 | //Get size
38 | if (!width) width = '_';
39 | if (!height) height = '_';
40 |
41 | // Produce the image option
42 | var params = [];
43 |
44 | //Add size if presents
45 | if(width != '_' || height != '_') {
46 | params.push(width+'x'+height);
47 | }
48 |
49 | // Add options.
50 | if (options && options instanceof Object) {
51 | var val, key;
52 | for (key in options) {
53 | val = options[key];
54 | if (val === true || val === null) {
55 | params.push(key);
56 | }
57 | else if (val instanceof Array) {
58 | params.push(key+'('+val.join(',')+')');
59 | }
60 | else {
61 | params.push(key+'('+val+')');
62 | }
63 | }
64 | }
65 |
66 | params = params.join('-');
67 | var parameter = URL_PARAMETER.replace('{options}',params);
68 |
69 | // Break the path apart and put back together again
70 | return src.replace(/^(.+)(\.[a-z]+)$/i, "$1"+parameter+"$2");
71 |
72 | }
73 |
74 | // Expose public methods.
75 | return {
76 | url: url
77 | };
78 | }));
79 |
--------------------------------------------------------------------------------
/public/web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # Laravel PHP Framework
2 |
3 | [](https://travis-ci.org/laravel/framework)
4 | [](https://packagist.org/packages/laravel/framework)
5 | [](https://packagist.org/packages/laravel/framework)
6 | [](https://packagist.org/packages/laravel/framework)
7 | [](https://packagist.org/packages/laravel/framework)
8 |
9 | Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as authentication, routing, sessions, queueing, and caching.
10 |
11 | Laravel is accessible, yet powerful, providing powerful tools needed for large, robust applications. A superb inversion of control container, expressive migration system, and tightly integrated unit testing support give you the tools you need to build any application with which you are tasked.
12 |
13 | ## Official Documentation
14 |
15 | Documentation for the framework can be found on the [Laravel website](http://laravel.com/docs).
16 |
17 | ## Contributing
18 |
19 | Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](http://laravel.com/docs/contributions).
20 |
21 | ## Security Vulnerabilities
22 |
23 | If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell at taylor@laravel.com. All security vulnerabilities will be promptly addressed.
24 |
25 | ## License
26 |
27 | The Laravel framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)
28 |
--------------------------------------------------------------------------------
/resources/assets/sass/app.scss:
--------------------------------------------------------------------------------
1 | // @import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap";
2 |
3 |
--------------------------------------------------------------------------------
/resources/lang/en/auth.php:
--------------------------------------------------------------------------------
1 | 'These credentials do not match our records.',
17 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
18 |
19 | ];
20 |
--------------------------------------------------------------------------------
/resources/lang/en/pagination.php:
--------------------------------------------------------------------------------
1 | '« Previous',
17 | 'next' => 'Next »',
18 |
19 | ];
20 |
--------------------------------------------------------------------------------
/resources/lang/en/passwords.php:
--------------------------------------------------------------------------------
1 | 'Passwords must be at least six characters and match the confirmation.',
17 | 'reset' => 'Your password has been reset!',
18 | 'sent' => 'We have e-mailed your password reset link!',
19 | 'token' => 'This password reset token is invalid.',
20 | 'user' => "We can't find a user with that e-mail address.",
21 |
22 | ];
23 |
--------------------------------------------------------------------------------
/resources/lang/en/validation.php:
--------------------------------------------------------------------------------
1 | 'The :attribute must be accepted.',
17 | 'active_url' => 'The :attribute is not a valid URL.',
18 | 'after' => 'The :attribute must be a date after :date.',
19 | 'alpha' => 'The :attribute may only contain letters.',
20 | 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.',
21 | 'alpha_num' => 'The :attribute may only contain letters and numbers.',
22 | 'array' => 'The :attribute must be an array.',
23 | 'before' => 'The :attribute must be a date before :date.',
24 | 'between' => [
25 | 'numeric' => 'The :attribute must be between :min and :max.',
26 | 'file' => 'The :attribute must be between :min and :max kilobytes.',
27 | 'string' => 'The :attribute must be between :min and :max characters.',
28 | 'array' => 'The :attribute must have between :min and :max items.',
29 | ],
30 | 'boolean' => 'The :attribute field must be true or false.',
31 | 'confirmed' => 'The :attribute confirmation does not match.',
32 | 'date' => 'The :attribute is not a valid date.',
33 | 'date_format' => 'The :attribute does not match the format :format.',
34 | 'different' => 'The :attribute and :other must be different.',
35 | 'digits' => 'The :attribute must be :digits digits.',
36 | 'digits_between' => 'The :attribute must be between :min and :max digits.',
37 | 'email' => 'The :attribute must be a valid email address.',
38 | 'exists' => 'The selected :attribute is invalid.',
39 | 'filled' => 'The :attribute field is required.',
40 | 'image' => 'The :attribute must be an image.',
41 | 'in' => 'The selected :attribute is invalid.',
42 | 'integer' => 'The :attribute must be an integer.',
43 | 'ip' => 'The :attribute must be a valid IP address.',
44 | 'json' => 'The :attribute must be a valid JSON string.',
45 | 'max' => [
46 | 'numeric' => 'The :attribute may not be greater than :max.',
47 | 'file' => 'The :attribute may not be greater than :max kilobytes.',
48 | 'string' => 'The :attribute may not be greater than :max characters.',
49 | 'array' => 'The :attribute may not have more than :max items.',
50 | ],
51 | 'mimes' => 'The :attribute must be a file of type: :values.',
52 | 'min' => [
53 | 'numeric' => 'The :attribute must be at least :min.',
54 | 'file' => 'The :attribute must be at least :min kilobytes.',
55 | 'string' => 'The :attribute must be at least :min characters.',
56 | 'array' => 'The :attribute must have at least :min items.',
57 | ],
58 | 'not_in' => 'The selected :attribute is invalid.',
59 | 'numeric' => 'The :attribute must be a number.',
60 | 'regex' => 'The :attribute format is invalid.',
61 | 'required' => 'The :attribute field is required.',
62 | 'required_if' => 'The :attribute field is required when :other is :value.',
63 | 'required_unless' => 'The :attribute field is required unless :other is in :values.',
64 | 'required_with' => 'The :attribute field is required when :values is present.',
65 | 'required_with_all' => 'The :attribute field is required when :values is present.',
66 | 'required_without' => 'The :attribute field is required when :values is not present.',
67 | 'required_without_all' => 'The :attribute field is required when none of :values are present.',
68 | 'same' => 'The :attribute and :other must match.',
69 | 'size' => [
70 | 'numeric' => 'The :attribute must be :size.',
71 | 'file' => 'The :attribute must be :size kilobytes.',
72 | 'string' => 'The :attribute must be :size characters.',
73 | 'array' => 'The :attribute must contain :size items.',
74 | ],
75 | 'string' => 'The :attribute must be a string.',
76 | 'timezone' => 'The :attribute must be a valid zone.',
77 | 'unique' => 'The :attribute has already been taken.',
78 | 'url' => 'The :attribute format is invalid.',
79 |
80 | /*
81 | |--------------------------------------------------------------------------
82 | | Custom Validation Language Lines
83 | |--------------------------------------------------------------------------
84 | |
85 | | Here you may specify custom validation messages for attributes using the
86 | | convention "attribute.rule" to name the lines. This makes it quick to
87 | | specify a specific custom language line for a given attribute rule.
88 | |
89 | */
90 |
91 | 'custom' => [
92 | 'attribute-name' => [
93 | 'rule-name' => 'custom-message',
94 | ],
95 | ],
96 |
97 | /*
98 | |--------------------------------------------------------------------------
99 | | Custom Validation Attributes
100 | |--------------------------------------------------------------------------
101 | |
102 | | The following language lines are used to swap attribute place-holders
103 | | with something more reader friendly such as E-Mail Address instead
104 | | of "email". This simply helps us make messages a little cleaner.
105 | |
106 | */
107 |
108 | 'attributes' => [],
109 |
110 | ];
111 |
--------------------------------------------------------------------------------
/resources/views/admin/books/_form.blade.php:
--------------------------------------------------------------------------------
1 |
2 | {!! Form::label('category_id', 'Category:') !!}
3 | {!! Form::select('category_id', $categories, null, ['class'=>'form-control']) !!}
4 |
5 |
6 |
7 | {!! Form::label('title', 'Title:') !!}
8 | {!! Form::text('title', null, ['class'=>'form-control']) !!}
9 |
10 |
11 |
12 | {!! Form::label('subtitle', 'Subtitle:') !!}
13 | {!! Form::text('subtitle', null, ['class'=>'form-control']) !!}
14 |
15 |
16 |
17 | {!! Form::label('dedication', 'Dedication:') !!}
18 | {!! Form::textarea('dedication', null, ['class'=>'form-control']) !!}
19 |
20 |
21 |
22 | {!! Form::label('description', 'Description:') !!}
23 | {!! Form::textarea('description', null, ['class'=>'form-control']) !!}
24 |
25 |
26 |
27 | {!! Form::label('website', 'Website:') !!}
28 | {!! Form::text('website', null, ['class'=>'form-control']) !!}
29 |
30 |
31 |
32 | {!! Form::label('percent_complete', 'Percent Complete:') !!}
33 | {!! Form::text('percent_complete', null, ['class'=>'form-control']) !!}
34 |
35 |
36 |
37 | {!! Form::label('price', 'Price:') !!}
38 | {!! Form::text('price', null, ['class'=>'form-control']) !!}
39 |
40 |
41 |
42 | {!! Form::label('published', 'Published:') !!}
43 | {!! Form::checkbox('published') !!}
44 |
--------------------------------------------------------------------------------
/resources/views/admin/books/cover.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
Cover of: {{$book->title}}
7 |
8 | @if(file_exists(public_path('/books/thumbs/' . $book->id . '.jpg')))
9 |

10 | @endif
11 |
12 | {!! Form::open(['route'=>['admin.books.cover.store', $book->id], 'enctype'=>'multipart/form-data']) !!}
13 |
14 |
15 | {!! Form::label('file', 'Cover:') !!}
16 | {!! Form::file('file', null, ['class'=>'form-control']) !!}
17 |
18 |
19 | {!! Form::submit('Upload', ['class'=>'btn btn-primary']) !!}
20 |
21 | {!! Form::close() !!}
22 |
23 |
Back
24 |
25 |
26 |
27 |
28 | @endsection
--------------------------------------------------------------------------------
/resources/views/admin/books/create.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
Create new Book
7 |
8 | {!! Form::open(['route'=>'admin.books.store']) !!}
9 |
10 | @include('admin.books._form')
11 |
12 | {!! Form::submit('Add book', ['class'=>'btn btn-primary']) !!}
13 |
14 | {!! Form::close() !!}
15 |
16 |
17 |
18 |
19 |
20 |
21 | @endsection
--------------------------------------------------------------------------------
/resources/views/admin/books/edit.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
Editing book: {{$book->title}}
7 |
8 | {!! Form::model($book, ['route'=>['admin.books.update', $book->id], 'method'=>'put']) !!}
9 |
10 | @include('admin.books._form')
11 |
12 | {!! Form::submit('Save book', ['class'=>'btn btn-primary']) !!}
13 |
14 | {!! Form::close() !!}
15 |
16 |
17 |
18 |
19 |
20 |
21 | @endsection
--------------------------------------------------------------------------------
/resources/views/admin/books/index.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
Books
7 |
8 |
Create
9 |
10 |
11 |
12 |
13 |
57 |
58 |
59 | @endsection
--------------------------------------------------------------------------------
/resources/views/admin/categories/_form.blade.php:
--------------------------------------------------------------------------------
1 |
2 | {!! Form::label('name', 'Name:') !!}
3 | {!! Form::text('name', null, ['class'=>'form-control']) !!}
4 |
5 |
6 |
--------------------------------------------------------------------------------
/resources/views/admin/categories/create.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
Create new Category
7 |
8 | {!! Form::open(['route'=>'admin.categories.store']) !!}
9 |
10 | @include('admin.categories._form')
11 |
12 | {!! Form::submit('Add category', ['class'=>'btn btn-primary']) !!}
13 |
14 | {!! Form::close() !!}
15 |
16 |
17 |
18 |
19 |
20 |
21 | @endsection
--------------------------------------------------------------------------------
/resources/views/admin/categories/edit.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
Editing category: {{$category->name}}
7 |
8 | {!! Form::model($category, ['route'=>['admin.categories.update', $category->id], 'method'=>'put']) !!}
9 |
10 | @include('admin.categories._form')
11 |
12 | {!! Form::submit('Save category', ['class'=>'btn btn-primary']) !!}
13 |
14 | {!! Form::close() !!}
15 |
16 |
17 |
18 |
19 |
20 |
21 | @endsection
--------------------------------------------------------------------------------
/resources/views/admin/categories/index.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
Categories
7 |
8 |
Create
9 |
10 |
11 |
12 |
13 |
14 |
15 | Name |
16 | Action |
17 |
18 |
19 | @foreach($categories as $category)
20 |
21 | {{$category->name}} |
22 |
23 |
24 |
25 | Edit
26 |
27 |
28 |
29 | Destroy
30 |
31 |
32 | |
33 |
34 | @endforeach
35 |
36 |
37 |
38 |
39 | @endsection
--------------------------------------------------------------------------------
/resources/views/admin/chapters/_form.blade.php:
--------------------------------------------------------------------------------
1 |
2 | {!! Form::label('name', 'Name:') !!}
3 | {!! Form::text('name', null, ['class'=>'form-control']) !!}
4 |
5 |
6 |
7 | {!! Form::label('content', 'Content:') !!}
8 | {!! Form::textarea('content', null, ['class'=>'form-control']) !!}
9 |
10 |
11 |
12 | {!! Form::label('order', 'Order:') !!}
13 | {!! Form::text('order', null, ['class'=>'form-control']) !!}
14 |
15 |
--------------------------------------------------------------------------------
/resources/views/admin/chapters/create.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
Create new Chapter
7 |
8 | {!! Form::open(['route'=>['admin.books.chapters.store', $book->id]]) !!}
9 |
10 | @include('admin.chapters._form')
11 |
12 | {!! Form::submit('Add chapter', ['class'=>'btn btn-primary']) !!}
13 |
14 | {!! Form::close() !!}
15 |
16 |
17 |
18 |
19 |
20 |
21 | @endsection
--------------------------------------------------------------------------------
/resources/views/admin/chapters/edit.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
Editing chapter: {{$chapter->name}}
7 |
8 | {!! Form::model($chapter, ['route'=>['admin.books.chapters.update', $book->id,'chapter_id'=>$chapter->id], 'method'=>'put']) !!}
9 |
10 | @include('admin.chapters._form')
11 |
12 | {!! Form::submit('Save chapter', ['class'=>'btn btn-primary']) !!}
13 |
14 | {!! Form::close() !!}
15 |
16 |
17 |
18 | @endsection
--------------------------------------------------------------------------------
/resources/views/admin/chapters/index.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
Chapters of: {{$book->title}}
7 |
8 |
Create
9 |
10 |
11 |
12 |
13 |
14 |
15 | Name |
16 | Action |
17 |
18 |
19 | @foreach($chapters as $chapter)
20 |
21 | {{$chapter->name}} |
22 |
23 |
24 |
25 | Edit
26 |
27 |
28 |
29 | Destroy
30 |
31 |
32 | |
33 |
34 | @endforeach
35 |
36 |
37 |
38 |
39 | @endsection
--------------------------------------------------------------------------------
/resources/views/admin/permissions/_form.blade.php:
--------------------------------------------------------------------------------
1 |
2 | {!! Form::label('name', 'Name:') !!}
3 | {!! Form::text('name', null, ['class'=>'form-control']) !!}
4 |
5 |
6 |
7 | {!! Form::label('description', 'Description:') !!}
8 | {!! Form::textarea('description', null, ['class'=>'form-control']) !!}
9 |
--------------------------------------------------------------------------------
/resources/views/admin/permissions/create.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
Create new Permission
7 |
8 | {!! Form::open(['route'=>'admin.permissions.store']) !!}
9 |
10 | @include('admin.permissions._form')
11 |
12 | {!! Form::submit('Add permission', ['class'=>'btn btn-primary']) !!}
13 |
14 | {!! Form::close() !!}
15 |
16 |
17 |
18 |
19 |
20 |
21 | @endsection
--------------------------------------------------------------------------------
/resources/views/admin/permissions/edit.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
Editing permission: {{$permission->name}}
7 |
8 | {!! Form::model($permission, ['route'=>['admin.permissions.update', $permission->id], 'method'=>'put']) !!}
9 |
10 | @include('admin.permissions._form')
11 |
12 | {!! Form::submit('Save permission', ['class'=>'btn btn-primary']) !!}
13 |
14 | {!! Form::close() !!}
15 |
16 |
17 |
18 |
19 |
20 |
21 | @endsection
--------------------------------------------------------------------------------
/resources/views/admin/permissions/index.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
Permissions
7 |
8 |
Create
9 |
10 |
11 |
12 |
13 |
14 |
15 | Name |
16 | Description |
17 | Action |
18 |
19 |
20 | @foreach($permissions as $permission)
21 |
22 | {{$permission->name}} |
23 | {{$permission->description}} |
24 |
25 |
26 |
27 | Edit
28 |
29 |
30 |
31 | Destroy
32 |
33 |
34 | |
35 |
36 | @endforeach
37 |
38 |
39 |
40 |
41 | @endsection
--------------------------------------------------------------------------------
/resources/views/admin/roles/_form.blade.php:
--------------------------------------------------------------------------------
1 |
2 | {!! Form::label('name', 'Name:') !!}
3 | {!! Form::text('name', null, ['class'=>'form-control']) !!}
4 |
5 |
6 |
7 | {!! Form::label('description', 'Description:') !!}
8 | {!! Form::textarea('description', null, ['class'=>'form-control']) !!}
9 |
--------------------------------------------------------------------------------
/resources/views/admin/roles/create.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
Create new Role
7 |
8 | {!! Form::open(['route'=>'admin.roles.store']) !!}
9 |
10 | @include('admin.roles._form')
11 |
12 | {!! Form::submit('Add role', ['class'=>'btn btn-primary']) !!}
13 |
14 | {!! Form::close() !!}
15 |
16 |
17 |
18 |
19 |
20 |
21 | @endsection
--------------------------------------------------------------------------------
/resources/views/admin/roles/edit.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
Editing role: {{$role->name}}
7 |
8 | {!! Form::model($role, ['route'=>['admin.roles.update', $role->id], 'method'=>'put']) !!}
9 |
10 | @include('admin.roles._form')
11 |
12 | {!! Form::submit('Save role', ['class'=>'btn btn-primary']) !!}
13 |
14 | {!! Form::close() !!}
15 |
16 |
17 |
18 |
19 |
20 |
21 | @endsection
--------------------------------------------------------------------------------
/resources/views/admin/roles/index.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
Roles
7 |
8 |
Create
9 |
10 |
11 |
12 |
13 |
14 |
15 | Name |
16 | Description |
17 | Action |
18 |
19 |
20 | @foreach($roles as $role)
21 |
22 | {{$role->name}} |
23 | {{$role->description}} |
24 |
25 |
26 |
27 | Edit
28 |
29 |
30 |
31 | Permissions
32 |
33 |
34 |
35 | Destroy
36 |
37 |
38 | |
39 |
40 | @endforeach
41 |
42 |
43 |
44 |
45 | @endsection
--------------------------------------------------------------------------------
/resources/views/admin/roles/permissions.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
Permissions of: {{$role->name}}
7 |
8 |
Add new permission
9 | {!! Form::open(['route'=>['admin.roles.permissions.store', $role->id]]) !!}
10 |
15 |
16 | {!! Form::submit('Add permission', ['class'=>'btn btn-primary']) !!}
17 |
18 | {!! Form::close() !!}
19 |
20 |
21 |
22 |
23 |
24 |
25 | Name |
26 | Description |
27 | Action |
28 |
29 |
30 | @foreach($role->permissions as $permission)
31 |
32 | {{$permission->name}} |
33 | {{$permission->description}} |
34 |
35 |
36 | Revoke
38 |
39 | |
40 |
41 | @endforeach
42 |
43 |
44 |
45 |
Back
46 |
47 |
48 | @endsection
--------------------------------------------------------------------------------
/resources/views/admin/users/_form.blade.php:
--------------------------------------------------------------------------------
1 |
2 | {!! Form::label('name', 'Name:') !!}
3 | {!! Form::text('name', null, ['class'=>'form-control']) !!}
4 |
5 |
6 |
7 | {!! Form::label('email', 'Email:') !!}
8 | {!! Form::text('email', null, ['class'=>'form-control']) !!}
9 |
10 |
11 |
12 | {!! Form::label('password', 'Password:') !!}
13 | {!! Form::password('password', ['class'=>'form-control']) !!}
14 |
15 |
--------------------------------------------------------------------------------
/resources/views/admin/users/create.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
Create new User
7 |
8 | {!! Form::open(['route'=>'admin.users.store']) !!}
9 |
10 | @include('admin.users._form')
11 |
12 | {!! Form::submit('Add user', ['class'=>'btn btn-primary']) !!}
13 |
14 | {!! Form::close() !!}
15 |
16 |
17 |
18 |
19 |
20 |
21 | @endsection
--------------------------------------------------------------------------------
/resources/views/admin/users/edit.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
Editing user: {{$user->name}}
7 |
8 | {!! Form::model($user, ['route'=>['admin.users.update', $user->id], 'method'=>'put']) !!}
9 |
10 | @include('admin.users._form')
11 |
12 | {!! Form::submit('Save user', ['class'=>'btn btn-primary']) !!}
13 |
14 | {!! Form::close() !!}
15 |
16 |
17 |
18 |
19 |
20 |
21 | @endsection
--------------------------------------------------------------------------------
/resources/views/admin/users/index.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
Users
7 |
8 | @can('user_add')
9 |
Create
10 | @endcan
11 |
12 |
13 |
14 |
15 |
16 | Name |
17 | Email |
18 | Action |
19 |
20 |
21 | @foreach($users as $user)
22 |
23 | {{$user->name}} |
24 | {{$user->email}} |
25 |
26 |
27 | @can('user_edit')
28 |
29 | Edit
30 |
31 | @endcan
32 |
33 | @can('user_view_roles')
34 |
35 | Roles
36 |
37 | @endcan
38 |
39 | @can('user_destroy')
40 |
41 | Destroy
42 |
43 | @endcan
44 |
45 | |
46 |
47 | @endforeach
48 |
49 |
50 |
51 |
52 | @endsection
--------------------------------------------------------------------------------
/resources/views/admin/users/roles.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
Managing Roles for the User: {{$user->name}}
7 |
8 | @can('user_add_role')
9 | {!! Form::open(['route'=>['admin.users.roles.store', $user->id]]) !!}
10 |
17 |
18 | {!! Form::submit('Add role', ['class'=>'btn btn-primary']) !!}
19 |
20 | {!! Form::close() !!}
21 | @endcan
22 |
23 |
24 |
Listing roles:
25 |
26 |
27 | Role |
28 | Description |
29 | @can('user_revoke_role')
30 | Action |
31 | @endcan
32 |
33 |
34 | @foreach($user->roles as $role)
35 |
36 | {{$role->name}} |
37 | {{$role->description}} |
38 | @can('user_revoke_role')
39 |
40 |
41 |
43 | Revoke
44 |
45 |
46 | |
47 | @endcan
48 |
49 | @endforeach
50 |
51 |
52 |
53 |
Back
54 |
55 |
56 |
57 | @endsection
58 |
--------------------------------------------------------------------------------
/resources/views/auth/emails/password.blade.php:
--------------------------------------------------------------------------------
1 | Click here to reset your password: {{ $link }}
2 |
--------------------------------------------------------------------------------
/resources/views/auth/login.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
66 | @endsection
67 |
--------------------------------------------------------------------------------
/resources/views/auth/passwords/email.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 |
4 | @section('content')
5 |
6 |
7 |
8 |
9 |
Reset Password
10 |
11 | @if (session('status'))
12 |
13 | {{ session('status') }}
14 |
15 | @endif
16 |
17 |
42 |
43 |
44 |
45 |
46 |
47 | @endsection
48 |
--------------------------------------------------------------------------------
/resources/views/auth/passwords/reset.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
7 |
8 |
Reset Password
9 |
10 |
66 |
67 |
68 |
69 |
70 | @endsection
71 |
--------------------------------------------------------------------------------
/resources/views/auth/register.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
82 | @endsection
83 |
--------------------------------------------------------------------------------
/resources/views/errors/503.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Be right back.
5 |
6 |
7 |
8 |
39 |
40 |
41 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/resources/views/home.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
7 |
8 |
Dashboard
9 |
10 |
11 | You are logged in!
12 |
13 |
14 |
15 |
16 |
17 | @endsection
18 |
--------------------------------------------------------------------------------
/resources/views/layouts/app.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | CodePub
12 |
13 |
14 |
103 |
104 | @yield('banner')
105 |
106 | @yield('menu')
107 |
108 |
109 | @yield('content')
110 |
111 |
112 |
113 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
--------------------------------------------------------------------------------
/resources/views/store/_banner.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Write a book
4 |
Make your point
5 |
6 |
Transform your ideas in professional books.
7 |
8 |
Write a book now
9 |
10 |
--------------------------------------------------------------------------------
/resources/views/store/_menu.blade.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/resources/views/store/book.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 | {{$book->title}}
7 |
8 |
9 |
}}?s=30)
10 |
{{$book->author->name}}
11 |
12 |
13 |
14 | {{$book->description}}
15 |
16 |
17 |
18 |
19 |
20 |

21 |
22 |
23 |
25 | 60% Complete
26 |
27 |
28 |
This book is {{$book->percent_complete}}% complete
29 |
30 |
31 |
32 |
33 |
51 |
52 |
53 | @endsection
54 |
--------------------------------------------------------------------------------
/resources/views/store/category.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('banner')
4 | @include('store._banner')
5 | @endsection
6 |
7 | @section('menu')
8 | @include('store._menu')
9 | @endsection
10 |
11 | @section('content')
12 |
13 |
Category:: {{$category->name}}
14 |
15 |
16 | @foreach($books as $book)
17 |
22 | @endforeach
23 |
24 |
25 | @endsection
--------------------------------------------------------------------------------
/resources/views/store/checkout.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
Checkout
7 |
8 |
Book information: {{$book->title}}
9 |
{{$book->description}}
10 |
Price: $ {{$book->price}}
11 |
12 |
13 |
25 |
26 |
27 |
28 | @endsection
--------------------------------------------------------------------------------
/resources/views/store/home.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('banner')
4 | @include('store._banner')
5 | @endsection
6 |
7 | @section('menu')
8 | @include('store._menu')
9 | @endsection
10 |
11 | @section('content')
12 |
13 |
Featured Books
14 |
15 |
16 | @foreach($books as $book)
17 |
22 | @endforeach
23 |
24 |
25 | @endsection
--------------------------------------------------------------------------------
/resources/views/store/orders.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
My Orders
7 |
8 |
9 |
10 | Order |
11 | Book |
12 | Price |
13 | Action |
14 |
15 |
16 | @foreach($orders as $order)
17 |
18 | {{$order->id}} |
19 | {{$order->book->title}} |
20 | {{$order->price}} |
21 |
22 |
23 |
24 | Download
25 |
26 |
27 | |
28 |
29 | @endforeach
30 |
31 |
32 |
33 |
34 | @endsection
--------------------------------------------------------------------------------
/resources/views/store/process.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 | @if($status)
7 |
Your order has been placed
8 |
9 | Click here to download your book.
10 |
11 | @else
12 |
Opss!
13 |
Your credit card has been declined. Try it again.
14 | @endif
15 |
16 |
17 | @endsection
--------------------------------------------------------------------------------
/resources/views/store/search.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('banner')
4 | @include('store._banner')
5 | @endsection
6 |
7 | @section('menu')
8 | @include('store._menu')
9 | @endsection
10 |
11 | @section('content')
12 |
13 |
Search results
14 |
15 |
16 | @foreach($books as $book)
17 |
22 | @endforeach
23 |
24 |
25 | @endsection
--------------------------------------------------------------------------------
/resources/views/vendor/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/resources/views/vendor/.gitkeep
--------------------------------------------------------------------------------
/resources/views/welcome.blade.php:
--------------------------------------------------------------------------------
1 | @extends('layouts.app')
2 |
3 | @section('content')
4 |
5 |
6 |
7 |
8 |
Welcome
9 |
10 |
11 | Your Application's Landing Page.
12 |
13 |
14 |
15 |
16 |
17 | @endsection
18 |
--------------------------------------------------------------------------------
/server.php:
--------------------------------------------------------------------------------
1 |
8 | */
9 |
10 | $uri = urldecode(
11 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
12 | );
13 |
14 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the
15 | // built-in PHP web server. This provides a convenient way to test a Laravel
16 | // application without having installed a "real" web server software here.
17 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
18 | return false;
19 | }
20 |
21 | require_once __DIR__.'/public/index.php';
22 |
--------------------------------------------------------------------------------
/storage/app/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
--------------------------------------------------------------------------------
/storage/books/1/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/storage/books/1/.DS_Store
--------------------------------------------------------------------------------
/storage/books/1/Contents/1.md:
--------------------------------------------------------------------------------
1 | #My Chapter
2 |
3 | ## Super chapter
4 |
5 | Olá mundo tudo bem?
6 |
7 | ## Super Ultra Laravel
--------------------------------------------------------------------------------
/storage/books/1/Contents/2.md:
--------------------------------------------------------------------------------
1 | #Super
2 |
3 | ## Super Legal
4 |
5 | O Legal é um termo muito utilizado para quem quer ser sempre legal
6 |
7 | ## Médio Legal
8 |
9 | O médio legal é legal.
10 |
11 |
--------------------------------------------------------------------------------
/storage/books/1/Contents/dedication.md:
--------------------------------------------------------------------------------
1 | Vitae reiciendis quas non porro.
--------------------------------------------------------------------------------
/storage/books/1/Output/ebook/book.epub:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/storage/books/1/Output/ebook/book.epub
--------------------------------------------------------------------------------
/storage/books/1/Output/kindle/book.mobi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/storage/books/1/Output/kindle/book.mobi
--------------------------------------------------------------------------------
/storage/books/1/Output/print/book.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/storage/books/1/Output/print/book.pdf
--------------------------------------------------------------------------------
/storage/books/1/Resources/Templates/cover.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/storage/books/1/Resources/Templates/cover.jpg
--------------------------------------------------------------------------------
/storage/books/1/Resources/Templates/ebook/cover.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/storage/books/1/Resources/Templates/ebook/cover.jpg
--------------------------------------------------------------------------------
/storage/books/1/Resources/Templates/print/cover.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeedu/laravel52-carnaval/38167d621b9e6726dea48542a5cd1e8d94976885/storage/books/1/Resources/Templates/print/cover.pdf
--------------------------------------------------------------------------------
/storage/books/1/config.yml:
--------------------------------------------------------------------------------
1 | easybook:
2 | parameters:
3 | parser.options:
4 | code_block_type: fenced
5 | book:
6 | title: 'Vero aut doloremque dolorum natus.'
7 | author: 'Author da Silva'
8 | language: en
9 | publication_date: null
10 | generator:
11 | name: CodePub
12 | version: 1
13 | contents:
14 | -
15 | element: cover
16 | -
17 | element: dedication
18 | content: dedication.md
19 | -
20 | element: toc
21 | -
22 | element: chapter
23 | number: 1
24 | content: 1.md
25 | -
26 | element: chapter
27 | number: 2
28 | content: 2.md
29 | editions:
30 | kindle:
31 | extends: ebook
32 | format: mobi
33 | ebook:
34 | format: epub
35 | include_styles: true
36 | highlight_cache: true
37 | highlight_code: false
38 | labels: [chapter, figure]
39 | theme: clean
40 | toc: { deep: 1, elements: [chapter] }
41 | print:
42 | format: pdf
43 | highlight_cache: true
44 | highlight_code: true
45 | isbn: null
46 | include_styles: true
47 | labels: [chapter, figure]
48 | margin: { top: 25mm, bottom: 25mm, inner: 30mm, outer: 20mm }
49 | page_size: A4
50 | theme: clean
51 | toc: { deep: 2, elements: [chapter] }
52 | two_sided: true
53 | web:
54 | format: html
55 | include_styles: true
56 | highlight_cache: true
57 | highlight_code: true
58 | labels: [chapter, figure]
59 | theme: clean
60 | toc: { deep: 2, elements: [chapter] }
61 | website:
62 | extends: web
63 | format: html_chunked
64 | chunk_level: 1
65 | images_base_dir: /img/doc-en/
66 | easybook-project.org:
67 | format: html_chunked
68 | chunk_level: 2
69 | images_base_dir: /images/doc-en/
70 | include_styles: false
71 | highlight_cache: false
72 | highlight_code: true
73 | labels: [chapter, figure]
74 | theme: clean
75 | toc: { deep: 2, elements: [chapter] }
76 |
--------------------------------------------------------------------------------
/storage/books/template/config.yml:
--------------------------------------------------------------------------------
1 | easybook:
2 | parameters:
3 | parser.options:
4 | code_block_type: fenced
5 |
6 | book:
7 | title: %TITLE%
8 | author: %AUTHOR%
9 | language: en
10 | publication_date: ~
11 |
12 | generator: { name: CodePub, version: 1 }
13 |
14 | contents:
15 | - { element: cover }
16 | - { element: dedication, content: dedication.md }
17 | - { element: toc }
18 |
19 | editions:
20 | kindle:
21 | extends: ebook
22 | format: mobi
23 |
24 | ebook:
25 | format: epub
26 | include_styles: true
27 | highlight_cache: true
28 | highlight_code: false
29 | labels: ['chapter', 'figure']
30 | theme: clean
31 | toc:
32 | deep: 1
33 | elements: ["chapter"]
34 |
35 | print:
36 | format: pdf
37 | highlight_cache: true
38 | highlight_code: true
39 | isbn: ~
40 | include_styles: true
41 | labels: ['chapter', 'figure']
42 | margin:
43 | top: 25mm
44 | bottom: 25mm
45 | inner: 30mm
46 | outer: 20mm
47 | page_size: A4
48 | theme: clean
49 | toc:
50 | deep: 2
51 | elements: ["chapter"]
52 | two_sided: true
53 |
54 | web:
55 | format: html
56 | include_styles: true
57 | highlight_cache: true
58 | highlight_code: true
59 | labels: ['chapter', 'figure']
60 | theme: clean
61 | toc:
62 | deep: 2
63 | elements: ["chapter"]
64 |
65 | website:
66 | extends: web
67 | format: html_chunked
68 | chunk_level: 1
69 | images_base_dir: /img/doc-en/
70 |
71 | easybook-project.org:
72 | format: html_chunked
73 | chunk_level: 2
74 | images_base_dir: /images/doc-en/
75 | include_styles: false
76 | highlight_cache: false
77 | highlight_code: true
78 | labels: ['chapter', 'figure']
79 | theme: clean
80 | toc:
81 | deep: 2
82 | elements: ["chapter"]
83 |
--------------------------------------------------------------------------------
/storage/framework/.gitignore:
--------------------------------------------------------------------------------
1 | config.php
2 | routes.php
3 | compiled.php
4 | services.json
5 | events.scanned.php
6 | routes.scanned.php
7 | down
8 |
--------------------------------------------------------------------------------
/storage/framework/cache/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
--------------------------------------------------------------------------------
/storage/framework/sessions/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/framework/views/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/logs/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/tests/ExampleTest.php:
--------------------------------------------------------------------------------
1 | visit('/')
17 | ->see('Laravel 5');
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/tests/TestCase.php:
--------------------------------------------------------------------------------
1 | make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
22 |
23 | return $app;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------