本文整理汇总了PHP中app\Setting::first方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::first方法的具体用法?PHP Setting::first怎么用?PHP Setting::first使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Setting
的用法示例。
在下文中一共展示了Setting::first方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index(General $general)
{
$theme = $general->theme();
$settings = Setting::first();
$languages = ['1' => 'Georgian', '2' => 'English', '3' => 'Russian'];
$modes = ['1' => 'Up', '2' => 'Down'];
$theme['title'] = 'Settings';
$theme['description'] = 'here you set website settings';
$button_text = "Update Settings";
return view('admin.settings.index', compact('theme', 'settings', 'languages', 'modes', 'button_text'));
}
示例2: saveOpenOrder
public function saveOpenOrder(Request $request)
{
$validator = Validator::make($request->all(), ['tanggal' => 'required|date', 'places' => 'required', 'karyawan_id' => 'required|exists:karyawans,id'], ['tanggal.required' => 'Tanggal tidak boleh kosong.', 'tanggal.date' => 'Input harus tanggal.', 'places.required' => 'Tempat tidak boleh kosong', 'karyawan_id.required' => 'Karyawan tidak boleh kosong.', 'karyawan_id.exists' => 'Karyawan tidak terdaftar.']);
if ($validator->fails()) {
return redirect()->back()->withErrors($validator)->withInput();
}
$data_order_detail = $request->session()->has('data_order') ? $request->session()->get('data_order') : [];
if (!count($data_order_detail)) {
return redirect()->back()->withErrors(['no_details' => 'Tidak ada produk yang dipesan.'])->withInput();
}
# Create Nota
$setting = Setting::first();
// Get Last Order
$tanggal = $request->get('tanggal');
$lastOrder = Order::where('tanggal', $tanggal)->get()->count();
$nota = $setting->init_kode . "-" . str_replace('-', '', date('dmY', strtotime($tanggal))) . ($lastOrder + 1);
// Order
$karyawan_id = $request->get('karyawan_id') ? $request->get('karyawan_id') : (Auth::check() ? Auth::user()->karyawan()->id : '1');
$order = $request->only(['tanggal']) + ['nota' => $nota, 'state' => 'On Going', 'karyawan_id' => $karyawan_id];
$order = Order::create($order);
// Order Place
$places = explode(',', $request->get('places'));
$places = Place::whereIn('id', $places)->get();
$orderPlaces = [];
foreach ($places as $place) {
$placeType = $place->kategori_id;
// For Redirect
array_push($orderPlaces, ['order_id' => $order->id, 'place_id' => $place->id, 'harga' => $place->harga]);
}
OrderPlace::insert($orderPlaces);
// Order Detail & Order Detail Bahan
$produks = Produk::with(['detail' => function ($query) {
$query->join('bahans', 'produk_details.bahan_id', '=', 'bahans.id');
}])->whereIn('id', array_keys($data_order_detail))->get();
$orderDetailBahan = [];
foreach ($produks as $produk) {
$id = $produk->id;
// Order Detail
$orderDetail = ['order_id' => $order->id, 'produk_id' => $produk->id, 'hpp' => CountHpp($produk), 'harga_jual' => $data_order_detail[$id]['harga'], 'qty' => $data_order_detail[$id]['qty'], 'use_mark_up' => $produk->use_mark_up, 'mark_up' => $produk->mark_up, 'note' => $data_order_detail[$id]['note']];
//echo "<pre>", print_r($orderDetail), "</pre>";
$orderDetail = OrderDetail::create($orderDetail);
if ($produk->detail->count()) {
// Order Detail Bahan
foreach ($produk->detail as $pd) {
array_push($orderDetailBahan, ['order_detail_id' => $orderDetail->id, 'bahan_id' => $pd->bahan_id, 'harga' => $pd->harga, 'qty' => $pd->qty, 'satuan' => $pd->satuan]);
}
}
}
OrderDetailBahan::insert($orderDetailBahan);
$request->session()->forget('data_order');
Artisan::call('bahan:count');
Artisan::call('produk:count');
return redirect('/order?tgl=' . $tanggal . '&type=' . $placeType)->with('succcess', 'Sukses simpan data order.');
}
示例3: saveAppReset
public function saveAppReset(Request $request)
{
$tables = $request->get('tables') ? $request->get('tables') : [];
// Transaksi
DB::table('orders')->truncate();
DB::table('order_taxes')->truncate();
DB::table('order_places')->truncate();
DB::table('order_merges')->truncate();
DB::table('order_details')->truncate();
DB::table('order_detail_returns')->truncate();
DB::table('order_detail_bahans')->truncate();
DB::table('order_cancels')->truncate();
DB::table('order_bayars')->truncate();
DB::table('order_bayar_banks')->truncate();
// Pembelian
DB::table('pembelians')->truncate();
DB::table('pembelian_details')->truncate();
DB::table('pembelian_bayars')->truncate();
// Adjustment
DB::table('adjustments')->truncate();
DB::table('adjustment_details')->truncate();
// Average Price Notes
DB::table('average_price_actions')->truncate();
if (in_array("accounts", $tables)) {
DB::table('accounts')->whereNotIn('id', [1, 2, 3, 4, 5])->delete();
DB::table('account_report')->whereNotIn('account_id', [1, 2, 3, 4, 5])->delete();
DB::table('account_saldos')->truncate();
}
if (in_array("bahans", $tables)) {
DB::table('bahans')->truncate();
}
if (in_array("banks", $tables)) {
DB::table('banks')->truncate();
DB::table('bank_taxes')->truncate();
}
if (in_array("customers", $tables)) {
DB::table('customers')->truncate();
}
if (in_array("karyawans", $tables)) {
DB::table('karyawans')->whereNotIn('id', [1])->delete();
}
if (in_array("place_kategoris", $tables)) {
DB::table('place_kategoris')->truncate();
}
if (in_array("places", $tables)) {
DB::table('places')->truncate();
}
if (in_array("produk_kategoris", $tables)) {
DB::table('produk_kategoris')->truncate();
}
if (in_array("produks", $tables)) {
DB::table('produks')->truncate();
DB::table('produk_details')->truncate();
}
if (in_array("settings", $tables)) {
Setting::first()->update(['title_faktur' => '', 'alamat_faktur' => '', 'telp_faktur' => '', 'init_kode' => '', 'laba_procentage_warning' => 0, 'service_cost' => 0]);
}
if (in_array("suppliers", $tables)) {
DB::table('suppliers')->truncate();
}
if (in_array("taxes", $tables)) {
DB::table('taxes')->truncate();
}
if (in_array("users", $tables)) {
DB::table('users')->whereNotIn('id', [3])->delete();
}
return redirect()->back()->with('succcess', 'Sukses reset aplikasi.');
}
示例4: settingsSave
public function settingsSave(Request $request)
{
$s = Setting::first();
if (!$s) {
$s = new Setting();
}
$s->fill($request->all());
$s->save();
return redirect('/dashboard/settings');
}
示例5: setting
function setting()
{
return \App\Setting::first();
}
示例6: setting
public function setting()
{
return Setting::first();
}
示例7: function
Route::post('sliders/updateslider/', 'SliderController@UpdateSlider');
Route::resource('sliders', 'SliderController');
Route::resource('images', 'ImageController');
});
Route::group(array('middleware' => 'auth'), function () {
Route::controller('filemanager', 'FilemanagerLaravelController');
});
Route::get('/rest/contents', function () {
return \App\Content::paginate();
});
Route::group(['prefix' => 'rest/admin', 'namespace' => 'Admin', 'middleware' => 'auth'], function () {
Route::post('/contents', ['uses' => 'ContentController@Json']);
Route::post('/contents/translate', ['uses' => 'ContentController@Translate']);
Route::post('/menus', ['uses' => 'MenuController@Json']);
Route::post('/menus/translate', ['uses' => 'MenuController@Translate']);
Route::post('/categories', ['uses' => 'CategoryController@Json']);
Route::post('/categories/translate', ['uses' => 'CategoryController@Translate']);
Route::post('/users', ['uses' => 'UserController@Json']);
Route::post('/sliders/translate', ['uses' => 'SliderController@Translate']);
Route::post('/sliders', ['uses' => 'SliderController@Json']);
});
View::composer(['includes.header', 'includes.footer', 'app', 'home', 'includes.responsive'], function ($view) {
$menus = \App\Menu::where('status', 1)->whereNull('deleted_at')->where('position', 1)->get();
$view->with(['menus' => $menus, 'settings' => \App\Setting::first()]);
});
Route::resource('emails', 'MailController');
/*Route::post('/sendemail',function(){
Mail::send('admin.users.change_password_user', ['user' => Auth::user()], function($message) {
$message->to('darapenhchet@gmail.com', 'DARA PENHCHET')->subject('GREEN ARCHITECURE AND DESIGN.');
});
});*/
示例8: info
public function info()
{
$settings = Setting::first();
$books = Book::get();
return view('front.info', ['books' => $books, 'settings' => $settings, 'cleanEmail' => Self::hide_email($settings->email)]);
}
示例9: showArticle
public function showArticle($id)
{
$article = Blog::whereId($id)->first();
$setting = Setting::first();
return view('sites.showArticle', compact('article', 'setting'));
}