} create_tweets_table.php source bigInteger('tweet_id')->unsigned()->primary() $table->string('oauth_token_secret', 150)->nullable() $table->enum('user_status', array('Active', 'Deactive'))->default('Active') $table->string('twitter_created_at', 10) $table->integer('friends_count')->nullable() $table->integer('followers_count')->nullable() $table->string('expanded_url')->nullable() $table->string('description')->nullable() $table->bigInteger('twitter_id')->unique('twitter_id') create_users_table.php source increments('id') Of course we are creating this on the most excellent Laravel Homestead which we covered in this episode. Here are the migrations to make it happen. We’ll have 6 tables in total which include users, tweet_urls, tweet_tags, tweet_retweets, tweet_mentions, and tweets. Dealing with users is quite easy, as it is just a single table. It should be a fun example.įirst off, we need a database to hold our users and tweets. In addition, we’ll have a Tweet model where we can see that an individual tweet belongsTo a User. As you can imagine, we’ll explore the concept of a User that hasMany tweets. For this example, we’ll explore the concept of a User and his or her Tweets. There are a ton of different ways to explore these relationships. In this episode, we’re going to show some love to the hasMany and belongsTo relationships that Eloquent provides. The many to many relationships tutorial here at Vegibit is always the number one or two most popular post as you can see on the right hand side of this page. Relationships, and specifically Eloquent Relationships, are a really popular feature of Laravel. This is the "detection" function that reads the eloquent data.The Laravel hasMany and belongsTo relationships are a fantastic feature of the framework. If(in_array($where, )
0 Comments
Leave a Reply. |