本文整理汇总了PHP中Skill::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Skill::find方法的具体用法?PHP Skill::find怎么用?PHP Skill::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skill
的用法示例。
在下文中一共展示了Skill::find方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$this->skill->find($id)->delete();
return Redirect::route('skills.index');
}
示例2: function
}
$app->render('skills/delete.html', $data);
})->via('GET', 'POST')->name('skills_delete');
$app->map('/new', function () use($app, $data) {
if ($app->request->isPost()) {
$edu_level = EducationLevel::find($app->request->post('educationlevel'));
$skill = new Skill();
$skill->name = $app->request->post('title');
$skill->save();
$data['new_skill'] = $skill;
}
$app->render('skills/new.html', $data);
})->via('GET', 'POST')->name('skills_new');
$app->map('/edit/:id', function ($id) use($app, $data) {
$data['request_method'] = $app->request->getMethod();
$skill = Skill::find($id);
if ($app->request->isGet()) {
$data['skill'] = $skill->toArray();
} else {
if ($app->request->isPost()) {
$skill->name = $app->request->post('title');
$skill->save();
$data['new_skill'] = $skill->toArray();
}
}
$app->render('skills/edit.html', $data);
})->via('GET', 'POST')->name('skills_edit');
});
$app->group('/schools', function () use($app, $data) {
$data['request_method'] = $app->request->getMethod();
$app->get('/', function () use($app, $data) {
示例3: array
if (api_is_platform_admin() || api_is_drh()) {
if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) {
$skill_id = $skill->edit($_REQUEST);
} else {
$skill_id = $skill->add($_REQUEST);
}
}
echo $skill_id;
break;
case 'delete_skill':
if (api_is_platform_admin() || api_is_drh()) {
echo $skill->delete($_REQUEST['skill_id']);
}
break;
case 'find_skills':
$skills = $skill->find('all', array('where' => array('name LIKE %?% ' => $_REQUEST['tag'])));
$return_skills = array();
foreach ($skills as $skill) {
$skill['caption'] = $skill['name'];
$skill['value'] = $skill['id'];
$return_skills[] = $skill;
}
echo json_encode($return_skills);
break;
case 'get_gradebooks':
$gradebooks = $gradebook_list = $gradebook->get_all();
$gradebook_list = array();
//Only course gradebook with certificate
if (!empty($gradebooks)) {
foreach ($gradebooks as $gradebook) {
if ($gradebook['parent_id'] == 0 && !empty($gradebook['certif_min_score']) && !empty($gradebook['document_id'])) {
示例4: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
return view('admin.lskill.show')->withLskill(Skill::find($id))->withCards(Card::where('lskill_id', $id));
}
示例5: test_find
function test_find()
{
//Arrange
$name = "Acrobatics";
$description = "stuff";
$id = 1;
$test_class = new Skill($name, $description, $id);
$test_class->save();
$name2 = "Athletics";
$description2 = "other stuff";
$id2 = 2;
$test_class2 = new Skill($name2, $description2, $id2);
$test_class2->save();
//Act
$result = Skill::find($test_class->getId());
//Assert
$this->assertEquals($test_class, $result);
}
示例6: header
header('Location: ' . $returnURL);
} else {
header('Location: ' . $ROOT);
}
} else {
$new_user = true;
}
//Add new user to the database $_POST
if ($new_user && isset($_POST["name"])) {
// Firts join to meetup if necessary
$answers = array();
if (isset($_POST['skills'])) {
$service = new Skill();
for ($i = 0; $i < sizeof($_POST['skills']); $i++) {
$skill = $_POST['skills'][$i];
$s = $service->find(array("name" => $skill));
//TODO: FIX THIS and submit profile
if (!isset($member->skills[$s["name"]])) {
$member->skills[$s["name"]] = $s;
}
if ($i < sizeof($_POST['skills']) - 2) {
$answers["answer_6865152"] .= $s["name"] . ", ";
} elseif ($i == sizeof($_POST['skills']) - 2) {
$answers["answer_6865152"] .= $s["name"] . " y ";
} else {
$answers["answer_6865152"] .= $s["name"] . ".";
}
}
}
if (isset($_POST['linkedin_url'])) {
$answers["answer_8151456"] = $_POST['linkedin_url'];
示例7: loadFromMeetup
public function loadFromMeetup($meetup_response = NULL)
{
global $meetup_group_id, $meetup_group_urlname, $meetup_api_key;
$client = DMS\Service\Meetup\MeetupKeyAuthClient::factory(array('key' => $meetup_api_key));
if (!$meetup_response) {
$response = $client->getMember(array('id' => $this->meetup_id));
} else {
$response = $meetup_response;
}
$this->name = $response["name"];
$this->meetup_id = $response["id"];
$this->location = $response["city"] . ", " . $response["country"];
$this->meetup_url = $response["link"];
$this->lat = $response["lat"];
$this->lon = $response["lon"];
$this->name = $response["name"];
if (isset($response["photo"])) {
if (isset($response["photo"]["highres_link"])) {
$this->photo_url = $response["photo"]["highres_link"];
} elseif (isset($response["photo"]["photo_link"])) {
$this->photo_url = $response["photo"]["photo_link"];
} elseif (isset($response["photo"]["thumb_link"])) {
$this->photo_url = $response["photo"]["thumb_link"];
}
} elseif (isset($response["photo_url"])) {
$this->photo_url = $response["photo_url"];
} else {
$email = strtolower($this->meetup_id . "@gmail.com");
$this->photo_url = "http://www.gravatar.com/avatar/" . md5($email);
}
if (isset($response["other_services"]) && is_array($response["other_services"])) {
foreach ($response["other_services"] as $key => $service) {
$s = $service["identifier"];
switch ($key) {
case "twitter":
$this->twitter_url = $s;
break;
case "flickr":
$this->flickr_url = $s;
break;
case "facebook":
$this->facebook_url = $s;
break;
case "linkedin":
$this->linkedin_url = $s;
break;
}
}
}
$service = new Skill();
if (isset($response["topics"]) && is_array($response["topics"])) {
foreach ($response["topics"] as $topic) {
$s = $service->find(array("meetup_skill_id" => $topic["id"]));
if ($s) {
$this->skills[$s["id"]] = $s;
} else {
$this->skills["new_" . $topic["id"]] = array("meetup_skill_id" => $topic["id"], "is_gis" => 0, "synonyms" => NULL, "name" => $topic["name"], "slug" => $topic["urlkey"]);
}
}
}
$options = array('group_urlname' => $meetup_group_urlname, 'group_id' => $meetup_group_id, 'member_id' => $this->meetup_id);
$profiles = $client->getProfiles($options);
if ($profiles->count() > 0) {
// Find relevant skills in open answers and add them to the profile
foreach ($profiles as $p) {
$answers = "";
foreach ($p["answers"] as $a) {
if (isset($a["answer"])) {
$answers .= $a["answer"] . " ";
}
}
$answers = strtolower($answers);
$r = $service->extractRelevantSkills($answers);
$this->merge_skills($r);
//When user joined
$this->joined = $this->parseEpoch($p["created"]);
$this->last_visit = $this->parseEpoch($p["visited"]);
if (isset($p["bio"])) {
$this->bio = $p["bio"];
}
if (isset($p["photo"])) {
if (isset($p["photo"]["highres_link"])) {
$this->photo_url = $p["photo"]["highres_link"];
} elseif (isset($p["photo"]["photo_link"])) {
$this->photo_url = $p["photo"]["photo_link"];
} elseif (isset($p["photo"]["thumb_link"])) {
$this->photo_url = $p["photo"]["thumb_link"];
}
} elseif (isset($p["photo_url"])) {
$this->photo_url = $p["photo_url"];
}
if (isset($p["profile_url"])) {
$this->meetup_url = $p["profile_url"];
}
//TODO: check if other services
}
}
}