public function show($id) { $invoice = Invoice::getInvoiceDetails($id); $items = Item::all(); // print_r($items); return view('invoice', ['invoice' => $invoice, 'id' => $id, 'items' => $items->getArray()]); }
/** * Add or Edit Form */ public function invoiceProfile($invoice_id) { // Validation Rules $validator = Validator::make(['invoice_id' => $invoice_id], ['invoice_id' => 'integer']); // If Validation Fails if ($validator->fails()) { return redirect('/customers')->withErrors($validator->messages()->toArray()); } // Get the invoice model $invoice = new Invoice($invoice_id); // Invoice Items as an array $items = $invoice->getItems(); // All Items Collection $all_items = Item::all(); // Return the Invoice Profile View return view('invoices.profile', ['invoice' => $invoice, 'items' => $items->getArray(), 'all_items' => $all_items->getArray()]); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $item = Item::all(); // var_dump($item);exit; return view('admin.item.index', ['item' => $item]); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $items = Item::all(); return \View::make('list_item', compact('items')); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function showAll() { $items = \App\Models\Item::all(); return view('toDo', ['items' => $items]); }
public function items() { $items = \App\Models\Item::all(); return \View::make('items')->with('items', $items); }
<?php /* |-------------------------------------------------------------------------- | Routes File |-------------------------------------------------------------------------- | | Here is where you will register all of the routes in 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. | */ Route::get('/', function () { $items = \App\Models\Item::all(); return $items; }); // ===== items route ===== Route::get('toDo', 'ItemsController@showForm'); Route::get('toDo', 'ItemsController@showAll'); Route::resource('items', 'ItemsController'); /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | This route group applies the "web" middleware group to every route | it contains. The "web" middleware group is defined in your HTTP | kernel and includes session state, CSRF protection, and more. | */ Route::group(['middleware' => ['web']], function () {
<?php // Home route to show all tasks $app->get('/', function () { return view('list')->with('items', \App\Models\Item::all()); }); // Add a task $app->post('/task/add', ['as' => 'task.add', 'uses' => 'App\\Http\\Controllers\\ListController@add']); // Check a task as complete $app->post('/task/check', ['as' => 'task.check', 'uses' => 'App\\Http\\Controllers\\ListController@check']); // Uncheck a task $app->post('/task/uncheck', ['as' => 'task.uncheck', 'uses' => 'App\\Http\\Controllers\\ListController@unCheck']); // Remove a task $app->post('/task/remove', ['as' => 'task.remove', 'uses' => 'App\\Http\\Controllers\\ListController@remove']);
public function showAll() { $items = Item::all(); return view('item_all', ['items' => $items->getArray()]); }
public function index() { return Item::all()->toArray(); }
/** * 查看商品 * */ public function index() { $item = Item::all(); return view('item.index', ['item' => $item]); }