Laravel Tutorial Part 5 - CRUD - Retrieving Data with Eloquent

  Рет қаралды 100,870

andrewperk

andrewperk

Күн бұрын

Пікірлер: 83
@AbbeyRoadkill1
@AbbeyRoadkill1 11 жыл бұрын
Laravel is wonderful. The best framework I've worked with. I'd love to see you make more tutorials for it, you do a great job. Thanks!
@CamiloSanchez1979
@CamiloSanchez1979 12 жыл бұрын
I don't think we were ready for this, you needed to make more Cakephp tutorials, there is just so much uncovered bro
@mrjitz
@mrjitz 11 жыл бұрын
After watching your videos,now i am fan of you
@GerardoBelot
@GerardoBelot 12 жыл бұрын
I've seen all your laravel and tutorials are very interesting, I'm used to using a framework called kumbiaphp, which is excellent, but I'm always reviewing new options for web development. Thaks for the videos
@AbbeyRoadkill1
@AbbeyRoadkill1 11 жыл бұрын
Awesome, awesome. You're a life saver, man. I just got a new web dev job and have to learn Laravel pronto. Thanks!
@PlayerRPG85
@PlayerRPG85 12 жыл бұрын
Your tutorials are great, thanks for the time and work you put on them!
@desidarlingly
@desidarlingly 10 жыл бұрын
These videos are so amazing. I can't thank you enough for making them!
@MacWorksMPLS
@MacWorksMPLS 11 жыл бұрын
Nice! Been looking at going with CodeIgniter && PHP ActiveRecord for a new and very database intensive project, but after reading that others have moved on to Laravel ... well your tutorials definitely have me turned on Laravel. From my very cursory experience with CI, Laravel seems to follow a similar pattern but makes up for what CI lacks.
@ElijahAlcantara
@ElijahAlcantara 10 жыл бұрын
For laravel 4 , here is what worked for me: Class Author extends Eloquent { protected $table = 'authors'; }
@bkrisselink
@bkrisselink 10 жыл бұрын
Just removing static worked for me.
@paudelsun
@paudelsun 10 жыл бұрын
One more thing,change order_by to orderby...
@el07694
@el07694 8 жыл бұрын
Chris is Risen Thanks for your video.
@sauer.voussoir
@sauer.voussoir 6 жыл бұрын
You can use seed for adding sample data in your database. Thank you for the series of tutorial :)
@andrewperk
@andrewperk 11 жыл бұрын
The link_to_route method definition says that the parameters are to be passed in as an array in order to accept multiple URI parameters at once. For instance if your route accepted two params you need to use the array. But yes, if you're just needing to pass in one param you don't need to use the array. Just passing in the id with no array will work fine.
@andrewperk
@andrewperk 12 жыл бұрын
It made more sense to me for the URI to be singular since I'm requesting one author that's why my URI is author/:id. You can use authors if you'd prefer.
@russazsuraj630
@russazsuraj630 9 жыл бұрын
This is very very helpful tutorial, thank you so much for making it :)
@paxvidz4727
@paxvidz4727 10 жыл бұрын
Very clearly demonstrated tutorial. I'm quite new to Laravel and currently using notepad++ Wherever there is the @ sign I notice it does not change to blue and there is no way, I make the automatically build methods appear e.g here is order_by() Is there something missing in my installation or please suggest me some other software required to use? Thank you
@svenvandevenne517
@svenvandevenne517 10 жыл бұрын
it's orderBy in the new version ;-)
@Jason_NZ
@Jason_NZ 12 жыл бұрын
Keep up the laravel tutorial, there fantastic!
@GrumpyDeveloper
@GrumpyDeveloper 12 жыл бұрын
Named route is great to know. Thanks
@andrewperk
@andrewperk 12 жыл бұрын
Because using that sets up your URI's using the controller and action name.
@rajasekharreddyb5760
@rajasekharreddyb5760 10 жыл бұрын
Changes in Laravel 4 ->with('authors', AuthorModel::orderBy('name','desc')->get()); order_by() has changed from snake case to Camel case orderBY
@frankmyatthu2406
@frankmyatthu2406 10 жыл бұрын
orderBy, y is small case
@MohamedDembele
@MohamedDembele 9 жыл бұрын
thanks dude!!! www.modemb.com
@andrewperk
@andrewperk 12 жыл бұрын
Sorry for the lack of new CakePHP tutorials. I've been really getting into Laravel and wanted to make some videos about it.
@aaBeben
@aaBeben 10 жыл бұрын
just for adjustment for someone who using new version of laravel at author model no need to type public static $table = 'author' just declare class that extends Eloquent with empty body.
@diegoslinger1254
@diegoslinger1254 6 жыл бұрын
Pretty good and useful video
@Wj3399
@Wj3399 9 жыл бұрын
Was debugging this for a bit in Laravel 5: I had my Models folder directly under app ** In author.php:
@CorporalPoon
@CorporalPoon 9 жыл бұрын
+Jason W awesome thank you
@rajasekharreddyb5760
@rajasekharreddyb5760 10 жыл бұрын
Laravel 4 changes: {{HTML::link_to_route('author', $author->name, array($author->id)) }} need to change as below for Laravel 4 {{link_to_route('author', $author->name,$parameters = array($author->id)) }}
@frankmyatthu2406
@frankmyatthu2406 10 жыл бұрын
{{ HTML::linkRoute('author', $author->name, $parameters = array($author->id)) }}
@MohamedDembele
@MohamedDembele 9 жыл бұрын
wow thanks again man www.modemb.com
@knowledgebase7284
@knowledgebase7284 7 жыл бұрын
Hello, do u know how to save a multiple rows of records from one database table to another table at the same database? Thanks.
@JOKBO1
@JOKBO1 9 жыл бұрын
For those who are getting the "whoops" error during this series, turning on the debug option inside app.php will show you the real error. Also, if you are using Laravel 4, they replaced the underscored with CamelCase so things like "order_by()" are now "orderBy()"
@gyanen1229
@gyanen1229 8 жыл бұрын
thanks man
@opeyemi3220
@opeyemi3220 9 жыл бұрын
in Laravel 5.1, use , {{!! link_to_route('author', $author->name, $parameters= array($author->id)) !!}} if you don't put the "!!" symbol, it would not bring up a hyperlink
@mulathetraveler
@mulathetraveler 9 жыл бұрын
Thanks it worked but put only one curley braces in 5.1.4 {!! link_to_route('author', $author->name, $parameters= array($author->id)) !!}
@opeyemi3220
@opeyemi3220 9 жыл бұрын
yeaaa, just one curly brace
@80938096
@80938096 11 жыл бұрын
Great tutorial. thanks a lot :).
@andrewperk
@andrewperk 12 жыл бұрын
The error message is not as descriptive as I'd hope. Did you look on line 16 of your view file to see if you've made a syntax error?
@richaagiwal1537
@richaagiwal1537 11 жыл бұрын
brilliant tutorials..gud job!! thnks a ton :)
10 жыл бұрын
One more correction for Laravel 4 have to use {id} instead of (:any). At least for me (:any) didn't work. Route::get('author/{id}', array('as'=>'author', 'uses'=>'authorsController@get_view'));
@kennethpatricktrivino5524
@kennethpatricktrivino5524 10 жыл бұрын
put a ->where(array('id'=>value)) after Route::get() method
@andrewperk
@andrewperk 12 жыл бұрын
Hi Felipe, is that the entire error message? If not, can you provide the entire error message for me? Thanks.
@keosamnith6705
@keosamnith6705 9 жыл бұрын
hi could you create vedio for how to correct error in laravel and built websit? thank i hope i can watch these video.
@liaoruochen7281
@liaoruochen7281 9 жыл бұрын
takes me a long time to find the bug: in model, public static $table = "authors"; should be changed to public $table = 'authors';
@waraiotoko2415
@waraiotoko2415 11 жыл бұрын
Can you help me with removing public from url, i read about moving folders and change paths, but i dont know if this is how you do it.
@aleksandrkravtsov8727
@aleksandrkravtsov8727 10 жыл бұрын
very usefull. thank you
@miro-hristov
@miro-hristov 9 жыл бұрын
I got "Trying to get property of non-object" I did not reset the database so my author id was 4,5,6 etc (not 1,2,3) just test with /author/4 (Check your database to see if you have that id)
@MrMikaelo1
@MrMikaelo1 12 жыл бұрын
Do you really have to communicate with database through controller in Laravel? I think it is not good practise to use stuff like like "order_by" etc in controller. This should be used in model. Or does Laravel require this approach?
@jitendragosavi4676
@jitendragosavi4676 9 жыл бұрын
how can I add my css file in html with base url, I am new to learn laravel
@ilu1994
@ilu1994 11 жыл бұрын
Use {{ HTML::linkRoute("author", $author->name, array($author->id)) }} On Laravel 4
@MaheshThobhani
@MaheshThobhani 10 жыл бұрын
hi; i m mahesh thobhani; i follow your tutorial for laravel 4; i got error in eloquent when save date. error is : Symfony \ Component \ Debug \ Exception \ FatalErrorException Call to undefined method Resources::save() ' Resources ' is class that extends Eloquent. can u plz help me; coz i m facing this error from last three days & still, not get any solution.
@styxie21
@styxie21 11 жыл бұрын
I think for Laravel 4+ you need to use this syntax in your controller: ->with('authors', Author::orderBy('name')->get());
@SumitJain
@SumitJain 12 жыл бұрын
Thank you great video
@coreydoyle4702
@coreydoyle4702 11 жыл бұрын
Try the Laravel documentation. It's updated frequently, and has everything you need to get acquainted with 4x. However I wouldn't worry about it right now, as I think 4x is still in beta stage. Link to docs: laravel(dot)com/docs
@DeepeshSingh16
@DeepeshSingh16 8 жыл бұрын
query part should be in model why you are writing query in controller ?? I have seen many tutorials doing the same thing. can you make the simple example how to make select query in model and how to call that function in controller if you don't have time to make video can you please expliin how to achieve that
@Siegieee1
@Siegieee1 12 жыл бұрын
Laravel seems rather picky about the closing php tag. In my authors.php (controller) I didn't put one because in your tutorial there isn't one either. It 404'd on the author/2 request. Is this normal?
@andrewperk
@andrewperk 12 жыл бұрын
I have not had this problem before. Make sure there's no extra lines/whitespace at the beginning or end of your file. I'm sorry I can't be of more help.
@Wj3399
@Wj3399 9 жыл бұрын
I managed to get into the authors/1 page but somehow i'm getting a blank page. Please help, I think I'm not getting the right $id
@WarrioW
@WarrioW 8 жыл бұрын
Laravel 5, in route, change the parameter (:any) to {id}.
@tobiassen23
@tobiassen23 10 жыл бұрын
Route::get('author/(:any)' isnt working. It should be Route::get('author/{id}'
@JahidulIslam-rm5bw
@JahidulIslam-rm5bw 10 жыл бұрын
*****yes he is correct
@honey1761990
@honey1761990 10 жыл бұрын
It seems that code was for old Laravel versions (lower than 4.2 - current version). For new versions, Route::get('author/{id}' is the working code.
@TemaSMirnov
@TemaSMirnov 9 жыл бұрын
chaitanya khurana Yep, sure, on movie Andrew using old version (cause 2012 year)
@JOKBO1
@JOKBO1 9 жыл бұрын
+Tobias Willi In Laravel 5 it'll probably be something completely different. |-(
@bgdazzz
@bgdazzz 11 жыл бұрын
I have a problem with creating an author page. The Error is:Symfony\Component\HttpKernel\Exception\NotFoundHttpException …\vendor\laravel\framework\src\Illuminate\Routing\Router.php1429 How can I fix this problem?
@zzzwb
@zzzwb 10 жыл бұрын
in the routes.php,you should write like:Route::get('/author/{id}', array('as' => 'author', 'uses' => 'AuthorsController@view'));pay attention to {id}
@andrewperk
@andrewperk 12 жыл бұрын
No you do not. You can easily create a static method in your Author model to run the order_by query: public static function yourMethodName() { return static::order_by('name')->get(); } Then call this method from your controller if you wanted: Author::yourMethodName(); It's just such a simple query I feel no need to move this into a method to use in my model. I agree with you though if the query becomes more complex it definitely should go in the model, but this one is very simple.
@chm1220
@chm1220 11 жыл бұрын
also to piggy back this for Laravel 4 in the routes.php Route::get('author/{:any}', ... did not work for me, instead i had to change it to Route::get('author/{id}', ...
@CorporalPoon
@CorporalPoon 9 жыл бұрын
couldn't get past the link_to_route part in laravel 5. keep getting undefined
@davecote8388
@davecote8388 8 жыл бұрын
+CorporalPoon link_to_route has been renamed to linkRoute. Also, Html in illuminate is deprecated and you must now use HTML from collective\Html. I made a blog post to explains this, step by step. debugdave.net/2016/01/24/migrating-from-an-earlier-laravel-version-to-laravel-5-common-problems/
@someshvyas
@someshvyas 10 жыл бұрын
{{ excellent }}
@gabrieleugen2003
@gabrieleugen2003 11 жыл бұрын
Don't forget the "s" from 'author'.
@dipenmehta822
@dipenmehta822 8 жыл бұрын
I tried to list all the records but it's not working. Following is my code and out put: $view->authors=Author::all(); echo ''; print_r($view->authors); // Out put Illuminate\Database\Eloquent\Collection Object ( [items:protected] => Array ( [0] => Author Object ( [table:protected] => authors [connection:protected] => [primaryKey:protected] => id [perPage:protected] => 15 [incrementing] => 1 [timestamps] => 1 [attributes:protected] => Array ( [id] => 1 [name] => Author 1 [bio] => bio 1 [created_at] => 2016-04-10 00:00:00 [updated_at] => 2016-04-10 00:00:00 ) [original:protected] => Array ( [id] => 1 [name] => Author 1 [bio] => bio 1 [created_at] => 2016-04-10 00:00:00 [updated_at] => 2016-04-10 00:00:00 ) [relations:protected] => Array ( ) [hidden:protected] => Array ( ) [visible:protected] => Array ( ) [appends:protected] => Array ( ) [fillable:protected] => Array ( ) [guarded:protected] => Array ( [0] => * ) [dates:protected] => Array ( ) [touches:protected] => Array ( ) [observables:protected] => Array ( ) [with:protected] => Array ( ) [morphClass:protected] => [exists] => 1 ) [1] => Author Object ( [table:protected] => authors [connection:protected] => [primaryKey:protected] => id [perPage:protected] => 15 [incrementing] => 1 [timestamps] => 1 [attributes:protected] => Array ( [id] => 2 [name] => Auhor 2 [bio] => bio 2 [created_at] => 2016-04-11 00:00:00 [updated_at] => 2016-04-11 00:00:00 ) [original:protected] => Array ( [id] => 2 [name] => Auhor 2 [bio] => bio 2 [created_at] => 2016-04-11 00:00:00 [updated_at] => 2016-04-11 00:00:00 ) [relations:protected] => Array ( ) [hidden:protected] => Array ( ) [visible:protected] => Array ( ) [appends:protected] => Array ( ) [fillable:protected] => Array ( ) [guarded:protected] => Array ( [0] => * ) [dates:protected] => Array ( ) [touches:protected] => Array ( ) [observables:protected] => Array ( ) [with:protected] => Array ( ) [morphClass:protected] => [exists] => 1 ) ) ) Please can you help me?
@Lamrinthapa
@Lamrinthapa 11 жыл бұрын
laravel is great but somewhere down the line, I think documentation should be more up to date... and too many changes in syntax with the previous laravel, hope that wouldnt be the case with upcoming laravel
@HafizAmeerHamza
@HafizAmeerHamza 9 жыл бұрын
Hi everyone..i am new here. friends this is my final year in computer science and i want to make a project in laravel...please give me some ideas for project, your suggestions & openion for my project...!!
@Lamrinthapa
@Lamrinthapa 11 жыл бұрын
For anyone who is annoyed with ... link_to_route. Replace it with linkRoute()
@nabaus6170
@nabaus6170 8 жыл бұрын
This is from 2012 ?
@whitemamba00
@whitemamba00 8 жыл бұрын
+Nab Aus yeah
@beamway317
@beamway317 9 жыл бұрын
хах ты разместил панельку как в ubuntu))
Laravel Tutorial Part 6 - CRUD - Creating with Eloquent
12:43
andrewperk
Рет қаралды 55 М.
Solving one of PostgreSQL's biggest weaknesses.
17:12
Dreams of Code
Рет қаралды 213 М.
бабл ти гель для душа // Eva mash
01:00
EVA mash
Рет қаралды 8 МЛН
Car Bubble vs Lamborghini
00:33
Stokes Twins
Рет қаралды 40 МЛН
Random Emoji Beatbox Challenge #beatbox #tiktok
00:47
BeatboxJCOP
Рет қаралды 63 МЛН
What’s Up with Laravel? It’s Everywhere, and Here’s Why!
6:22
This is the Only Right Way to Write React clean-code - SOLID
18:23
Советский мультфильм про нашу жизнь !
13:49
Дедушка Аргентинца
Рет қаралды 6 МЛН
Design patterns in React
14:37
Cosden Solutions
Рет қаралды 174 М.
Laravel Tutorial Part 1 - Installation and Configuration
8:28
andrewperk
Рет қаралды 302 М.
Laravel Tutorial Part 4 - Views, Blade, and Layouts
11:50
andrewperk
Рет қаралды 88 М.
Brutally honest advice for new .NET Web Developers
7:19
Ed Andersen
Рет қаралды 246 М.
Why aren't you using Fastify? Or Koa? Or NestJS?
9:58
Maximilian Schwarzmüller
Рет қаралды 64 М.
iPhone or Samsung?
0:18
ARSTANOTT
Рет қаралды 4,3 МЛН
Зачем вам нужен телефон?
0:31
Apros I
Рет қаралды 143 М.
Как подключить магнитолу?
0:51
KS Customs
Рет қаралды 1,9 МЛН
Rate ⭐ This Nokia Hole Phone with...
0:14
Shakeuptech
Рет қаралды 1,7 МЛН
Handy remote!
0:25
LeraKek
Рет қаралды 4,4 МЛН
Diode
0:16
ZS Electrical Work
Рет қаралды 4,7 МЛН