當前位置: 首頁>>代碼示例>>PHP>>正文


PHP User::orderByRaw方法代碼示例

本文整理匯總了PHP中app\User::orderByRaw方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::orderByRaw方法的具體用法?PHP User::orderByRaw怎麽用?PHP User::orderByRaw使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\User的用法示例。


在下文中一共展示了User::orderByRaw方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     factory(User::class, 50)->create()->each(function ($user) {
         // store 10 rounds per user
         for ($i = 0; $i < 10; $i++) {
             // pick a random course to play on
             $course = Course::orderByRaw("random()")->first();
             // pick a random tee set on that course
             $teeSet = TeeSet::orderByRaw("random()")->where('course_id', $course->id)->first();
             $holes = $course->holes;
             $scores = [];
             // each round has 18 scores
             for ($j = 0; $j < 18; $j++) {
                 $scores[] = factory(Score::class)->make(['hole_id' => $holes[$j]->id]);
             }
             $round = factory(Round::class)->make(['tee_set_id' => $teeSet->id]);
             $round = $user->rounds()->save($round);
             $round->scores()->saveMany($scores);
         }
         $followed = [$user->id];
         // follow 10 random users
         for ($i = 0; $i < 10; $i++) {
             // pick a random user, that is not the current user and is not already followed
             $userToFollow = User::orderByRaw("random()")->whereNotIn('users.id', $followed)->first();
             $user->following()->attach($userToFollow);
             $followed[] = $userToFollow->id;
         }
     });
 }
開發者ID:robeasdon,項目名稱:golf-stat-tracker,代碼行數:34,代碼來源:UserSeeder.php

示例2: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('bids')->delete();
     $auctions = Auction::get();
     foreach ($auctions as $auction) {
         $random_user = User::orderByRaw("RAND()")->first();
         if (rand(0, 5) == 0) {
             Bid::create(['user_id' => $random_user->id, 'auction_id' => $auction->id, 'price' => $auction->min_price + 999]);
         }
     }
 }
開發者ID:DriesVS,項目名稱:landoretti,代碼行數:16,代碼來源:BidsTableSeeder.php

示例3: run

 public function run()
 {
     DB::table('articles')->delete();
     $faker = Faker\Factory::create('it_IT');
     $articlesCount = 50;
     $categoriesIds = $this->getCategoriesIdsArray();
     for ($c = 0; $c < $articlesCount; $c++) {
         $title = $faker->sentence();
         $slug = Str::slug($title);
         $article = Article::create(['title' => $title, 'slug' => $slug, 'body' => '<p>' . $faker->paragraph(10) . '</p>', 'is_published' => $faker->boolean(80), 'published_at' => $faker->dateTimeThisYear($max = 'now'), 'meta_keys' => implode(',', $faker->words(5)), 'meta_description' => $faker->sentence(), 'user_id' => User::orderByRaw('RAND()')->first()->id]);
         $article->categories()->sync($faker->randomElements($categoriesIds, mt_rand(1, 2)));
     }
 }
開發者ID:FrancescoWM,項目名稱:Laravel-blog,代碼行數:13,代碼來源:ArticleTableSeeder.php

示例4: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create('it_IT');
     $articlesCount = 10;
     //$descriptionsIds = $this->getDescriptionsIdsArray();
     for ($c = 0; $c < $articlesCount; $c++) {
         $name = $faker->text(54);
         $slug = Str::slug($name);
         // creo l'articolo
         $project = Project::create(['name' => f, 'slug' => $slug, 'state' => $faker->boolean(80), 'progress' => $faker->unique()->randomDigit, 'meta_keys' => implode(',', $faker->words(5)), 'short_description' => $faker->sentence(), 'is_published' => $faker->boolean(80), 'published_at' => $faker->dateTimeThisYear($max = 'now'), 'user_id' => User::orderByRaw('RAND()')->first()->id]);
         // associo le categorie casualmente (una o due per articolo)
         //$project->descriptions()->sync($faker->randomElements($descriptionsIds, 1));
     }
 }
開發者ID:haseo2015,項目名稱:laravel,代碼行數:19,代碼來源:ProjectTableSeeder.php

示例5: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $user = User::first();
     Event::create(['title' => 'Northern Soul: The Film', 'time_start' => '2016-10-30-19-00-00', 'time_end' => '2016-10-30-22-30-00', 'content' => 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean lacinia bibendum nulla sed consectetur. Vivamus sagittis lacus vel augue laoreet rutrum link style auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget Link style sem nec elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.', 'venue' => '70 Oxford Street, M1 5NH', 'user_id' => User::orderByRaw("RAND()")->first()->id, 'category_id' => rand(1, 5), 'color_scheme_id' => rand(1, 18)]);
     Event::create(['title' => 'CoderDojo at The Sharp Project', 'time_start' => '2016-10-30-19-00-00', 'time_end' => '2016-10-30-22-30-00', 'content' => 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean lacinia bibendum nulla sed consectetur. Vivamus sagittis lacus vel augue laoreet rutrum link style auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget Link style sem nec elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.', 'venue' => '70 Oxford Street, M1 5NH', 'user_id' => User::orderByRaw("RAND()")->first()->id, 'category_id' => rand(1, 5), 'color_scheme_id' => rand(1, 18)]);
     Event::create(['title' => 'Design How Talks', 'time_start' => '2016-10-30-19-00-00', 'time_end' => '2016-10-30-22-30-00', 'content' => 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean lacinia bibendum nulla sed consectetur. Vivamus sagittis lacus vel augue laoreet rutrum link style auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget Link style sem nec elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.', 'venue' => '70 Oxford Street, M1 5NH', 'user_id' => User::orderByRaw("RAND()")->first()->id, 'category_id' => rand(1, 5), 'color_scheme_id' => rand(1, 18)]);
     Event::create(['title' => 'Loz’s Birthday Party', 'time_start' => '2016-10-30-19-00-00', 'time_end' => '2016-10-30-22-30-00', 'content' => 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean lacinia bibendum nulla sed consectetur. Vivamus sagittis lacus vel augue laoreet rutrum link style auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget Link style sem nec elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.', 'venue' => '70 Oxford Street, M1 5NH', 'user_id' => User::orderByRaw("RAND()")->first()->id, 'category_id' => rand(1, 5), 'color_scheme_id' => rand(1, 18)]);
     Event::create(['title' => 'Introduction to Arduino', 'time_start' => '2016-10-30-19-00-00', 'time_end' => '2016-10-30-22-30-00', 'content' => 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean lacinia bibendum nulla sed consectetur. Vivamus sagittis lacus vel augue laoreet rutrum link style auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget Link style sem nec elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.', 'venue' => '70 Oxford Street, M1 5NH', 'user_id' => User::orderByRaw("RAND()")->first()->id, 'category_id' => rand(1, 5), 'color_scheme_id' => rand(1, 18)]);
     Event::create(['title' => 'Made You Look Documentary a Film About the Digital Age', 'time_start' => '2016-10-30-19-00-00', 'time_end' => '2016-10-30-22-30-00', 'content' => 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean lacinia bibendum nulla sed consectetur. Vivamus sagittis lacus vel augue laoreet rutrum link style auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget Link style sem nec elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.', 'venue' => '70 Oxford Street, M1 5NH', 'user_id' => User::orderByRaw("RAND()")->first()->id, 'category_id' => rand(1, 5), 'color_scheme_id' => rand(1, 18)]);
     Event::create(['title' => 'CoderDojo at The Sharp Project Hackday', 'time_start' => '2016-10-30-19-00-00', 'time_end' => '2016-10-30-22-30-00', 'content' => 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean lacinia bibendum nulla sed consectetur. Vivamus sagittis lacus vel augue laoreet rutrum link style auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget Link style sem nec elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.', 'venue' => '70 Oxford Street, M1 5NH', 'user_id' => User::orderByRaw("RAND()")->first()->id, 'category_id' => rand(1, 5), 'color_scheme_id' => rand(1, 18)]);
     Event::create(['title' => 'Film How - Northern Soul / Factory', 'time_start' => '2016-10-30-19-00-00', 'time_end' => '2016-10-30-22-30-00', 'content' => 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean lacinia bibendum nulla sed consectetur. Vivamus sagittis lacus vel augue laoreet rutrum link style auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget Link style sem nec elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.', 'venue' => '70 Oxford Street, M1 5NH', 'user_id' => User::orderByRaw("RAND()")->first()->id, 'category_id' => rand(1, 5), 'color_scheme_id' => rand(1, 18)]);
     Event::create(['title' => 'Manchester Moleskine® Talks, Exhibition', 'time_start' => '2016-11-01-19-00-00', 'time_end' => '2016-11-01-22-30-00', 'content' => 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean lacinia bibendum nulla sed consectetur. Vivamus sagittis lacus vel augue laoreet rutrum link style auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget Link style sem nec elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.', 'venue' => '70 Oxford Street, M1 5NH', 'user_id' => User::orderByRaw("RAND()")->first()->id, 'category_id' => rand(1, 5), 'color_scheme_id' => rand(1, 18)]);
     Event::create(['title' => 'Manchester Worker Bee Exhibition', 'time_start' => '2016-11-03-19-00-00', 'time_end' => '2016-11-03-22-30-00', 'content' => 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean lacinia bibendum nulla sed consectetur. Vivamus sagittis lacus vel augue laoreet rutrum link style auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget Link style sem nec elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.', 'venue' => '70 Oxford Street, M1 5NH', 'user_id' => User::orderByRaw("RAND()")->first()->id, 'category_id' => rand(1, 5), 'color_scheme_id' => rand(1, 18)]);
     Event::create(['title' => 'Festival of the Spoken Nerd: Just for Graphs Comedy', 'time_start' => '2016-11-08-19-00-00', 'time_end' => '2016-11-08-22-30-00', 'content' => 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean lacinia bibendum nulla sed consectetur. Vivamus sagittis lacus vel augue laoreet rutrum link style auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget Link style sem nec elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.', 'venue' => '70 Oxford Street, M1 5NH', 'user_id' => User::orderByRaw("RAND()")->first()->id, 'category_id' => rand(1, 5), 'color_scheme_id' => rand(1, 18)]);
     Event::create(['title' => 'Back to the Future at Manchester Cathederal Film', 'time_start' => '2016-12-02-19-00-00', 'time_end' => '2016-12-02-22-30-00', 'content' => 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean lacinia bibendum nulla sed consectetur. Vivamus sagittis lacus vel augue laoreet rutrum link style auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget Link style sem nec elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.', 'venue' => '70 Oxford Street, M1 5NH', 'user_id' => User::orderByRaw("RAND()")->first()->id, 'category_id' => rand(1, 5), 'color_scheme_id' => rand(1, 18)]);
     Event::create(['title' => 'Biospheric Studio presents Urban Naturalist Workshop', 'time_start' => '2016-12-09-19-00-00', 'time_end' => '2016-12-09-22-30-00', 'content' => 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean lacinia bibendum nulla sed consectetur. Vivamus sagittis lacus vel augue laoreet rutrum link style auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget Link style sem nec elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.', 'venue' => '70 Oxford Street, M1 5NH', 'user_id' => User::orderByRaw("RAND()")->first()->id, 'category_id' => rand(1, 5), 'color_scheme_id' => rand(1, 18)]);
     Event::create(['title' => 'The Hitchhiker’s Guide to the Solar System Exhibition', 'time_start' => '2016-12-12-19-00-00', 'time_end' => '2016-12-12-22-30-00', 'content' => 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean lacinia bibendum nulla sed consectetur. Vivamus sagittis lacus vel augue laoreet rutrum link style auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget Link style sem nec elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.', 'venue' => '70 Oxford Street, M1 5NH', 'user_id' => User::orderByRaw("RAND()")->first()->id, 'category_id' => rand(1, 5), 'color_scheme_id' => rand(1, 18)]);
     Event::create(['title' => 'Homeless Film festival - Waste Land Film', 'time_start' => '2016-12-19-19-00-00', 'time_end' => '2016-12-19-22-30-00', 'content' => 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean lacinia bibendum nulla sed consectetur. Vivamus sagittis lacus vel augue laoreet rutrum link style auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget Link style sem nec elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.', 'venue' => '70 Oxford Street, M1 5NH', 'user_id' => User::orderByRaw("RAND()")->first()->id, 'category_id' => rand(1, 5), 'color_scheme_id' => rand(1, 18)]);
     Event::create(['title' => 'Both sides now: It was the best of times, it was the worst of times? Exhibition', 'time_start' => '2016-05-04-19-00-00', 'time_end' => '2016-05-04-22-30-00', 'content' => 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean lacinia bibendum nulla sed consectetur. Vivamus sagittis lacus vel augue laoreet rutrum link style auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget Link style sem nec elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.', 'venue' => '70 Oxford Street, M1 5NH', 'user_id' => User::orderByRaw("RAND()")->first()->id, 'category_id' => rand(1, 5), 'color_scheme_id' => rand(1, 18)]);
     Event::create(['title' => 'Places', 'time_start' => '2016-05-06-19-00-00', 'time_end' => '2016-05-07-22-30-00', 'content' => 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean lacinia bibendum nulla sed consectetur. Vivamus sagittis lacus vel augue laoreet rutrum link style auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget Link style sem nec elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.', 'venue' => '70 Oxford Street, M1 5NH', 'user_id' => User::orderByRaw("RAND()")->first()->id, 'category_id' => rand(1, 5), 'color_scheme_id' => rand(1, 18)]);
 }
開發者ID:EMT,項目名稱:see-do,代碼行數:26,代碼來源:EventTableSeeder.php

示例6: index

 public function index()
 {
     return view('useradmin.index')->withUser($this->user)->withUsers(User::orderByRaw("FIELD(`state`, 'register', 'auth', 'disabled', 'rented', 'normal')")->orderBy('id', 'desc')->paginate(20));
 }
開發者ID:xuhongxu96,項目名稱:tagexing2,代碼行數:4,代碼來源:UserAdminController.php

示例7: function

<?php

use App\User;
use App\Question;
use Illuminate\Support\Facades\Redirect;
Route::group(['middleware' => 'web'], function () {
    Route::group(['domain' => '{event}.plexus.dev'], function ($event) {
        Route::get('/', ['as' => 'root', 'uses' => 'PagesController@root']);
        Route::get('ss', function () {
            dd(time());
            //return serialize(['a'=>'abhay', 'b'=>'rawat', 'c'=>'aby', 'd'=>'awat']);
            $x = User::orderByRaw("RAND()")->pluck('id')->toArray();
            $event = "khoj";
            dd($x);
            $ques = Question::where('event_id', 2)->orderByRaw('RAND()')->get()->take(1)->toArray();
            dd($ques);
        });
        // Route::get('/', function($event){return Redirect::route('as');});
        Route::get('social/google', ['as' => 'social_login', 'uses' => 'UserController@social_redirect_g']);
        Route::get('social/facebook', ['as' => 'social_login', 'uses' => 'UserController@social_redirect_f']);
        Route::post('login', ['uses' => 'RegController@login']);
        Route::post('signup', ['uses' => 'RegController@signup']);
        Route::group(['middleware' => 'auth'], function () {
            // All the GET routes ====>
            // Route::get('dashboard', ['as'=>'dashboard_event', 'uses'=>'pagesController@dashboard_event']);
            Route::get('battleground', ['as' => 'battleground', 'uses' => 'PagesController@battleground']);
            Route::get('leaderboard', ['as' => 'leaderboard', 'uses' => 'PagesController@leaderboard']);
            Route::get('waiting', ['as' => 'waiting', 'uses' => 'PagesController@wait']);
            Route::get('rules', ['as' => 'rules', 'uses' => 'PagesController@rules']);
            Route::get('upload', ['as' => 'upload', 'uses' => 'PagesController@upload']);
            Route::get('fetch/{level}', ['uses' => 'OpController@fetch_ques']);
開發者ID:ncs-jss,項目名稱:elastic-heart,代碼行數:31,代碼來源:routes.php

示例8: function

use App\User;
use App\Institution;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
/**
 * Model Factory for Users
 */
$factory->define(App\User::class, function (Faker\Generator $faker) {
    return ['firstName' => $faker->firstName, 'lastName' => $faker->lastName, 'email' => $faker->email, 'address' => $faker->streetAddress(), 'city' => $faker->city(), 'zip' => $faker->postcode(), 'country' => $faker->country(), 'password' => bcrypt(str_random(10)), 'isAdmin' => 0, 'remember_token' => str_random(10)];
});
/**
 * Model Factory for Courses
 */
$factory->define(App\Course::class, function (Faker\Generator $faker) {
    return ['assignedOwner' => User::orderByRaw("RAND()")->first()->id, 'assignedInstitution' => Institution::orderByRaw("RAND()")->first()->id, 'courseName' => $faker->sentence(4), 'description' => $faker->text(250), 'price' => $faker->randomNumber(4), 'startDate' => $faker->dateTimeBetween('now', '+3 years'), 'duration' => $faker->randomNumber(1), 'created_at' => $faker->dateTime($max = 'now'), 'confirmed' => 0, 'participantNum' => 20];
});
/**
 * Model Factory for Institutions
 */
$factory->define(App\Institution::class, function (Faker\Generator $faker) {
    return ['name' => $faker->company(), 'slug' => $faker->word(), 'address' => $faker->streetAddress(), 'city' => $faker->city(), 'zip' => $faker->postcode(), 'country' => $faker->country(), 'created_at' => $faker->dateTime($max = 'now')];
});
開發者ID:salvomulas,項目名稱:angryproton,代碼行數:30,代碼來源:ModelFactory.php

示例9: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     $city = City::create(['name' => 'New York', 'iata' => 'nyc']);
     $event = Event::create(['title' => 'A very NYC style event.', 'time_start' => '2016-10-30-19-00-00', 'time_end' => '2016-10-30-22-30-00', 'content' => 'Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean lacinia bibendum nulla sed consectetur. Vivamus sagittis lacus vel augue laoreet rutrum link style auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget Link style sem nec elit. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.', 'venue' => '70 Oxford Street, M1 5NH', 'user_id' => User::orderByRaw("RAND()")->first()->id, 'category_id' => rand(1, 5), 'color_scheme_id' => rand(1, 18), 'city_id' => $city->id]);
 }
開發者ID:EMT,項目名稱:see-do,代碼行數:10,代碼來源:2016_02_16_114627_seed_nyc_testing_city_and_event.php


注:本文中的app\User::orderByRaw方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。