Skip to content

Commit

Permalink
Merge pull request #4 from SuperTapok/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
SuperTapok authored Dec 31, 2023
2 parents 634d109 + fd2d35e commit f0b321a
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 86 deletions.
84 changes: 18 additions & 66 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,18 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>

<p align="center">
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>

## About Laravel

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:

- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).

Laravel is accessible, powerful, and provides tools required for large, robust applications.

## Learning Laravel

Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.

You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.

If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 2000 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.

## Laravel Sponsors

We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).

### Premium Partners

- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Cubet Techno Labs](https://cubettech.com)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[Many](https://www.many.co.uk)**
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
- **[DevSquad](https://devsquad.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
- **[OP.GG](https://op.gg)**
- **[WebReinvent](https://webreinvent.com/?utm_source=laravel&utm_medium=github&utm_campaign=patreon-sponsors)**
- **[Lendio](https://lendio.com)**

## Contributing

Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).

## Code of Conduct

In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).

## Security Vulnerabilities

If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [[email protected]](mailto:[email protected]). All security vulnerabilities will be promptly addressed.

## License

The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
# CookiesShop
Дипломный проект, представляющий собой интернет-магазин, использующий внутреннюю валюту предприятия - "пряни".
## Используемые технологии
* PHP 8 Laravel 10;
* Bootstap5 + Blade;
* JS + HTML + CSS;
## Инструкция по установке
1. Скопировать репозиторий;
2. Добавить в корень проекта файл ```.env```, в котором указать настройки для вашей локальной системы - базу данных, локальный URL и т.д.;
3. В корне проекта в терминале вызвать ```composer install```;
4. А затем ```php artisan migrate```, ``` npm i```, ```npm run build```;
5. Для добавления статических файлов вызвать ```php artisan storage:link```;
6. И наконец ```php artisan server``` для запуска проекта на локальном сервере;
## Системные требования
1. PHP 8;
2. Composer;
3. NodeJS;
4. OpenServerPanel или другая база данных MySQL;
18 changes: 3 additions & 15 deletions app/Http/Controllers/CartController.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,34 +125,22 @@ public function pay ($employee_id, $order_id) {
$employee->save();
$order->receipt_code = substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyz'), 0, 6);

$order->save();
$order->refresh();

PDF::loadView('receipt_templates/receipt',
['order' => $order, 'products' => $grouped_products])->save('storage/receipts/receipt_'.$order->receipt_code.'.pdf');

$order->receipt_url = 'storage/receipts/receipt_'.$order->receipt_code.'.pdf';
$order->save();

return $this->successResponse([
'message' => "Заказ успешно оплачен!",
'order_id' => $order->id,
]);
}



}

// TODO: переименовать и сделать
public function getOrderPdf(Request $request)
{
$order = Order::find($request->get('order_id'));

return response()->file($order->receipt_url, [
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'inline; filename="receipt'.$order->receipt_code.'.pdf"'
]);
$products = $order->products;
$grouped_products = $this->group_products($products);

return PDF::loadView('receipt_templates/receipt', ['order' => $order, 'products' => $grouped_products])->stream();
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/TransactionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function index()
"type" => "order",
"date" => $order->paid_at,
"sum" => $order->sum,
"info" => $order->receipt_url
"info" => $order->id
];
$i++;
}
Expand Down
2 changes: 1 addition & 1 deletion resources/views/orders.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
@else
<td>{{ date('d.m.Y', strtotime($order->given_at)) }}</td>
@endif
<td><a href="{{ $order->receipt_url }}">Чек</a></td>
<td><a href="{{ route('get_order')."?order_id=".$order->id }}" target="_blank">Чек</a></td>
</tr>
@endforeach
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/transactions.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<td>{{ date('d.m.Y', strtotime($transaction['date'])) }}</td>
@if ($transaction['type'] == 'order')
<td style="color: red" >-{{ $transaction['sum'] }}</td>
<td><a href="{{ asset($transaction['info']) }}">Чек</a></td>
<td><a href="{{ route('get_order')."?order_id=".$transaction['info'] }}" target="_blank">Чек</a></td>
@else
<td style="color: green" >+{{ $transaction['sum'] }}</td>
<td>{{ $transaction['info'] }}</td>
Expand Down
3 changes: 1 addition & 2 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@

Route::get('logout', [LogoutController::class, 'perform'])->name('logout');

// TODO:
Route::get('order', [CartController::class,'getOrderPdf']);
Route::get('order', [CartController::class,'getOrderPdf'])->name('get_order');;

Route::fallback(function () {
return redirect('');
Expand Down

0 comments on commit f0b321a

Please sign in to comment.