本文整理汇总了PHP中Categorie::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Categorie::find方法的具体用法?PHP Categorie::find怎么用?PHP Categorie::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Categorie
的用法示例。
在下文中一共展示了Categorie::find方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
/**
* @param string $backUrl
* @param int $categorie_id
* @return \Illuminate\Http\RedirectResponse
*/
public function add($backUrl = 'compet', $categorie_id = 0)
{
if ($categorie_id == 0) {
return Redirect::route($backUrl);
}
$categorie = Categorie::find($categorie_id);
$userclub = new Competcategorie();
$userclub->categorie_id = $categorie->id;
$userclub->compet_id = MySession::getModel('compet')->id;
$userclub->tee_id = $categorie->tee_id;
$userclub->save();
return Redirect::route($backUrl);
}
示例2: getSamePost
public static function getSamePost($id = "", $cate = "", $limit)
{
if ($cate != "" && $id != "") {
if (Post::where('categorieID', $cate)->count() > 4) {
$data = DB::select(" SELECT * FROM posts WHERE categorieID = {$cate} AND id != {$id} ORDER BY id ASC LIMIT 0, {$limit} ");
} else {
$parent = Categorie::find($cate)->parent;
$data = DB::select(" SELECT * FROM posts WHERE parent = {$parent} AND id != {$id} ORDER BY id ASC LIMIT 0, {$limit} ");
}
} else {
$data = DB::select("SELECT * FROM posts WHERE parent = 1 ORDER BY id DESC LIMIT 0, {$limit} ");
}
return $data;
}
示例3: action_mylistings
public function action_mylistings()
{
if (Auth::check()) {
if (Session::has('id')) {
$id = Session::get('id');
$account = Account::find($id);
$locations = $account->locations()->get();
$listings = array();
foreach ($locations as $location) {
foreach ($location->listings()->get() as $listing) {
$listing->location = $listing->location()->first();
$listing->category = Categorie::find($listing->category_id)->title;
// var_dump($listing->category_id);
array_push($listings, $listing);
}
}
$view = View::make('account.manage_listings.index')->with('title', 'My Listings')->with('listings', $listings);
return $view;
}
}
}
示例4: function
<?php
Route::group(['prefix' => 'tester'], function () {
# Selected
Route::get('selected/{backUrl?}/{id?}', ['as' => 'test.selected', function ($backUrl = 'manager', $id = 0) {
$c = Categorie::find($id);
return $c;
}]);
# Create
Route::get('create/{backUrl?}/{id?}', ['as' => 'test.create', 'uses' => 'TestsController@create']);
Route::post('create', ['as' => 'test.create', 'uses' => 'TestsController@store']);
# Delete
Route::get('delete/{id?}/{backUrl?}', ['as' => 'test.delete', 'uses' => 'TestsController@delete']);
# List
Route::get('/list', ['as' => 'test.list', 'uses' => 'TestsController@liste']);
# Home
Route::get('/home', ['as' => 'test.home', 'uses' => 'TestsController@home']);
# ScoreCard Angular
Route::get('/scorecard', ['as' => 'test.scorecard', 'uses' => 'TestsController@scorecard']);
# Divers test
Route::get('/divers', ['as' => 'test.divers', 'uses' => 'TestsController@divers']);
# Show Session
Route::get('/showSession', ['as' => 'test.showSession', 'uses' => 'TestsController@showSession']);
# Show Ajax
Route::get('/showAjax', ['as' => 'test.showAjax', 'uses' => 'TestsController@showAjax']);
# Test Ajax
Route::get('/getAjax/{model}/{id?}', function ($model, $id = 0) {
if ($id == 0) {
return $model::all();
}
return $model::find($id);
示例5: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$categorie = Categorie::find($id);
if ($categorie->materials->count() == 0) {
$categorie->delete();
return Redirect::back()->with('success', 'U hebt de categorie ' . $categorie->name . ' met succes verwijderd');
} else {
return Redirect::back()->with('error', 'Kan categorie niet verwijderen. </br>Gelieve eerst al het materiaal uit de categorie te verwijderen.');
}
}
示例6: action_sendEmails
public function action_sendEmails()
{
$accounts = Account::where('wishlistEmail', '=', '1')->get();
foreach ($accounts as $account) {
$matches = array();
$tags = $account->wishlistitems()->get();
$listings = array();
$tempListings = array();
foreach ($tags as $tag) {
$tagListings;
$strings = explode(' ', $tag->item);
if (sizeof($strings) == 1) {
$tagListings = Listing::where('title', 'LIKE', "%{$tag->item}%")->or_where("description", 'LIKE', "%{$tag->item}%")->get();
} else {
$string = array_pop($strings);
$query = "\tSELECT *\n\t\t\t\t\t\t\t\tFROM listings\n\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t(title LIKE '%{$string}%'\n\t\t\t\t\t\t\t\t\tOR description LIKE '%{$string}%')";
while (!empty($strings)) {
$string = array_pop($strings);
$query .= " AND (title LIKE '%{$string}%'\n\t\t\t\t\t\t\t\t\tOR description LIKE '%{$string}%')";
}
$tagListings = DB::query($query);
}
foreach ($strings as $string) {
}
foreach ($tagListings as $listing) {
$listing->location = Location::find($listing->location_id);
$listing->category = Categorie::find($listing->category_id);
}
array_push($tempListings, $tagListings);
}
foreach ($tempListings as $key => $tagListings) {
foreach ($tagListings as $listing) {
$listings[$listing->id] = $listing;
}
}
var_dump(sizeof($listings));
if (sizeof($listings) > 0) {
$email = $account->email;
$subject = 'REMARKET: Matches found on your wishlist!';
$message = "There have recently been matches found which match the tags in your wishlist. \n\n" . "Go to market319.tk/ and login to view your wishlist.\n" . "\n\n Happy buying, \n The REMARKET team";
$header = "from: REMARKET <no-reply@market.tk>";
$sent = mail($email, $subject, $message, $header);
}
}
}