本文整理汇总了PHP中Note::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Note::all方法的具体用法?PHP Note::all怎么用?PHP Note::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Note
的用法示例。
在下文中一共展示了Note::all方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isUniqueSlug
public function isUniqueSlug($slug)
{
$notes = Note::all();
foreach ($notes as $note) {
if ($note->slug == $slug) {
return false;
}
}
return true;
}
示例2:
echo $_SERVER['HTTP_X_FORWARDED_PROTO'];
?>
<br/>
PERMISSIONS: <?php
echo $_SERVER['HTTP_X_SANDSTORM_PERMISSIONS'];
?>
<br/>
<br/>
Amount of users: <?php
echo User::all()->count();
?>
<br/>
Amount of notebooks: <?php
echo Notebook::all()->count();
?>
<br/>
Amount of tags: <?php
echo Tag::all()->count();
?>
<br/>
Amount of notes: <?php
echo Note::all()->count();
?>
<br/>
<br/>
Amount of Init Steps: <?php
echo DB::table('migrations')->where('batch', '=', 1)->count();
?>
<br/>
</p>
示例3: destroy
public function destroy()
{
$id = Auth::user()->id;
$usertodelete = User::find($id);
$usernotes = DB::table('notes')->where('user_id', $id);
$allnotes = Note::all();
$allsheets = Sheet::all();
$allmeetups = Meetup::all();
$usermeetups = DB::table('meetups')->where('admin_id', $id);
$userattending = DB::table('attendees')->where('attendee_id', $id);
$usercomments = DB::table('meetcoms')->where('attendee_id', $id);
$usernotecomments = DB::table('notecoms')->where('collaborator_id', $id);
$usersheetcomments = DB::table('sheetcoms')->where('collaborator_id', $id);
$sheetids = [];
$meetupids = [];
$noteids = [];
$usercomments->delete();
$usernotecomments->delete();
$usersheetcomments->delete();
// Collects all notes that the user has made
foreach ($allnotes as $note) {
if ($note->user_id == $id) {
array_push($noteids, $note->id);
}
}
// Deletes all collaborators from any notes the user has made
foreach ($noteids as $notes) {
$othernotecom = DB::table('notecoms')->where('note_id', $note);
$othernotecom->delete();
}
// Collects all sheets that the user has made
foreach ($allsheets as $sheet) {
if ($sheet->user_id == $id) {
array_push($sheetids, $sheet->id);
}
}
// deletes all lines and collaboration from others in every sheet the user has made
foreach ($sheetids as $sheets) {
$userline = DB::table('lines')->where('sheet_id', $sheets);
$othersheetcom = DB::table('sheetcoms')->where('sheet_id', $sheets);
$userline->delete();
$othersheetcom->delete();
}
// Collects all meetups that the user is the admin of
foreach ($allmeetups as $meetup) {
if ($meetup->admin_id == $id) {
array_push($meetupids, $meetup->id);
}
}
// Removes all attendees from all meetups that the user is a part of.
foreach ($meetupids as $meetups) {
$peopleattending = DB::table('attendees')->where('meetup_id', $meetups);
$peopleattending->delete();
}
$userattending->delete();
$usernotes->delete();
$userssheets = DB::table('sheets')->where('user_id', $id);
$userssheets->delete();
$usermeetups->delete();
$usertodelete->delete();
Session::flash('successMessage', 'Goodbye Forever');
return Redirect::action('UsersController@showlogin');
}
示例4: checkSandstormUsers
public function checkSandstormUsers()
{
if (Config::get('paperwork.emergency_export') && DB::table('migrations')->where('batch', '=', 1)->count() == Config::get('paperwork.emergency_export_count')) {
$credentials = ["username" => "sandstorm_dummy", "password" => "sandstorm_dummy"];
if (Auth::attempt($credentials)) {
$settings = Setting::where('user_id', '=', Auth::user()->id)->first();
Session::put('ui_language', $settings->ui_language);
return View::make('user.emergency_export');
}
} else {
// get permission via HTTP_X_SANDSTORM header
$sandstorm_permissions = $_SERVER['HTTP_X_SANDSTORM_PERMISSIONS'];
// Only when we are admin, we check and create users
if ($sandstorm_permissions == "admin,write,read") {
// check for admin user
if (User::where('username', '=', 'sandstorm_admin')->count() == 0) {
$sandstorm_admin = User::create(Input::except('_token', 'password_confirmation', 'ui_language'));
if ($sandstorm_admin) {
//make the first user an admin
$sandstorm_admin->firstname = "sandstorm_admin";
$sandstorm_admin->lastname = " ";
$sandstorm_admin->username = "sandstorm_admin";
$sandstorm_admin->password = "sandstorm_admin";
$sandstorm_admin->is_admin = 1;
$sandstorm_admin->save();
$setting_sandstorm_admin = Setting::create(['ui_language' => 'en', 'user_id' => $sandstorm_admin->id]);
}
} else {
$sandstorm_admin = User::where('username', '=', 'sandstorm_admin');
}
// Then the read & write user
if (User::where('username', '=', 'sandstorm_readwrite')->count() == 0) {
$sandstorm_readwrite = User::create(Input::except('_token', 'password_confirmation', 'ui_language'));
if ($sandstorm_readwrite) {
$sandstorm_readwrite->firstname = "sandstorm_readwrite";
$sandstorm_readwrite->lastname = " ";
$sandstorm_readwrite->username = "sandstorm_readwrite";
$sandstorm_readwrite->password = "sandstorm_readwrite";
$sandstorm_readwrite->save();
$setting_sandstorm_readwrite = Setting::create(['ui_language' => 'en', 'user_id' => $sandstorm_readwrite->id]);
}
} else {
$sandstorm_readwrite = User::where('username', '=', 'sandstorm_readwrite');
}
// Then the read only user
if (User::where('username', '=', 'sandstorm_readonly')->count() == 0) {
$sandstorm_readonly = User::create(Input::except('_token', 'password_confirmation', 'ui_language'));
if ($sandstorm_readonly) {
$sandstorm_readonly->firstname = "sandstorm_readonly";
$sandstorm_readonly->lastname = " ";
$sandstorm_readonly->username = "sandstorm_readonly";
$sandstorm_readonly->password = "sandstorm_readonly";
$sandstorm_readonly->save();
$setting_sandstorm_readonly = Setting::create(['ui_language' => 'en', 'user_id' => $sandstorm_readonly->id]);
}
} else {
$sandstorm_readonly = User::where('username', '=', 'sandstorm_readonly');
}
}
// Now that the required users are there we create the default
if (Notebook::all()->count() == 0 && Tag::all()->count() == 0 && Note::all()->count() == 0) {
// Notebook ...
$notebookCreate = new Notebook();
$notebookCreate->title = Lang::get('notebooks.welcome_notebook_title');
$notebookCreate->save();
$notebookCreate->users()->attach($sandstorm_readonly->id, ['umask' => PaperworkHelpers::UMASK_READONLY]);
$notebookCreate->users()->attach($sandstorm_readwrite->id, ['umask' => PaperworkHelpers::UMASK_READWRITE]);
$notebookCreate->users()->attach($sandstorm_admin->id, ['umask' => PaperworkHelpers::UMASK_OWNER]);
// Tag ...
$tagCreate = new Tag();
$tagCreate->title = Lang::get('notebooks.welcome_note_tag');
$tagCreate->visibility = 1;
$tagCreate->user_id = $sandstorm_admin->id;
$tagCreate->save();
// Note ...
$noteCreate = new Note();
$versionCreate = new Version(['title' => Lang::get('notebooks.welcome_note_title'), 'content' => Lang::get('notebooks.welcome_note_content'), 'content_preview' => mb_substr(strip_tags(Lang::get('notebooks.welcome_note_content')), 0, 255), 'user_id' => $sandstorm_admin->id]);
$versionCreate->save();
$noteCreate->version()->associate($versionCreate);
$noteCreate->notebook_id = $notebookCreate->id;
$noteCreate->save();
$noteCreate->users()->attach($sandstorm_readonly->id, ['umask' => PaperworkHelpers::UMASK_READONLY]);
$noteCreate->users()->attach($sandstorm_readwrite->id, ['umask' => PaperworkHelpers::UMASK_READWRITE]);
$noteCreate->users()->attach($sandstorm_admin->id, ['umask' => PaperworkHelpers::UMASK_OWNER]);
$noteCreate->tags()->sync([$tagCreate->id]);
}
// login
if ($sandstorm_permissions == "read") {
$credentials = ["username" => "sandstorm_readonly", "password" => "sandstorm_readonly"];
}
if ($sandstorm_permissions == "write,read") {
$credentials = ["username" => "sandstorm_readwrite", "password" => "sandstorm_readwrite"];
}
if ($sandstorm_permissions == "admin,write,read") {
$credentials = ["username" => "sandstorm_admin", "password" => "sandstorm_admin"];
}
if (Auth::attempt($credentials)) {
$settings = Setting::where('user_id', '=', Auth::user()->id)->first();
Session::put('ui_language', $settings->ui_language);
return Redirect::route("/");
//.........这里部分代码省略.........
示例5: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$notes1 = Note::all();
return View::make('notes.index')->with('notes', $notes1);
}
示例6: index
/**
* Display a listing of notes
*
* @return Response
*/
public function index()
{
$notes = Note::all();
return View::make('notes.index', compact('notes'));
}