-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
94e809f
commit edbcbfd
Showing
16 changed files
with
417 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
use App\Toko_setting as Setting; | ||
function logo(){ | ||
$data = Setting::where('nama','logo')->first(); | ||
return $data->value; | ||
} | ||
function namaToko(){ | ||
$data = Setting::where('nama','nama_toko')->first(); | ||
return $data->value; | ||
} | ||
function alamat(){ | ||
$data = Setting::where('nama','alamat')->first(); | ||
return $data->value; | ||
} | ||
function email(){ | ||
$data = Setting::where('nama','email')->first(); | ||
return $data->value; | ||
} | ||
function no_hp(){ | ||
$data = Setting::where('nama','no_hp')->first(); | ||
return $data->value; | ||
} | ||
function nama_bank(){ | ||
$data = Setting::where('nama','nama_bank')->first(); | ||
return $data->value; | ||
} | ||
function nama_rekening(){ | ||
$data = Setting::where('nama','nama_rekening')->first(); | ||
return $data->value; | ||
} | ||
|
||
function no_rekening(){ | ||
$data = Setting::where('nama','no_rekening')->first(); | ||
return $data->value; | ||
} | ||
function struk_salam_hormat(){ | ||
$data = Setting::where('nama','struk_salam_hormat')->first(); | ||
return $data->value; | ||
} | ||
function website(){ | ||
$data = Setting::where('nama','website')->first(); | ||
return $data->value; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Http\Request; | ||
use App\Toko_setting; | ||
class SettingController extends Controller | ||
{ | ||
public function index(){ | ||
$data = [ | ||
'website'=>website(), | ||
'logo'=>logo(), | ||
'nama_toko'=>namaToko(), | ||
'alamat'=>alamat(), | ||
'email'=>email(), | ||
'no_hp'=>no_hp(), | ||
'nama_bank'=>nama_bank(), | ||
'no_rekening'=>no_rekening(), | ||
'nama_rekening'=>nama_rekening(), | ||
'struk_salam_hormat'=>struk_salam_hormat() | ||
]; | ||
return view('pages.setting.index',compact('data')); | ||
} | ||
public function update(Request $request){ | ||
$request->validate([ | ||
'logo'=>[ | ||
'required','mimes:png,jpg,jpeg','max:10000' | ||
], | ||
'website'=>'requred|min:4', | ||
'nama_toko' =>'required|min:2', | ||
'alamat'=>'required|min:3', | ||
'email'=>'required|email', | ||
'no_hp'=>'required|min:7', | ||
'nama_bank'=>'required|min:2', | ||
'nama_rekening'=>'required|min:3', | ||
'no_rekening'=>'required|min:3', | ||
'struk_salam_hormat'=>'required|min:4' | ||
]); | ||
$logo = $request->file('logo'); | ||
$newName = rand() . '.' . $logo->getClientOriginalExtension(); | ||
Toko_setting::setLogo($newName); | ||
$logo->move(public_path('asset_toko'),$newName); | ||
Toko_setting::setWebsite($request->website); | ||
Toko_setting::setNamaToko($request->nama_toko); | ||
Toko_setting::setAlamat($request->alamat); | ||
Toko_setting::setEmail($request->email); | ||
Toko_setting::setNoHP($request->no_hp); | ||
Toko_setting::setNamaBank($request->nama_bank); | ||
Toko_setting::setNamaRekening($request->nama_rekening); | ||
Toko_setting::setNoRekening($request->no_rekening); | ||
Toko_setting::setSalamHormat($request->struk_salam_hormat); | ||
session()->flash('message', 'Pengaturan toko berhasil diperbarui'); | ||
return redirect()->back()->with('status', 'success'); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Toko_setting extends Model | ||
{ | ||
protected $table ='toko_settings'; | ||
public static function setWebsite($param){ | ||
$data = Toko_setting::where('nama','website')->first(); | ||
$data->value = $param; | ||
$data->update(); | ||
} | ||
public static function setLogo($param){ | ||
$data = Toko_setting::where('nama','logo')->first(); | ||
$data->value = $param; | ||
$data->update(); | ||
} | ||
public static function setNamaToko($param){ | ||
$data = Toko_setting::where('nama','nama_toko')->first(); | ||
$data->value = $param; | ||
$data->update(); | ||
} | ||
public static function setAlamat($param){ | ||
$data = Toko_setting::where('nama','alamat')->first(); | ||
$data->value = $param; | ||
$data->update(); | ||
} | ||
public static function setEmail($param){ | ||
$data = Toko_setting::where('nama','email')->first(); | ||
$data->value = $param; | ||
$data->update(); | ||
} | ||
public static function setNoHP($param){ | ||
$data = Toko_setting::where('nama','no_hp')->first(); | ||
$data->value = $param; | ||
$data->update(); | ||
} | ||
public static function setNamaBank($param){ | ||
$data = Toko_setting::where('nama','nama_bank')->first(); | ||
$data->value = $param; | ||
$data->update(); | ||
} | ||
public static function setNoRekening($param){ | ||
$data = Toko_setting::where('nama','no_rekening')->first(); | ||
$data->value = $param; | ||
$data->update(); | ||
} | ||
public static function setNamaRekening($param){ | ||
$data = Toko_setting::where('nama','nama_rekening')->first(); | ||
$data->value = $param; | ||
$data->update(); | ||
} | ||
public static function setSalamHormat($param){ | ||
$data = Toko_setting::where('nama','struk_salam_hormat')->first(); | ||
$data->value = $param; | ||
$data->update(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
database/migrations/2020_05_27_091528_create_toko_settings_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Support\Facades\DB; | ||
use App\Toko_setting; | ||
|
||
class CreateTokoSettingsTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('toko_settings', function (Blueprint $table) { | ||
$table->id(); | ||
$table->string('nama'); | ||
$table->text('value')->nullable(); | ||
$table->timestamps(); | ||
}); | ||
$data = [ | ||
[ | ||
'nama'=>'logo', | ||
'value'=>'favicon.png' | ||
], | ||
[ | ||
'nama' => 'nama_toko', | ||
'value'=>'CV. Multisolusindo' | ||
], | ||
[ | ||
'nama' => 'alamat', | ||
'value'=>' Jl. Kelet Ploso No. 10 Desa Kelet RT 02/RW 01 Kecamatan Keling Kabupaten Jepara.' | ||
], | ||
[ | ||
'nama' => 'email', | ||
'value'=>'[email protected]' | ||
], | ||
[ | ||
'nama' => 'no_hp', | ||
'value'=>'082327104448' | ||
], | ||
[ | ||
'nama' => 'nama_bank', | ||
'value'=>'BRI' | ||
], | ||
[ | ||
'nama' => 'nama_rekening', | ||
'value'=>'CV MULTI SOLUSINDO' | ||
], | ||
[ | ||
'nama' => 'no_rekening', | ||
'value'=>'0022-01-001022-56-8' | ||
], | ||
[ | ||
'nama' => 'struk_salam_hormat', | ||
'value'=>' A. Mukhlisin Kholiful A.' | ||
], | ||
[ | ||
'nama' => 'website', | ||
'value'=>'http://multisolusindo.co.id' | ||
], | ||
]; | ||
Toko_setting::insert($data); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('toko_settings'); | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,18 +28,18 @@ | |
</div> | ||
<div class="col-md-8"> | ||
<address> | ||
<strong class="text-danger">CV. MULTISOLUSINDO</strong><br /> | ||
<strong class="text-danger">{{namaToko()}}</strong><br /> | ||
<p style="color: blue;">Solution For Ordinary People</p> | ||
</address> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="col-md-6"> | ||
<address class="float-right" style="font-family: sans-serif;"> | ||
Jl.Kelet Ploso No. 10 Kelet Keling Jepara <br /> | ||
Email : [email protected] <br /> | ||
Website : www.multisolusindo.com <br /> | ||
Contact Person : 082327104448 | ||
{{alamat()}} | ||
Email :{{email()}} <br /> | ||
Website : {{website()}} <br /> | ||
Contact Person : {{no_hp()}} | ||
</address> | ||
</div> | ||
</div> | ||
|
@@ -165,7 +165,7 @@ | |
</td> | ||
<td>:</td> | ||
<td> | ||
<h6>CV MULTI SOLUSINDO</h6> | ||
<h6>{{nama_rekening()}}</h6> | ||
</td> | ||
</tr> | ||
<tr> | ||
|
@@ -174,7 +174,7 @@ | |
</td> | ||
<td>:</td> | ||
<td> | ||
<h6>0022-01-001022-56-8</h6> | ||
<h6>{{no_rekening()}}</h6> | ||
</td> | ||
</tr> | ||
<tr> | ||
|
@@ -183,7 +183,7 @@ | |
</td> | ||
<td>:</td> | ||
<td> | ||
<h6>BRI</h6> | ||
<h6>{{nama_bank()}}</h6> | ||
</td> | ||
</tr> | ||
</table> | ||
|
@@ -196,7 +196,7 @@ | |
<div class="col-md-4"> | ||
<h6>Best Regards</h6> | ||
<p class="mt-5" style="font-weight: bold;"> | ||
A. Mukhlisin Kholiful A. | ||
{{struk_salam_hormat()}} | ||
</p> | ||
</div> | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
<div style="padding-bottom:5px;margin-bottom:5px"> | ||
<img src="{{ asset('favicon.png') }}" alt="Logo" width="32px;"> | ||
<b style="font-size:16px; margin-bottom:10px;">CV. Multisolusindo</b> | ||
<img src="{{ asset('asset_toko') }}/{{logo()}}" alt="Logo" width="32px;"> | ||
<b style="font-size:16px; margin-bottom:10px;">{{namaToko()}}</b> | ||
<br> | ||
Jl. Kelet Ploso No. 10 Desa Kelet RT 02/RW 01 Kecamatan Keling Kabupaten Jepara. | ||
{{alamat()}} | ||
<br> | ||
[email protected] | ||
{{email()}} | ||
<br> | ||
082327104448 | ||
{{no_hp()}} | ||
</div> |
Oops, something went wrong.