本文整理汇总了PHP中app\Customer::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::orderBy方法的具体用法?PHP Customer::orderBy怎么用?PHP Customer::orderBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Customer
的用法示例。
在下文中一共展示了Customer::orderBy方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$suppliers = Supplier::orderBy('name')->get();
$employees = Employee::orderBy('firstname')->get();
$customers = Customer::orderBy('name')->get();
return view('inventory.home', compact(['suppliers', 'employees', 'customers']));
}
示例2: customers
public function customers()
{
$search = \Input::get('q');
if ($search) {
$customers = \App\Customer::where('firstname', 'like', $search . '%')->orWhere('lastname', 'like', $search . '%')->orderBy('created_at', 'desc')->paginate($this->limit);
} else {
$customers = \App\Customer::orderBy('created_at', 'desc')->paginate($this->limit);
}
return view('admin.pages.customers', compact('customers'));
}
示例3: create
public function create()
{
$input = Input::all();
$customer = null;
if ($input != null) {
$customer = Customer::firstOrNew(['name' => $input['order_by']]);
$customer->address = $input['address'];
$customer->save();
}
$employees = Employee::orderBy('firstname')->get();
$customers = Customer::orderBy('name')->get();
return view('order.create', compact(['employees', 'input', 'customer', 'customers']));
}
示例4: rent
public function rent(Request $request)
{
$data = $request->all();
// If the movie isn't in any kiosk then provide the message and return to listing
if (!($kiosks = $this->getKiosks($data))) {
$this->setMessage('Sorry, this movie is currently not available in that format. Try again later', 'error');
return redirect('/');
}
// Get customer list
$customers = Customer::orderBy('lastname')->orderBy('firstname')->get(['id', 'firstname', 'lastname'])->toArray();
// dd($customers);
return view('movies.rent')->with('movie_id', $data['movie_id'])->with('customers', $customers)->with('kiosks', $kiosks);
}
示例5: store
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(CustomerRequest $request)
{
try {
Customer::create($request->all());
$customer = Customer::orderBy('created_at', 'desc')->first();
$items = Item::all();
foreach ($items as $item) {
Price::create(['item_id' => $item->id, 'customer_id' => $customer->id, 'custom_price' => $item->price, 'sellable' => '1']);
}
return redirect('customer')->with('message', 'Data berhasil dibuat!');
} catch (\Illuminate\Database\QueryException $e) {
return redirect('customer')->with('message', 'Data dengan email tersebut sudah digunakan!');
} catch (\PDOException $e) {
return redirect('customer')->with('message', 'Data dengan email tersebut sudah digunakan!');
}
}
示例6: function
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
use App\Customer;
use Illuminate\Http\Request;
/**
* Display All Customers
*
* Route::get('/', function () {
* return view('customers');
* });
*/
Route::get('/', function () {
$customers = Customer::orderBy('created_at', 'desc')->get();
return view('customers', ['customers' => $customers]);
});
/**
* Add A New Customer
*/
Route::post('/customer', function (Request $request) {
$validator = Validator::make($request->all(), ['name' => 'required|max:255']);
if ($validator->fails()) {
return redirect('/')->withInput()->withErrors($validator);
}
$customer = new Customer();
$customer->customer_name = $request->name;
$customer->save();
return redirect('/');
// Create The Task...
示例7: destroy
public function destroy($id)
{
Customer::find($id)->delete();
$customers = Customer::orderBy('customer')->paginate(env('CUSTOMER_PAGINATION_MAX'));
return view('customers.index')->with('customers', $customers);
}
示例8: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
// Retrieve all the customers in the database and return them
$customers = Customer::orderBy('first_name', 'asc')->get();
return $customers;
}
示例9: index
public function index()
{
$customers = Customer::orderBy('name')->get();
return view('customer.home', compact('customers'));
}