Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
0
00:00:00,110 --> 00:00:02,020
They're all right welcome back and by the students.
1
00:00:02,040 --> 00:00:05,900
It's time for us to start learning how to run queries in our application.
2
00:00:05,900 --> 00:00:09,110
We are going jumping into the database which is really cool.
3
00:00:09,120 --> 00:00:15,150
There are a couple ways of inserting reading and doing the crawl basically which is create a read up
4
00:00:15,150 --> 00:00:23,630
day in the lead or destroy in BHB that's what it means right for my school or any other application
5
00:00:23,640 --> 00:00:24,130
right.
6
00:00:24,300 --> 00:00:29,790
So it's time for us to learn how to do is there are a couple ways of doing this in allowable we have
7
00:00:29,790 --> 00:00:34,410
things called Rauh square Aquarius which is the first thing that we are going to be learning because
8
00:00:34,410 --> 00:00:37,080
I want you to learn the hard way of doing things.
9
00:00:37,080 --> 00:00:44,000
There is another way of using the model which is the class that takes care of the database interaction
10
00:00:44,000 --> 00:00:44,190
.
11
00:00:44,280 --> 00:00:45,280
Right.
12
00:00:45,450 --> 00:00:52,740
And there's another way of doing that model has different methods like say Oh they'd destroy or I mean
13
00:00:52,740 --> 00:00:57,080
the lead in a has different methods that we can use right right out of the bots.
14
00:00:57,090 --> 00:00:57,570
Right.
15
00:00:57,780 --> 00:01:03,990
But we also have something called the eloquent model that we can also use to do differing database interaction
16
00:01:03,990 --> 00:01:09,000
which is really cool you're going to see a lot of this and we're going to be doing a lot of queries
17
00:01:09,030 --> 00:01:11,420
to our application is going to be pretty cool right.
18
00:01:11,490 --> 00:01:15,540
I hope that you are really excited because I am all right this is really cool stuff.
19
00:01:15,750 --> 00:01:18,030
But anyway so I want you to learn the hard way.
20
00:01:18,030 --> 00:01:23,040
Like I said before because I want you to be ready for anything and I like to show you as much as I can
21
00:01:23,060 --> 00:01:23,190
.
22
00:01:23,310 --> 00:01:24,180
All right.
23
00:01:24,390 --> 00:01:29,370
So we're going to pack this course with a lot of information that way you know where you are when you're
24
00:01:29,370 --> 00:01:30,420
building an application.
25
00:01:30,420 --> 00:01:31,950
You can always find your way around.
26
00:01:31,950 --> 00:01:37,200
If you get in trouble so I'm going to come in this hour I mean routes by the way routes that BHB and
27
00:01:37,200 --> 00:01:38,990
you should know how to get there by now.
28
00:01:39,150 --> 00:01:43,020
If not if you are in BHB store I'm using a Mac shift shift.
29
00:01:43,020 --> 00:01:49,320
Then you can type in your abbreviation to get here your name of that class.
30
00:01:49,320 --> 00:01:53,430
So I'm going to comment that our roads are going to come in this hour and we're going to create a road
31
00:01:53,430 --> 00:01:59,250
related to what we are doing and what we're going to be doing is inserting some data into our polls
32
00:01:59,280 --> 00:02:00,770
table that we created.
33
00:02:00,880 --> 00:02:02,670
I remember the migrations.
34
00:02:02,670 --> 00:02:03,210
All right.
35
00:02:03,450 --> 00:02:12,450
So now I'm going I want to create a little comment there and BHP story has shortcuts for comments if
36
00:02:12,450 --> 00:02:16,260
you want to learn how to use is in the PH B-story Web site.
37
00:02:16,380 --> 00:02:22,050
And by the way if you're wondering if they pay me money to actually mention their grade ID they're not
38
00:02:22,110 --> 00:02:23,380
actually pay me any money.
39
00:02:23,380 --> 00:02:25,260
I just like their idea or recommend it.
40
00:02:25,260 --> 00:02:26,170
All right guys.
41
00:02:26,310 --> 00:02:29,560
You can find the link in my web site.
42
00:02:29,660 --> 00:02:30,870
And when does that come.
43
00:02:31,020 --> 00:02:31,610
It's pretty cool.
44
00:02:31,650 --> 00:02:36,880
But anyway you can also look it up online guys BHB storm.
45
00:02:36,960 --> 00:02:44,820
You know let's go and create a route a get request.
46
00:02:44,830 --> 00:02:47,320
I remember that's just what his function does.
47
00:02:47,520 --> 00:02:51,450
And let's say when people click insert.
48
00:02:51,460 --> 00:02:54,540
Of course we're not going to do this for real in a production environment.
49
00:02:54,570 --> 00:02:57,980
This is just an example right guys for you to learn.
50
00:02:58,260 --> 00:03:03,410
So we're going to create a closure function here so that way when we visit this you are out here these
51
00:03:03,450 --> 00:03:06,370
insert we execute some type of code.
52
00:03:06,390 --> 00:03:07,490
Right.
53
00:03:07,500 --> 00:03:14,640
So what we're going to be doing is using a method a static method from the DB class or Faqih as they
54
00:03:14,640 --> 00:03:16,440
call it.
55
00:03:16,870 --> 00:03:23,760
Then you can look it up right on line is F A C A D E array for.
56
00:03:24,370 --> 00:03:26,230
C.A.T..
57
00:03:26,280 --> 00:03:34,860
So let's use the insert static method and if you don't know what a static method is please take my ph
58
00:03:34,860 --> 00:03:44,490
B P class which is a basic for B of Jerry into programming for BHP because you will now understand is
59
00:03:44,550 --> 00:03:50,340
if you have not taken of Jerry into programming class you don't have to specifically specifically take
60
00:03:50,340 --> 00:03:55,560
mine but I'm hoping that you like me by now and you take my classes but if not you can take any other
61
00:03:55,560 --> 00:03:58,050
classes it's OK.
62
00:03:58,410 --> 00:04:03,490
So what we going to be doing is we're going to say insert this like a normal Querrey.
63
00:04:03,510 --> 00:04:06,590
All right we're going to be running wrote querist and this is what it is.
64
00:04:06,660 --> 00:04:13,720
Insert into pools and we're going to say we're going to put a couple of values in.
65
00:04:13,740 --> 00:04:15,950
If you remember we have the title I believe.
66
00:04:15,950 --> 00:04:16,610
Right.
67
00:04:17,130 --> 00:04:29,770
So let's just open it up and we say I want you to insert that title and I believe this content.
68
00:04:30,840 --> 00:04:31,750
And what else.
69
00:04:31,890 --> 00:04:35,570
And now values would be.
70
00:04:36,600 --> 00:04:39,690
And if I leave it like that that's OK.
71
00:04:39,750 --> 00:04:48,230
So the values would be and this is like this because this is PDL remember that we need to put the placeholder
72
00:04:48,420 --> 00:04:49,770
question marks.
73
00:04:49,800 --> 00:04:53,120
We can also use we can also use a placeholders.
74
00:04:53,730 --> 00:04:55,340
The did the colon.
75
00:04:55,380 --> 00:05:01,550
OK so I'm going to be using this question marks.
76
00:05:01,590 --> 00:05:08,810
So once we have this then we can run the second parameter here and put an array.
77
00:05:09,310 --> 00:05:10,120
OK.
78
00:05:10,140 --> 00:05:12,540
And this is where we put the values.
79
00:05:12,540 --> 00:05:20,550
So the value for the first one would be BHB Claribel something like this.
80
00:05:20,880 --> 00:05:21,920
Right.
81
00:05:22,050 --> 00:05:28,550
Then the second That's the first parameter second parameter would be the content ph B.
82
00:05:28,630 --> 00:05:31,980
Clarabelle is the best thing
83
00:05:36,060 --> 00:05:37,080
that has happened
84
00:05:40,380 --> 00:05:45,770
to PGE her Hey cool if I got it correctly.
85
00:05:46,000 --> 00:05:50,250
Sounds about right is actually correct and he says Aley you don't spend Larabee like that.
86
00:05:50,250 --> 00:05:51,350
Look at that.
87
00:05:51,700 --> 00:05:52,440
All right.
88
00:05:52,530 --> 00:05:53,720
Happened.
89
00:05:54,210 --> 00:05:57,670
He has even the grammar.
90
00:05:57,690 --> 00:05:58,450
All right.
91
00:05:58,490 --> 00:06:00,870
Decide these gray I tell you I love you guys.
92
00:06:00,930 --> 00:06:02,540
So this looks about right.
93
00:06:02,550 --> 00:06:04,420
Insert into pulls.
94
00:06:04,470 --> 00:06:08,490
We have the values here.
95
00:06:08,490 --> 00:06:11,760
This has to be close right here.
96
00:06:12,450 --> 00:06:12,810
OK.
97
00:06:12,810 --> 00:06:15,130
So we need a parentheses there.
98
00:06:15,140 --> 00:06:16,630
There we go.
99
00:06:17,530 --> 00:06:18,050
OK.
100
00:06:18,060 --> 00:06:24,780
Title values Dand here is making sure we got to correct the guys.
101
00:06:25,260 --> 00:06:27,000
Yeah this sounds about right.
102
00:06:27,000 --> 00:06:28,530
This looks about right.
103
00:06:29,130 --> 00:06:30,020
OK.
104
00:06:30,030 --> 00:06:31,880
I think I'm forgetting something but that's OK.
105
00:06:32,070 --> 00:06:37,550
So once we run this we can just run that query Now let's try it let's go and I'm forgetting something
106
00:06:37,560 --> 00:06:47,320
hopefully this would give us the exception so that way we know insert and then enter that we go where
107
00:06:47,340 --> 00:06:52,160
we assuption now found see a mess both those exist.
108
00:06:52,380 --> 00:06:52,770
All right.
109
00:06:52,770 --> 00:06:57,360
So for some reason it did not find it enough find the table.
110
00:06:57,390 --> 00:07:01,050
All right of course that's OK.
111
00:07:02,520 --> 00:07:05,920
The base table view now found.
112
00:07:06,200 --> 00:07:08,700
All right let's see if we're spending the table correctly.
113
00:07:08,700 --> 00:07:15,930
Let's click here and Lara Stone has this really cool stuff where if you see if you see like you have
114
00:07:15,930 --> 00:07:22,170
a problem like a highlighter statement and you use put your mouse over it.
115
00:07:22,230 --> 00:07:28,160
Wait for this libel click it and you can choose from different options here.
116
00:07:28,500 --> 00:07:31,660
I'm going to choose to import this class.
117
00:07:31,830 --> 00:07:34,110
Now let's run this again.
118
00:07:34,890 --> 00:07:37,040
Enter as to how the problem is.
119
00:07:37,040 --> 00:07:39,160
It wasn't that that was OK.
120
00:07:39,180 --> 00:07:41,450
So he's saying that he can't find the table.
121
00:07:41,510 --> 00:07:42,070
All right.
122
00:07:42,180 --> 00:07:48,240
So that's because probably we don't have the table so let's go to BHB Miami and check that out real
123
00:07:48,240 --> 00:07:48,770
quick.
124
00:07:48,800 --> 00:07:52,030
I want you to go there real quick before I even get there.
125
00:07:52,080 --> 00:07:53,500
And let's check it out.
126
00:07:54,060 --> 00:07:55,470
Probably we need to run
127
00:07:59,050 --> 00:08:01,010
migrate or something like that.
128
00:08:01,650 --> 00:08:07,170
Let's just go to law Bill see a mass as you can see.
129
00:08:07,260 --> 00:08:10,000
We need to roll migration.
130
00:08:10,050 --> 00:08:11,840
All right cool.
131
00:08:11,910 --> 00:08:22,970
So let's go to our terminal right here and let's just say BHP Ortiz and agree.
132
00:08:23,550 --> 00:08:24,960
Well there we go.
133
00:08:25,020 --> 00:08:28,350
Now let's take the poor out.
134
00:08:28,350 --> 00:08:29,950
I think it would work without it.
135
00:08:30,120 --> 00:08:36,440
Let's just take this out leave it like this and let's go and do it again anther.
136
00:08:36,970 --> 00:08:38,240
OK looks like it worked.
137
00:08:38,250 --> 00:08:39,760
Let's go back to that.
138
00:08:39,770 --> 00:08:41,730
Here we have the polls.
139
00:08:41,790 --> 00:08:43,910
We click on it and we have some information.
140
00:08:43,910 --> 00:08:45,370
Look at this.
141
00:08:45,510 --> 00:08:52,020
All right of course winning with the not created the time or the updated that we could if we wanted
142
00:08:52,020 --> 00:08:52,380
to.
143
00:08:52,380 --> 00:08:52,770
All right.
144
00:08:52,770 --> 00:08:56,440
You can put a time function in there and you have the time.
145
00:08:56,540 --> 00:09:03,610
All right so now you know how to insert queries are using role as well.
146
00:09:03,640 --> 00:09:06,940
Querrey functionality will Arabo which is pretty cool.
147
00:09:06,960 --> 00:09:12,460
So in the next election we're going to continue going over the crowd doing this.
148
00:09:12,470 --> 00:09:17,840
And but the next functions are super similar or the next method if you want to call it that.
149
00:09:17,850 --> 00:09:19,500
Thank you so much and I see you in the next lecture13173
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.