89 lines
No EOL
2.5 KiB
PHP
Executable file
89 lines
No EOL
2.5 KiB
PHP
Executable file
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
use App\Models\PaymentMethod;
|
|
use App\Models\UserLevel;
|
|
use Request;
|
|
|
|
|
|
class PaymentMethodController extends Controller
|
|
{
|
|
|
|
public function __construct()
|
|
{
|
|
$this->middleware('admin');
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
|
|
$data = [
|
|
'values' => PaymentMethod::all(),
|
|
'trans' => array_keys(config('localization.supportedLocales')),
|
|
];
|
|
return view('admin.payment_method.index', $data);
|
|
}
|
|
|
|
public function store()
|
|
{
|
|
|
|
$data = Request::all();
|
|
if($data['id'] === "new"){
|
|
$model = PaymentMethod::create([
|
|
'name' => $data['name'],
|
|
'short' => $data['short'],
|
|
'pos' => $data['pos'],
|
|
'show_on' => isset($data['show_on']) ? $data['show_on'] : null,
|
|
'is_abo' => isset($data['is_abo']) ? $data['is_abo'] : false,
|
|
'default' => isset($data['default']) ? true : false,
|
|
'active' => isset($data['active']) ? true : false,
|
|
]);
|
|
}else{
|
|
$model = PaymentMethod::find($data['id']);
|
|
$model->name = $data['name'];
|
|
$model->short = $data['short'];
|
|
$model->pos = $data['pos'];
|
|
$model->is_abo = isset($data['is_abo']) ? true : false;
|
|
$model->show_on = isset($data['show_on']) ? $data['show_on'] : null;
|
|
$model->default = isset($data['default']) ? true : false;
|
|
$model->active = isset($data['active']) ? true : false;
|
|
$model->save();
|
|
}
|
|
|
|
/* if(!empty($data['trans'])){
|
|
$trans = [];
|
|
foreach ($data['trans'] as $lang => $value){
|
|
if($value && $value != null){
|
|
$trans[$lang] = $value;
|
|
}
|
|
}
|
|
if(count($trans)){
|
|
$model->trans_name = $trans;
|
|
$model->save();
|
|
}
|
|
}*/
|
|
|
|
\Session()->flash('alert-save', '1');
|
|
return redirect(route('admin_payment_methods'));
|
|
|
|
|
|
}
|
|
|
|
|
|
/*public function delete($id){
|
|
|
|
if(ProductAttribute::where('attribute_id', $id)->count()){
|
|
\Session()->flash('alert-error', 'Eintrag wird als Produktattribute verwendet');
|
|
return redirect(route('admin_product_attributes'));
|
|
}
|
|
|
|
$model = Attribute::findOrFail($id);
|
|
$model->delete();
|
|
\Session()->flash('alert-success', 'Eintrag gelöscht');
|
|
return redirect(route('admin_product_attributes'));
|
|
}
|
|
*/
|
|
|
|
} |