parent
f03862b523
commit
1a43060996
42 changed files with 1160 additions and 83 deletions
|
|
@ -35,7 +35,7 @@ class AdminUserController extends Controller
|
|||
//'values' => User::where('admin', 0)->get(),
|
||||
'values' => User::where('confirmation_code_remider', '!=', 2)->get(),
|
||||
];
|
||||
return view('admin.users', $data);
|
||||
return view('admin.user.index', $data);
|
||||
}
|
||||
|
||||
public function edit($user_id)
|
||||
|
|
@ -48,7 +48,7 @@ class AdminUserController extends Controller
|
|||
$data = [
|
||||
'user' => $user,
|
||||
];
|
||||
return view('admin.user_edit', $data);
|
||||
return view('admin.user.edit', $data);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
77
app/Http/Controllers/CountryController.php
Executable file
77
app/Http/Controllers/CountryController.php
Executable file
|
|
@ -0,0 +1,77 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
|
||||
|
||||
use App\Models\Country;
|
||||
use Input;
|
||||
|
||||
|
||||
class CountryController extends Controller
|
||||
{
|
||||
protected $userRepo;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data = [
|
||||
'values' => Country::all(),
|
||||
];
|
||||
return view('admin.country.index', $data);
|
||||
}
|
||||
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
if($id === "new"){
|
||||
$model = new Country();
|
||||
$model->active = true;
|
||||
}else{
|
||||
$model = Country::findOrFail($id);
|
||||
}
|
||||
$data = [
|
||||
'country' => $model,
|
||||
'trans' => array_keys(config('localization.supportedLocales')),
|
||||
|
||||
];
|
||||
return view('admin.country.edit', $data);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
|
||||
$data = Input::all();
|
||||
if(!isset($data['attr'])){
|
||||
$data['attr'] = [];
|
||||
}
|
||||
if($data['id'] === "new"){
|
||||
$model = Country::create([
|
||||
/* 'parent_id' => null,
|
||||
'name' => $data['name'],
|
||||
'pos' => $data['pos'],
|
||||
'active' => isset($data['active']) ? true : false,
|
||||
*/
|
||||
]);
|
||||
}else{
|
||||
$model = Country::find($data['id']);
|
||||
$model->fill($data);
|
||||
$model->save();
|
||||
}
|
||||
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('admin_country_edit', $model->id));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ class LeadController extends Controller
|
|||
$data = [
|
||||
'values' => User::where('admin', '=', 0)->where('confirmation_code_remider', '!=', 2)->get(),
|
||||
];
|
||||
return view('admin.leads', $data);
|
||||
return view('admin.lead.index', $data);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ class LeadController extends Controller
|
|||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
if($id == "new"){
|
||||
if($id === "new"){
|
||||
$user = new User();
|
||||
$user->account = new UserAccount();
|
||||
$user->account->same_as_billing = 1;
|
||||
|
|
@ -61,7 +61,7 @@ class LeadController extends Controller
|
|||
'user' => $user,
|
||||
'can_change_mail' => true,
|
||||
];
|
||||
return view('admin.lead_edit', $data);
|
||||
return view('admin.lead.edit', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -72,7 +72,7 @@ class LeadController extends Controller
|
|||
{
|
||||
|
||||
$data = Input::all();
|
||||
if ($data['user_id'] == "new" || $data['user_id'] == 0) {
|
||||
if ($data['user_id'] === "new" || $data['user_id'] == 0) {
|
||||
$rules = array(
|
||||
'salutation' => 'required',
|
||||
'first_name'=>'required',
|
||||
|
|
@ -108,7 +108,7 @@ class LeadController extends Controller
|
|||
$validator = Validator::make(Input::all(), $rules);
|
||||
if ($validator->fails()) {
|
||||
|
||||
if ($data['user_id'] == "new" || $data['user_id'] == 0) {
|
||||
if ($data['user_id'] === "new" || $data['user_id'] == 0) {
|
||||
$user_id = "new";
|
||||
}else{
|
||||
$user = User::findOrFail($data['user_id']);
|
||||
|
|
@ -117,7 +117,7 @@ class LeadController extends Controller
|
|||
return redirect(route('admin_lead_edit', [$user_id]))->withErrors($validator)->withInput(Input::all());
|
||||
}else{
|
||||
|
||||
if ($data['user_id'] == "new" || $data['user_id'] == 0) {
|
||||
if ($data['user_id'] === "new" || $data['user_id'] == 0) {
|
||||
$user = new User();
|
||||
$user->id = "new";
|
||||
$user->account = new UserAccount();
|
||||
|
|
@ -129,8 +129,12 @@ class LeadController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
$user->m_level = isset($data['m_level']) ? $data['m_level'] : NULL;
|
||||
$user->save();
|
||||
|
||||
$this->userRepo->update($data);
|
||||
|
||||
|
||||
if(isset($data['contact_verify'])){
|
||||
|
||||
$user = $this->userRepo->getModel();
|
||||
|
|
@ -150,10 +154,13 @@ class LeadController extends Controller
|
|||
|
||||
|
||||
Mail::to($user->email)->send(new MailVerifyContact($confirmation_code, $user));
|
||||
|
||||
\Session()->flash('alert-save', true);
|
||||
return redirect(route('admin_leads'));
|
||||
}
|
||||
|
||||
\Session()->flash('alert-save', true);
|
||||
return redirect(route('admin_leads'));
|
||||
return redirect(route('admin_lead_edit', [$user->id]));
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class ProductController extends Controller
|
|||
public function index()
|
||||
{
|
||||
$data = [
|
||||
'values' => Product::all(),
|
||||
'values' => Product::orderBy('pos', 'DESC')->orderBy('id', 'DESC')->get(),
|
||||
];
|
||||
return view('admin.product.index', $data);
|
||||
}
|
||||
|
|
@ -78,6 +78,17 @@ class ProductController extends Controller
|
|||
|
||||
}
|
||||
|
||||
public function copy($id){
|
||||
$model = Product::findOrFail($id);
|
||||
|
||||
$product = $this->productRepo->copy($model);
|
||||
|
||||
|
||||
|
||||
\Session()->flash('alert-success', 'Eintrag kopiert');
|
||||
return redirect(route('admin_product_show'));
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
$model = Product::findOrFail($id);
|
||||
$model->delete();
|
||||
|
|
|
|||
84
app/Http/Controllers/UserLevelController.php
Executable file
84
app/Http/Controllers/UserLevelController.php
Executable file
|
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
|
||||
use App\Models\Attribute;
|
||||
use App\Models\ProductAttribute;
|
||||
use App\Models\UserLevel;
|
||||
use Input;
|
||||
|
||||
|
||||
class UserLevelController extends Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$data = [
|
||||
'values' => UserLevel::all(),
|
||||
'trans' => array_keys(config('localization.supportedLocales')),
|
||||
];
|
||||
return view('admin.level.index', $data);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
|
||||
$data = Input::all();
|
||||
if($data['id'] == "new"){
|
||||
$model = UserLevel::create([
|
||||
'name' => $data['name'],
|
||||
'pos' => $data['pos'],
|
||||
'margin' => $data['margin'],
|
||||
'active' => isset($data['active']) ? true : false,
|
||||
]);
|
||||
}else{
|
||||
$model = UserLevel::find($data['id']);
|
||||
$model->name = $data['name'];
|
||||
$model->pos = $data['pos'];
|
||||
$model->margin = $data['margin'];
|
||||
$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_levels'));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*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'));
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue