本文整理汇总了PHP中app\Item类的典型用法代码示例。如果您正苦于以下问题:PHP Item类的具体用法?PHP Item怎么用?PHP Item使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Item类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: show
public function show($id, Request $request)
{
$id = (int) my_decode($id);
$data['user'] = $this->person->respondWithItem($this->person->get('person_' . $id), new UserTransformer());
//get invidvidual reports
$response = $this->report->individual($id);
$data['totalIReport'] = 0;
$data['individual'] = [];
$item = new Item();
if (!isset($response['error'])) {
$data['individual'] = $this->report->respondWithCollection($response['data'], new ReportTransformer());
foreach ($data['individual'] as $i => $row) {
$items = $item->getItemsByReport((int) my_decode($row['id']));
$data['individual'][$i]['items'] = $items['totalRecords'];
}
$data['totalIReport'] = $response['totalRecords'];
}
$response = $this->report->group($id);
$data['totalGReport'] = 0;
$data['group'] = [];
if (!isset($response['error'])) {
$data['group'] = $this->report->respondWithCollection($response['data'], new ReportTransformer());
foreach ($data['group'] as $i => $row) {
$items = $item->getItemsByReport((int) my_decode($row['id']));
$data['group'][$i]['items'] = $items['totalRecords'];
}
$data['totalGReport'] = $response['totalRecords'];
}
return view('users_profile', $data);
}
开发者ID:grepollo,项目名称:dkb_5sp,代码行数:30,代码来源:UsersController.php
示例2: store
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$validator = Validator::make($request->all(), ['item_name' => 'required']);
if ($validator->fails()) {
return redirect('dashboard')->withErrors($validator)->withInput();
}
$item = $request->input('item_name');
if (!Item::where('item_name', $item)->count()) {
//naya item insert hua hai
$items = new Item();
$item_id = $items->insertGetId(['item_name' => $item, 'created_at' => Carbon::now()]);
$data = new pivot_user_item();
$data->user_id = Auth::user()->id;
$data->item_id = $item_id;
$data->save();
$request->session()->flash('status', 'Item added.Add another item!');
} else {
$item_id = Item::where('item_name', $item)->value('id');
if (pivot_user_item::where('item_id', $item_id)->where('user_id', Auth::user()->id)->count()) {
//item agar user ka hoga to added
$request->session()->flash('list', 'you have already added this item!');
} else {
//item naya user add kia hai
$data = new pivot_user_item();
$data->user_id = Auth::user()->id;
$data->item_id = $item_id;
$data->save();
$request->session()->flash('status', 'Item added.Add another item!');
}
}
return redirect('items');
}
开发者ID:vikashkrkashyap,项目名称:Home-shopping-Managements,代码行数:37,代码来源:UserController.php
示例3: create
public function create(Requests\ItemRequest $request)
{
$name = $request->name;
$shortdesc = $request->shortdesc;
$desc = $request->desc;
$price = $request->price;
$id = $request->id;
$characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
$string = '';
$random_string_length = 12;
for ($i = 0; $i < $random_string_length; $i++) {
$string .= $characters[rand(0, strlen($characters) - 1)];
}
$imageName = $name . '_' . $string . '.' . $request->file($id . 'image')->getClientOriginalExtension();
$item = new Item();
$item->name = $name;
$item->shortdesc = $shortdesc;
$item->desc = $desc;
$item->image = $imageName;
$item->group_id = $id;
$item->price = $price;
$item->save();
$request->file($id . 'image')->move(base_path() . '/public/upload/itemimages/', $imageName);
return redirect('admin/catalogue');
}
开发者ID:silent-sea,项目名称:silent-sea,代码行数:25,代码来源:ItemsController.php
示例4: postAddItemStepTwo
private function postAddItemStepTwo(ItemRequest $request)
{
//Create new item
$item = new Item();
$item->name = $request->name;
$item->description = $request->description;
$item->price = $request->price;
$item->by_mail = $request->by_mail ? 1 : 0;
$item->user()->associate(Auth::user());
$item->save();
//Create new itemAttributes based on the defaultAttributes of the market
foreach ($request->itemAttributes as $name => $value) {
$itemAttribute = new ItemAttribute();
$itemAttribute->name = $name;
$itemAttribute->value = $value;
$itemAttribute->item()->associate($item);
$itemAttribute->save();
}
//Create new itemPhotos
/*if (!empty($request->itemPhotos))
{
foreach ($request->get('itemPhotos') as $itemPhoto)
{
var_dump($itemPhoto);exit;
}
}*/
}
开发者ID:udoblunt,项目名称:marketplaces,代码行数:27,代码来源:ItemController.php
示例5: index
public function index()
{
$person = new Person();
$report = new Report();
$item = new Item();
$role = session('user.role');
$data = ['total_users' => 0, 'total_report' => 0, 'total_item' => 0];
if ($role == 'U') {
//get data on report and item only
} else {
if ($role == 'M') {
$response = $person->getAssignedPersons(session('user.id'));
if (!empty($response)) {
//get total reports or their assigned users
$data['total_users'] = $response['totalRecords'];
foreach ($response['data'] as $row) {
$reports = $report->getReportsByPerson($row['id']);
if (!empty($reports['data'])) {
$data['total_report'] += $reports['totalRecords'];
//get item of the report
foreach ($reports['data'] as $srow) {
$items = $item->getItemsByReport($srow['id']);
$data['total_item'] += $items['totalRecords'];
}
}
}
//get current user's report
$response = $report->getReportsByPerson(session('user.id'));
if (!empty($response['data'])) {
$data['total_report'] += $response['totalRecords'];
//get item of the report
foreach ($response['data'] as $row) {
$items = $item->getItemsByReport($row['id']);
$data['total_item'] += $items['totalRecords'];
}
}
}
} else {
//admin
$response = $person->all([]);
if (!empty($response)) {
//get total reports or their assigned users
$data['total_users'] = $response['totalRecords'];
foreach ($response['data'] as $row) {
$reports = $report->getReportsByPerson($row['id']);
if (isset($reports['data']) && !empty($reports['data'])) {
$data['total_report'] += $reports['totalRecords'];
//get item of the report
foreach ($reports['data'] as $srow) {
$items = $item->getItemsByReport($srow['id']);
$data['total_item'] += $items['totalRecords'];
}
}
}
}
}
}
return view('dashboard', $data);
}
开发者ID:grepollo,项目名称:dkb_5sp,代码行数:59,代码来源:DashboardController.php
示例6: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show()
{
$info = new Item();
$info->setTable($this->getLoginUsername());
//$info->setTable($this->getLoginUsername());
$list = $info->all($this->getLoginUsername(), array('taskname', 'deadline', 'description', 'important'));
return view('auth.profile')->with(array('username' => $this->getLoginUsername(), 'list' => $list));
}
开发者ID:kakaacac,项目名称:loudengdeng,代码行数:14,代码来源:ToDoListController.php
示例7: store
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
$item = new Item();
$item->item_name = trim($request->get('item_name'));
$item->item_id = (int) $request->get('item_id');
$item->save();
return redirect('/item')->withSuccess("Item {$item->item_name} was created");
}
开发者ID:HostOnNet,项目名称:merch.runerank.com,代码行数:14,代码来源:ItemController.php
示例8: getDelete
public function getDelete(Item $task)
{
//echo $task;
//security, make sure that the correct user deletes this task
if ($task->owner_id == Auth::user()->id) {
$task->delete();
}
return Redirect::route('home');
}
开发者ID:Verhoevenwout,项目名称:web-backend-oplossingen,代码行数:9,代码来源:HomeController.php
示例9: store
public function store(Request $request)
{
$item = new Item();
$item->setSymPass($request->session()->get('sym_pass'));
$item->key = $request->key;
$item->val = $request->val;
$item->resource_id = $request->resource_id;
$item->save();
return redirect()->route('resource.show', ['id' => $request->resource_id]);
}
开发者ID:ruslan2k,项目名称:web-password,代码行数:10,代码来源:ItemController.php
示例10: save
public function save(Request $request, Response $response, array $args)
{
$_POST = array_filter($_POST, 'trim');
$metadata = array('id' => filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT), 'title' => filter_input(INPUT_POST, 'title'), 'description' => filter_input(INPUT_POST, 'description'), 'date' => filter_input(INPUT_POST, 'date'), 'date_granularity' => filter_input(INPUT_POST, 'date_granularity', FILTER_SANITIZE_NUMBER_INT), 'edit_group' => filter_input(INPUT_POST, 'edit_group', FILTER_SANITIZE_NUMBER_INT), 'read_group' => filter_input(INPUT_POST, 'read_group', FILTER_SANITIZE_NUMBER_INT));
$tags = filter_input(INPUT_POST, 'tags');
$item = new Item(null, $this->user);
$item->save($metadata, $tags, $_FILES['file']['tmp_name'], filter_input(INPUT_POST, 'file_contents'));
$config = new Config();
return new RedirectResponse($config->baseUrl() . '/' . $item->getId());
}
开发者ID:samwilson,项目名称:swidau,代码行数:10,代码来源:ItemController.php
示例11: done
public function done(Item $item)
{
$login_user = Auth::user();
$child = $login_user->getChild();
$child_member_id = $child->member_id;
$item_record = $item->where("member_id", "=", $child_member_id)->where('did_get', '=', NULL)->first();
$item_record->did_get = date("Y/m/d H:i:s");
$item_record->save();
return redirect()->to('/mypage/cart');
}
开发者ID:nikotaman01,项目名称:PenGumin,代码行数:10,代码来源:MypageController.php
示例12: addItem
static function addItem($request)
{
$item = new Item();
$item->user_id = $request->input('user_id');
$item->name = $request->input('name');
$item->specifications = $request->input('specifications');
$item->link = $request->input('link');
$item->rank = $request->input('rank');
$item->save();
}
开发者ID:michael-dean-haynie,项目名称:my-secret-santa,代码行数:10,代码来源:Item.php
示例13: getCategoryItems
/**
* Returns category items
*
* @param string $alias
* @return array
*/
public function getCategoryItems($alias)
{
$categories = $this->categoryService->getCategoriesByAlias($alias);
if (count($categories) === 0) {
return [];
}
$categoryIDs = array_map(function (Category $category) {
return $category->id;
}, $categories);
return $this->itemStorage->getCategoriesItems($categoryIDs);
}
开发者ID:yayatoure42,项目名称:service-exchange,代码行数:17,代码来源:ItemsService.php
示例14: render
public function render(Request $request, Response $response, array $args)
{
$item = new Item($args['id']);
$size = isset($args['size']) ? $args['size'] : 'o';
$version = isset($args['version']) ? $args['version'] : null;
$cacheFile = $item->getCachePath($size, $version);
$fileResponse = new BinaryFileResponse($cacheFile);
$fileResponse->headers->set('Content-Type', 'image/png');
$fileResponse->setFile($cacheFile);
$fileResponse->setContentDisposition(ResponseHeaderBag::DISPOSITION_INLINE, $item->getTitle() . '.png');
return $fileResponse;
}
开发者ID:samwilson,项目名称:swidau,代码行数:12,代码来源:FileController.php
示例15: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = Faker::create();
for ($i = 0; $i < 300; $i++) {
Item::create(['name' => $faker->shuffle($faker->name()), 'description' => $faker->text(), 'icon' => $faker->imageUrl(100, 100, 'abstract')]);
}
}
开发者ID:benjides,项目名称:terrabattlez,代码行数:12,代码来源:ItemSeeder.php
示例16: handle
/**
* Update podcast items
*
* @return mixed
*/
public function handle()
{
$uniquePodcasts = DB::table('podcasts')->select('id', 'feed_url', 'machine_name')->groupBy('machine_name')->get();
foreach ($uniquePodcasts as $podcast) {
$usersSubscribedToThisPodcast = DB::table('podcasts')->select('user_id', 'id as podcast_id')->where('machine_name', '=', $podcast->machine_name)->get();
$items = Feeds::make($podcast->feed_url)->get_items();
// Calculate 48 hours ago
$yesterday = time() - 24 * 2 * 60 * 60;
foreach ($items as $item) {
$itemPubDate = $item->get_date();
if ($item->get_date('U') > $yesterday) {
// new items
foreach ($usersSubscribedToThisPodcast as $subscriber) {
$podcastItemsCount = DB::table('items')->select('user_id', 'title', 'podcast_id')->where('title', '=', strip_tags($item->get_title()))->where('user_id', '=', $subscriber->user_id)->where('podcast_id', '=', $subscriber->podcast_id)->count();
// if this item is not already in the DB
if ($podcastItemsCount == 0) {
Item::create(['user_id' => $subscriber->user_id, 'title' => strip_tags($item->get_title()), 'description' => strip_tags(str_limit($item->get_description(), 100)), 'published_at' => $item->get_date('Y-m-d'), 'url' => $item->get_permalink(), 'audio_url' => $item->get_enclosure()->get_link(), 'podcast_id' => $subscriber->podcast_id]);
}
}
} else {
break;
}
}
}
}
开发者ID:MehmetNuri,项目名称:Podcastwala,代码行数:30,代码来源:UpdatePodcastItems.php
示例17: getUpdate
public function getUpdate($id)
{
$gather = Gather::find($id);
$lists = $gather->detail->lists('item_id');
$items = Item::whereNotIn('id', $lists)->get();
return view("gathers.update")->with('gather', $gather)->with('items', $items);
}
开发者ID:haruya,项目名称:collections,代码行数:7,代码来源:GathersController.php
示例18: store
public function store(Request $request)
{
try {
$counter = $request->input('counter');
ItemOut::create($request->all());
$data = ItemOut::orderBy('created_at', 'desc')->first();
echo $counter;
for ($i = 0; $i < $counter; $i++) {
$qty = $request->input('qty' . strval($i));
$itemId = $request->input('item_id' . strval($i));
$isItemAvailable = Item::where('id', 'like', '%' . $itemId . '%')->first();
// Item::findOrFail($itemId);
if (is_null($isItemAvailable)) {
ItemOut::destroy($data->id);
return redirect('itemout')->with('message', 'Data dengan kode barang: ' . $itemId . ', tidak ada');
} else {
DetailItemOut::create(['qty' => $qty, 'item_id' => $itemId, 'item_out_id' => $data->id]);
Item::decreaseStock($itemId, $qty);
}
}
return redirect('itemout')->with('message', 'Data berhasil dibuat!');
} catch (\Illuminate\Database\QueryException $e) {
return redirect('itemout')->with('message', 'Data dengan email tersebut sudah digunakan!');
} catch (\PDOException $e) {
return redirect('itemout')->with('message', 'Data dengan email tersebut sudah digunakan!');
}
}
开发者ID:Herlanggaws,项目名称:givani,代码行数:27,代码来源:ItemOutController.php
示例19: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('items')->delete();
for ($i = 1; $i <= 100; $i++) {
Item::create(array('title' => 'item test ' . $i));
}
}
开发者ID:zc1415926,项目名称:angular-laravel-pagination,代码行数:12,代码来源:ItemDataSeeder.php
示例20: index
public function index(Request $request)
{
$request->flash();
$items = Item::search($request);
// dd($request);
return view('spareparts.index', compact('items'));
}
开发者ID:renciebautista,项目名称:sparepartsfinder,代码行数:7,代码来源:SparepartsController.php
注:本文中的app\Item类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论