[WIP] Refactor project
This commit is contained in:
@@ -17,12 +17,28 @@ class VarietiesDataTable extends DataTable
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('photo', function(Variety $variety) {
|
||||
$media = $variety->getFirstMedia();
|
||||
dump($variety);
|
||||
return "{{ $media('thumb') }}";
|
||||
})
|
||||
->rawColumns(['photo', 'action'])
|
||||
;
|
||||
return Parent::modifier($datatables);
|
||||
}
|
||||
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('Specie.name')->data('specie_name')->title('Espèce'),
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('articles_count')->title('Nb articles')->class('text-right')->searchable(false),
|
||||
Column::make('photo')->title('')->searchable(false)->orderable(false),
|
||||
self::makeColumnButtons(),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ class CustomersDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'customers';
|
||||
|
||||
public function query(Product $model)
|
||||
public function query(Customer $model)
|
||||
{
|
||||
return self::buildQuery($model);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use Throwable;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
@@ -34,7 +34,7 @@ class Handler extends ExceptionHandler
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function report(Exception $exception)
|
||||
public function report(Throwable $exception)
|
||||
{
|
||||
parent::report($exception);
|
||||
}
|
||||
@@ -48,7 +48,7 @@ class Handler extends ExceptionHandler
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function render($request, Exception $exception)
|
||||
public function render($request, Throwable $exception)
|
||||
{
|
||||
return parent::render($request, $exception);
|
||||
}
|
||||
|
||||
@@ -2,85 +2,46 @@
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
|
||||
use App\Customer;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\Customers;
|
||||
use App\Datatables\Shop\CustomersDataTable;
|
||||
|
||||
class CustomerController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
public function index(CustomersDataTable $dataTable)
|
||||
{
|
||||
$data = [];
|
||||
return $dataTable->render('Shop.Admin.Customers.list', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
public function create()
|
||||
{
|
||||
return view('Shop.Admin.Customers.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = Customers::store($request->all());
|
||||
return redirect()->route('Shop.Admin.Customers.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Customer $customer
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Customer $customer)
|
||||
{
|
||||
//
|
||||
}
|
||||
public function show($id)
|
||||
{
|
||||
$data['customer'] = Customers::get($id);
|
||||
return view('Shop.Admin.Customers.view', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Customer $customer
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Customer $customer)
|
||||
{
|
||||
//
|
||||
}
|
||||
public function edit($id)
|
||||
{
|
||||
$data['customer'] = Customers::get($id)->toArray();
|
||||
return view('Shop.Admin.Customers.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Customer $customer
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Customer $customer)
|
||||
{
|
||||
//
|
||||
}
|
||||
public function destroy($id)
|
||||
{
|
||||
return Customers::destroy($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Customer $customer
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Customer $customer)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,85 +2,45 @@
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
|
||||
use App\Invoice;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\Invoices;
|
||||
use App\Datatables\Shop\InvoicesDataTable;
|
||||
|
||||
class InvoiceController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
public function index(InvoicesDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Shop.Admin.Invoices.list', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
public function create()
|
||||
{
|
||||
return view('Shop.Admin.Invoices.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = Invoices::store($request->all());
|
||||
return redirect()->route('Shop.Admin.Invoices.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Invoice $invoice
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Invoice $invoice)
|
||||
{
|
||||
//
|
||||
}
|
||||
public function show($id)
|
||||
{
|
||||
$data = Invoices::get($id);
|
||||
return view('Shop.Admin.Invoices.view', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Invoice $invoice
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Invoice $invoice)
|
||||
{
|
||||
//
|
||||
}
|
||||
public function edit($id)
|
||||
{
|
||||
$data['customer'] = Invoices::get($id)->toArray();
|
||||
return view('Shop.Admin.Invoices.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Invoice $invoice
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Invoice $invoice)
|
||||
{
|
||||
//
|
||||
}
|
||||
public function destroy($id)
|
||||
{
|
||||
return Invoices::destroy($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Invoice $invoice
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Invoice $invoice)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,85 +2,45 @@
|
||||
|
||||
namespace App\Http\Controllers\Shop\Admin;
|
||||
|
||||
use App\Order;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Repositories\Shop\Orders;
|
||||
use App\Datatables\Shop\OrdersDataTable;
|
||||
|
||||
class OrderController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
public function index(OrdersDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Shop.Admin.Orders.list', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
public function create()
|
||||
{
|
||||
return view('Shop.Admin.Orders.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = Orders::store($request->all());
|
||||
return redirect()->route('Shop.Admin.Orders.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Order $order
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Order $order)
|
||||
{
|
||||
//
|
||||
}
|
||||
public function show($id)
|
||||
{
|
||||
$data = Orders::get($id);
|
||||
return view('Shop.Admin.Orders.view', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Order $order
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Order $order)
|
||||
{
|
||||
//
|
||||
}
|
||||
public function edit($id)
|
||||
{
|
||||
$data['customer'] = Orders::get($id)->toArray();
|
||||
return view('Shop.Admin.Orders.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Order $order
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Order $order)
|
||||
{
|
||||
//
|
||||
}
|
||||
public function destroy($id)
|
||||
{
|
||||
return Orders::destroy($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Order $order
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Order $order)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,12 +8,11 @@ class Install
|
||||
{
|
||||
public function production(Runner $run)
|
||||
{
|
||||
return $run
|
||||
->external('composer', 'install', '--no-dev', '--prefer-dist', '--optimize-autoloader')
|
||||
$run->external('composer', 'install', '--no-dev', '--prefer-dist', '--optimize-autoloader')
|
||||
->artisan('key:generate', ['--force' => true])
|
||||
->artisan('migrate', ['--force' => true])
|
||||
->artisan('storage:link')
|
||||
// ->dispatch(new MakeCronTask)
|
||||
// ->dispatch(new MakeCronTask)
|
||||
->external('npm', 'install', '--production')
|
||||
->external('npm', 'run', 'production')
|
||||
->artisan('route:cache')
|
||||
@@ -23,8 +22,7 @@ class Install
|
||||
|
||||
public function local(Runner $run)
|
||||
{
|
||||
return $run
|
||||
->external('composer', 'install')
|
||||
$run->external('composer', 'install')
|
||||
->artisan('key:generate')
|
||||
->artisan('migrate')
|
||||
->artisan('storage:link')
|
||||
|
||||
@@ -3,8 +3,12 @@
|
||||
namespace App\Models\Botanic;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use Spatie\Image\Manipulations;
|
||||
use Spatie\MediaLibrary\Models\Media;
|
||||
use Spatie\MediaLibrary\HasMedia\HasMedia;
|
||||
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;
|
||||
|
||||
use Rinvex\Tags\Traits\Taggable;
|
||||
use Fico7489\Laravel\EloquentJoin\Traits\EloquentJoin;
|
||||
|
||||
@@ -24,4 +28,13 @@ class Variety extends Model implements HasMedia
|
||||
{
|
||||
return $this->morphMany('App\Models\Shop\Article','product');
|
||||
}
|
||||
|
||||
public function registerMediaConversions(Media $media = null)
|
||||
{
|
||||
$this->addMediaConversion('thumb')->fit(Manipulations::FIT_CROP, 32, 32);
|
||||
$this->addMediaConversion('mini')->fit(Manipulations::FIT_CROP, 96, 96);
|
||||
$this->addMediaConversion('preview')->fit(Manipulations::FIT_CROP, 160, 160);
|
||||
$this->addMediaConversion('normal')->fit(Manipulations::FIT_CROP, 480, 480);
|
||||
$this->addMediaConversion('zoom')->fit(Manipulations::FIT_CROP, 1200, 1200)->withResponsiveImages();
|
||||
}
|
||||
}
|
||||
@@ -72,7 +72,11 @@ class Article extends Model implements HasMedia
|
||||
|
||||
public function registerMediaConversions(Media $media = null)
|
||||
{
|
||||
$this->addMediaConversion('thumb')->fit(Manipulations::FIT_CROP, 150, 150);
|
||||
}
|
||||
$this->addMediaConversion('thumb')->fit(Manipulations::FIT_CROP, 32, 32);
|
||||
$this->addMediaConversion('mini')->fit(Manipulations::FIT_CROP, 96, 96);
|
||||
$this->addMediaConversion('preview')->fit(Manipulations::FIT_CROP, 160, 160);
|
||||
$this->addMediaConversion('normal')->fit(Manipulations::FIT_CROP, 480, 480);
|
||||
$this->addMediaConversion('zoom')->fit(Manipulations::FIT_CROP, 1200, 1200)->withResponsiveImages();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,20 +6,21 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Customer extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_customers';
|
||||
|
||||
public function Invoices()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Invoice');
|
||||
}
|
||||
|
||||
public function Invoices()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Invoice');
|
||||
}
|
||||
public function Orders()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Order');
|
||||
}
|
||||
|
||||
public function Orders()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Order');
|
||||
}
|
||||
|
||||
public function User()
|
||||
{
|
||||
return $this->belongsTo('App\User');
|
||||
}
|
||||
public function User()
|
||||
{
|
||||
return $this->belongsTo('App\User');
|
||||
}
|
||||
}
|
||||
@@ -15,52 +15,53 @@ use App\Exports\Botanic\FamiliesExport;
|
||||
class Families
|
||||
{
|
||||
|
||||
public static function getDatatable()
|
||||
{
|
||||
$model = Family::orderBy('name');
|
||||
return Datatables::of($model)->make(true);
|
||||
}
|
||||
public static function getDatatable()
|
||||
{
|
||||
$model = Family::orderBy('name');
|
||||
return Datatables::of($model)->make(true);
|
||||
}
|
||||
|
||||
public static function getOptions()
|
||||
{
|
||||
return Family::get()->SortBy('name')->pluck('name','id')->toArray();
|
||||
}
|
||||
public static function getOptions()
|
||||
{
|
||||
return Family::get()->SortBy('name')->pluck('name','id')->toArray();
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
return Family::orderBy('name','asc')->get();
|
||||
}
|
||||
public static function getAll()
|
||||
{
|
||||
return Family::orderBy('name','asc')->get();
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return Family::find($id);
|
||||
}
|
||||
public static function get($id)
|
||||
{
|
||||
return Family::findOrFail($id);
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$item = $id ? self::update($data) : self::create($data);
|
||||
return $item->id;
|
||||
}
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$item = $id ? self::update($data, $id) : self::create($data);
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
return Family::create($data);
|
||||
}
|
||||
public static function create($data)
|
||||
{
|
||||
return Family::create($data);
|
||||
}
|
||||
|
||||
public static function update($data)
|
||||
{
|
||||
return Family::find($id)->update($data);
|
||||
}
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = $id ? $id : $data['id'];
|
||||
return self::get($id)->update($data);
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
return Family::destroy($id);
|
||||
}
|
||||
public static function destroy($id)
|
||||
{
|
||||
return Family::destroy($id);
|
||||
}
|
||||
|
||||
public static function exportExcel()
|
||||
{
|
||||
return Excel::download(new FamiliesExport, 'families.xlsx');
|
||||
}
|
||||
public static function exportExcel()
|
||||
{
|
||||
return Excel::download(new FamiliesExport, 'families.xlsx');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,51 +15,52 @@ use App\Exports\Botanic\GenresExport;
|
||||
class Genres
|
||||
{
|
||||
|
||||
public static function getDatatable()
|
||||
{
|
||||
$model = Genre::orderBy('name');
|
||||
return Datatables::of($model)->make(true);
|
||||
}
|
||||
public static function getDatatable()
|
||||
{
|
||||
$model = Genre::orderBy('name');
|
||||
return Datatables::of($model)->make(true);
|
||||
}
|
||||
|
||||
public static function getOptions()
|
||||
{
|
||||
return Genre::get()->SortBy('name')->pluck('name','id')->toArray();
|
||||
}
|
||||
public static function getOptions()
|
||||
{
|
||||
return Genre::get()->SortBy('name')->pluck('name','id')->toArray();
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
return Genre::orderBy('name','asc')->get();
|
||||
}
|
||||
public static function getAll()
|
||||
{
|
||||
return Genre::orderBy('name','asc')->get();
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return Genre::find($id);
|
||||
}
|
||||
public static function get($id)
|
||||
{
|
||||
return Genre::find($id);
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$item = $id ? self::update($data) : self::create($data);
|
||||
return $item->id;
|
||||
}
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$item = $id ? self::update($data, $id) : self::create($data);
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
return Genre::create($data);
|
||||
}
|
||||
public static function create($data)
|
||||
{
|
||||
return Genre::create($data);
|
||||
}
|
||||
|
||||
public static function update($data)
|
||||
{
|
||||
return Genre::find($id)->update($data);
|
||||
}
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
return self::get($id)->update($data);
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
return Genre::destroy($id);
|
||||
}
|
||||
public static function destroy($id)
|
||||
{
|
||||
return Genre::destroy($id);
|
||||
}
|
||||
|
||||
public static function exportExcel()
|
||||
{
|
||||
return Excel::download(new GenresExport, 'genres.xlsx');
|
||||
}
|
||||
public static function exportExcel()
|
||||
{
|
||||
return Excel::download(new GenresExport, 'genres.xlsx');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class Media
|
||||
|
||||
public static function storeImage($model, $file)
|
||||
{
|
||||
return $model->addMedia($file)->withResponsiveImages()->toMediaCollection('images');
|
||||
return $model->addMedia($file)->toMediaCollection('images');
|
||||
}
|
||||
|
||||
public static function deleteImage($model, $index)
|
||||
|
||||
@@ -33,7 +33,7 @@ class ArticleFamilies
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$item = $id ? self::update($data) : self::create($data);
|
||||
$item = $id ? self::update($data, $id) : self::create($data);
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
@@ -42,9 +42,10 @@ class ArticleFamilies
|
||||
return ArticleFamily::create($data);
|
||||
}
|
||||
|
||||
public static function update($data)
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
return ArticleFamily::find($id)->update($data);
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
return self::get($id)->update($data);
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
|
||||
@@ -89,7 +89,7 @@ class Articles
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
return $id ? self::update($data) : self::create($data);
|
||||
return $id ? self::update($data, $id) : self::create($data);
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
|
||||
53
app/Repositories/Shop/Customers.php
Normal file
53
app/Repositories/Shop/Customers.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use App\Models\Shop\Customer;
|
||||
|
||||
class Customers
|
||||
{
|
||||
|
||||
public static function getOptions()
|
||||
{
|
||||
return Customer::orderBy('value','asc')->get()->pluck('value','id')->toArray();
|
||||
}
|
||||
|
||||
public static function getOptionsByPackage($package_id)
|
||||
{
|
||||
return Customer::byPackage($package_id)->orderBy('value','asc')->get()->pluck('value','id')->toArray();
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
return Customer::orderBy('value','asc')->get();
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return Customer::find($id);
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$item = $id ? self::update($data, $id) : self::create($data);
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
return Customer::create($data);
|
||||
}
|
||||
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
return Customer::find($id)->update($data);
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
return Customer::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
53
app/Repositories/Shop/Invoices.php
Normal file
53
app/Repositories/Shop/Invoices.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use App\Models\Shop\Invoice;
|
||||
|
||||
class Invoices
|
||||
{
|
||||
|
||||
public static function getOptions()
|
||||
{
|
||||
return Invoice::orderBy('value','asc')->get()->pluck('value','id')->toArray();
|
||||
}
|
||||
|
||||
public static function getOptionsByPackage($package_id)
|
||||
{
|
||||
return Invoice::byPackage($package_id)->orderBy('value','asc')->get()->pluck('value','id')->toArray();
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
return Invoice::orderBy('value','asc')->get();
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return Invoice::find($id);
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$item = $id ? self::update($data, $id) : self::create($data);
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
return Invoice::create($data);
|
||||
}
|
||||
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
return self::get($id)->update($data);
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
return Invoice::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
53
app/Repositories/Shop/Orders.php
Normal file
53
app/Repositories/Shop/Orders.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use App\Models\Shop\Order;
|
||||
|
||||
class Orders
|
||||
{
|
||||
|
||||
public static function getOptions()
|
||||
{
|
||||
return Order::orderBy('value','asc')->get()->pluck('value','id')->toArray();
|
||||
}
|
||||
|
||||
public static function getOptionsByPackage($package_id)
|
||||
{
|
||||
return Order::byPackage($package_id)->orderBy('value','asc')->get()->pluck('value','id')->toArray();
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
return Order::orderBy('value','asc')->get();
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return Order::findOrFail($id);
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$item = $id ? self::update($data, $id) : self::create($data);
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
return Order::create($data);
|
||||
}
|
||||
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
return self::get($id)->update($data);
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
return Order::destroy($id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,7 +30,7 @@ class Unities
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$item = $id ? self::update($data) : self::create($data);
|
||||
$item = $id ? self::update($data, $id) : self::create($data);
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
@@ -39,8 +39,9 @@ class Unities
|
||||
return Unity::create($data);
|
||||
}
|
||||
|
||||
public static function update($data)
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
return Unity::find($id)->update($data);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,7 @@ class Update
|
||||
{
|
||||
public function production(Runner $run)
|
||||
{
|
||||
return $run
|
||||
->external('composer', 'install', '--no-dev', '--prefer-dist', '--optimize-autoloader')
|
||||
$run->external('composer', 'install', '--no-dev', '--prefer-dist', '--optimize-autoloader')
|
||||
->external('npm', 'install', '--production')
|
||||
->external('npm', 'run', 'production')
|
||||
->artisan('route:cache')
|
||||
@@ -22,8 +21,7 @@ class Update
|
||||
|
||||
public function local(Runner $run)
|
||||
{
|
||||
return $run
|
||||
->external('composer', 'install')
|
||||
$run->external('composer', 'install')
|
||||
->external('npm', 'install')
|
||||
->external('npm', 'run', 'development')
|
||||
->artisan('migrate')
|
||||
|
||||
Reference in New Issue
Block a user