Changed SITE_SETUP to SITE, using ->address instead of ->address(), added email_log, is now in views
This commit is contained in:
@@ -5,7 +5,7 @@ namespace App\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
use App\Models\{Service,SiteDetails};
|
||||
use App\Models\{Service,SiteDetail};
|
||||
|
||||
class AdminController extends Controller
|
||||
{
|
||||
@@ -39,9 +39,10 @@ class AdminController extends Controller
|
||||
'social' => 'nullable|array',
|
||||
'top_menu' => 'nullable|array',
|
||||
'site_logo' => 'nullable|image',
|
||||
'email_logo' => 'nullable|image',
|
||||
]);
|
||||
|
||||
$so = config('SITE_SETUP');
|
||||
$site = config('SITE');
|
||||
|
||||
// @todo - not currently rendered in the home page
|
||||
$validated['social'] = [];
|
||||
@@ -50,9 +51,9 @@ class AdminController extends Controller
|
||||
// Handle the images
|
||||
foreach(['site_logo','email_logo'] as $key)
|
||||
if (array_key_exists($key,$validated))
|
||||
$validated[$key] = ($x=$validated[$key])->storeAs('site/'.config('SITE_SETUP')->site_id,$x->getClientOriginalName(),'public');
|
||||
$validated[$key] = ($x=$validated[$key])->storeAs('site/'.$site->site_id,$x->getClientOriginalName(),'public');
|
||||
|
||||
foreach ($so->details as $oo)
|
||||
foreach ($site->details as $oo)
|
||||
if (array_key_exists($oo->key,$validated)) {
|
||||
$oo->value = Arr::get($validated,$oo->key);
|
||||
$oo->save();
|
||||
@@ -62,11 +63,11 @@ class AdminController extends Controller
|
||||
|
||||
// Left over values to be created.
|
||||
foreach ($validated as $k=>$v) {
|
||||
$oo = new SiteDetails;
|
||||
$oo = new SiteDetail;
|
||||
$oo->key = $k;
|
||||
$oo->value = $v ?: '';
|
||||
|
||||
$so->details()->save($oo);
|
||||
$site->details()->save($oo);
|
||||
}
|
||||
|
||||
return redirect()->back()
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests;
|
||||
use Image;
|
||||
|
||||
class MediaController extends Controller
|
||||
@@ -10,8 +9,9 @@ class MediaController extends Controller
|
||||
/**
|
||||
* Create a generic image
|
||||
*
|
||||
* @param $width
|
||||
* @param $height
|
||||
* @param $width
|
||||
* @param $height
|
||||
* @param string $color
|
||||
* @return mixed
|
||||
*/
|
||||
public function image($width,$height,$color='#ccc') {
|
||||
|
@@ -71,11 +71,11 @@ class OrderController extends Controller
|
||||
if (! $uo->exists)
|
||||
{
|
||||
// @todo Make this automatic
|
||||
$uo->site_id = config('SITE_SETUP')->id;
|
||||
$uo->site_id = config('SITE')->id;
|
||||
$uo->active = FALSE;
|
||||
$uo->firstname = '';
|
||||
$uo->lastname = '';
|
||||
$uo->country_id = config('SITE_SETUP')->country_id; // @todo This might be wrong
|
||||
$uo->country_id = config('SITE')->country_id; // @todo This might be wrong
|
||||
$uo->parent_id = Auth::id() ?: 1; // @todo This should be configured to a default user
|
||||
$uo->active = 1;
|
||||
$uo->save();
|
||||
@@ -88,10 +88,10 @@ class OrderController extends Controller
|
||||
$ao = new Account;
|
||||
//$ao->id = Account::NextId();
|
||||
// @todo Make this automatic
|
||||
$ao->site_id = config('SITE_SETUP')->id;
|
||||
$ao->country_id = config('SITE_SETUP')->country_id; // @todo This might be wrong
|
||||
$ao->language_id = config('SITE_SETUP')->language_id; // @todo This might be wrong
|
||||
$ao->currency_id = config('SITE_SETUP')->currency_id; // @todo This might be wrong
|
||||
$ao->site_id = config('SITE')->id;
|
||||
$ao->country_id = config('SITE')->country_id; // @todo This might be wrong
|
||||
$ao->language_id = config('SITE')->language_id; // @todo This might be wrong
|
||||
$ao->currency_id = config('SITE')->currency_id; // @todo This might be wrong
|
||||
$ao->active = 1;
|
||||
$uo->accounts()->save($ao);
|
||||
|
||||
@@ -102,7 +102,7 @@ class OrderController extends Controller
|
||||
$so = new Service;
|
||||
|
||||
// @todo Make this automatic
|
||||
$so->site_id = config('SITE_SETUP')->id;
|
||||
$so->site_id = config('SITE')->id;
|
||||
$so->product_id = $request->input('product_id');
|
||||
$so->order_status = 'ORDER-SUBMIT';
|
||||
$so->orderby_id = Auth::id();
|
||||
|
Reference in New Issue
Block a user