In laravel 5.3 there is no model available. Is it safe to work without model and write all the query in controller or how to work with it.
Please anyone help me out for this
You simply place your models in the app folder, in fact laravel will do this for you if you run:
php artisan make:model MyModel
It then gets namespaced to App. You should already have the User model in your App folder, which you can look at now you know where to find it. You don't need to (and shouldn't) put everything inside your controllers.
Related
So I'm finally taking this bull by the horns and moving from 3.4 to 4.x and one of the undocumented (?) steps is that previously, all my code was supposed to live in separate bundles per function on the site (at least this was recommended).
Now, suddenly all my code is expected to live inside one bundle (src) and I understand some already had this approach previously, using only the AppBundle with no subdirectories. Obviously this will mess things up when moving from several bundles into one. For one thing, there are several files called DefaultController.php (one per bundle, as I have a LogBundle, a FinanceBundle, a UserBundle etc.
Is there a nice guide to how this move is best made, what paths need to be changed where etc.? Seems like the symfony guys considered this a small little change and no reason to provide a step-by-step, I find it quite annoying 😐 or perhaps I'm just stupid 😂
According to this guide https://symfonycasts.com/blog/AppBundle no code changes are necessary, but my app breaks all over the place when moving files into another directory structure, I suspect routes to templates will need modification, routes to controllers etc.
It also seems that every single Entity relationship breaks when the path to the entity's php file changes...
Rewireing this is a major job, I don't understand why this isn't adressed anywhere?
And while the site referenced above mentions that up to 4.0 your own code resided in several bundles, it seemes that the sample code from sensiolabs silently changed from ACME/DemoBundle to AppBundle between versions 2.4 (https://github.com/symfony/symfony-standard/tree/2.4/src) and 2.5 (https://github.com/symfony/symfony-standard/tree/2.5/src) without any instruction to change your own directory structure to mimic that back then (https://symfony.com/doc/2.5/cookbook/upgrading.html).
So confused 😂
Currently my directory structure looks like this
So, I have inherited a Laravel 8 project from the previous developer who decided to leave for a greener pasture. And I see all this blade components everywhere, (x-this, x-that) and I have also created a few. I have used make:component command and I can see the components being generated both in `App/Views/' and 'resources/views'. That's great.
Now, there are other components, which the previous developer have created that I can't figure out where where these components are being registered at. They are not in the App directory, not in the service provider boot, there's no custom vendor in the composer.
So, I think the obvious question is, where else should I look for?
Those may be anonymous components. Anonymous components does not require any registration. So check resources/views/components folder.
For more info:
https://laravel.com/docs/8.x/blade#anonymous-components
There is a project in Symfony, who want to remake using MVC. The project has controllers and twig patterns , it is only necessary to fasten model.In which Symfony project directory to properly create model files ? Is there anything in Symfony tool allows to do it , rather than just to create these files and to connect them to the controller ?
Use Symfony standard edition as your starting point. If you try to make something own without prior experience with code organization in Symfony you will make it only worse.
https://github.com/symfony/symfony-standard
Standard edition above 2.8 version is pretty slim and doesn't force you to use everything if you don't need to.
If you need only "Model" classes then create them in src/AppBundle/Model and if you need Entities that will be persisted in database put them in src/AppBundle/Entity. Read about generation here http://symfony.com/doc/current/doctrine.html I will help you started
Decided to take a dive into recreating a website so that it's an ASP.NET MVC web application. We were originally using the Entity Framework for it, figured to still use it since it works nicely enough. When doing some reading, noticed the there is no such thing as the App_Code/ folder for MVC applications, and that most people were creating a class library for their needs like that. So what I ended up doing was creating my MVC application and a class library, both in the same solution, and the MVC application was referencing the class library. The class library has my EDMX Entity Data Model file in it since some of my classes reference it and I thought that it would be easiest to have it in the library to reference. So here is a picture to what my solution layout is. But when I build and run the website, I get an error on a page that would reference the Entity Data Model. Here is a picture of what the error is.
So I thought, what if I placed the EDMX into my models folder since the error looks like it's complaining about not finding the entities. Here's a picture of my solution now with the move. But now, I'm getting a different error (picture). I'm kind of at a loss as to where to go from here. Is the way I have everything laid out and designed the proper and most efficient way to do it? If not could someone give me some advice?
Thanks, it's really appreciated!
Yes, you should be able to have the edmx in a class library and reference if from your main project. The first error is likely due to an incorrect connection string (check this blog post) but you may also have changed the build action of the edmx file somehow, make sure it is "Entity Deploy".
The second error is probably because you copied the edmx from your class library into the Models folder and it is still referencing the old namespace. To fix that, open the edmx in designer view and click on the background. One of the properties in the property window is Namespace, make sure that's set to the new place you want to keep it.
Edit:
Some things to try:
Clean and rebuild the project
Delete the Temporary ASP.NET Files folder referenced in the error message
Double check your cshtml files for old references to URG_MVC.Models namespace. For example, the line in the error should be IEnumerable<URGLibrary.Proposal>
Right click the edmx file and select Run Custom Tool to regenerate the model files
I'm fairly new to Flex\AS3
I'm using flash builder 4.5 for php and I'm trying to connect to my DB via remote objects.
I'm following adobes instructions as listed here:
http://help.adobe.com/en_US/flex/accessingdata/WSbde04e3d3e6474c4-668f02f4120d422cf08-7ffe.html#WSbde04e3d3e6474c4-668f02f4120d422cf08-7ffa
I've created the php service, and successfully finished the wizard.
I've tested my service with the Test tool and it is indeed returning my results.
My problem is that it seems that flash builder didn't create the service's files(super+base) at all. For example, when I drag the service into a dropdown component I get an error saying that the service component can't be found.
Does anyone know this issue happens? how can the test tool work if the service classes don't exist?
Thanks in advance,
Ravid
The problem was that I didn't checkout the files before using the wizard so flash builder didn't have write permissions on the files and therefore didn't create the necessary files.
once he had the write permissions - everything worked just fine