Laravel

119

Solutions

137

Contributors

Laravel is a free, open-source PHP web application framework for the development of web applications following the model–view–controller (MVC) architectural pattern. Some of the features of Laravel are a modular packaging system with a dedicated dependency manager, different ways for accessing relational databases, utilities that aid in application deployment and maintenance, and its orientation toward syntactic sugar. Laravel is regarded as one of the most popular PHP frameworks.

Share tech news, updates, or what's on your mind.

Sign up to Post

screenshotI've got Laravel 6.6.0 running on my box. I do a new project and I go to my "resources" directory expecting to find "resources->js-assets->components->ExampleComponent.vue" and there's nothing there. All I have is "resources->js."

The idea that all this is coming pre-packaged comes from any one of a number of tutorials. Here's an example: https://www.youtube.com/watch?v=BoYQpwvKLuE&t=39s

When I do an "npm install," I get this (see screenshot)...

Notice how vue is referenced as "@vue." Not sure if that's indicative of a problem, but I there is no hierarchy and there's no "ExampleComponent.vue" and I'm thinking something is fouled up, but I don't know what.

Seems like all of this should in place by default and it's not. Why?
0
Bootstrap 4: Exploring New Features
LVL 19
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

I'm going through this tutorial: https://www.youtube.com/watch?v=DJ6PD_jBtU0

At one point the moderator says to run "npm run watch" and he gives a brief explanation as to what it is, but I still found myself scratching my head as to what it actually does. I went out online and didn't find a whole lot.

What does "npm run watch" actually do?
0
Hi All,

I have below code.

 public function destroy(ManageUserRequest $request, User $user)
    {
        $this->userRepository->deleteById($user->id);

           $user->email = $user->email . '_deleted';
        // $user->deleted_at = now();
        $user->save();

        event(new UserDeleted($user));

        return redirect()->route('admin.auth.user.deleted')->withFlashSuccess(__('alerts.backend.users.deleted'));
    }

Open in new window


 public function deleteById($id) : bool
    {
        $this->unsetClauses();

        return $this->getById($id)->delete();
    }

Open in new window


 protected function unsetClauses()
    {
        $this->wheres = [];
        $this->whereIns = [];
        $this->scopes = [];
        $this->take = null;

        return $this;
    }

Open in new window

 
What is the purpose of unsetClauses ?

Thank you.
0
I'm working through this tutorial: https://www.youtube.com/watch?v=DJ6PD_jBtU0

At one point, it asks you to do an "npm install" and you're loading up these dependencies:

  "devDependencies": {
        "axios": "^0.19",
        "cross-env": "^5.1",
        "laravel-mix": "^4.0.7",
        "lodash": "^4.17.13",
        "resolve-url-loader": "^2.3.1",
        "sass": "^1.15.2",
        "sass-loader": "^7.1.0",
        "vue-template-compiler": "^2.6.10"
    }

Not more than a couple of minutes later in the tutorial, it asks you to go to the "resources -> assets -> js -> components" directory and create a .vue file.

The folder doesn't exist. There is no "components" directory and I'm wondering, since the tutorial didn't specify creating it if perhaps something was supposed to happen when I did the "npm install."

I can obviously create it, but I'm new to Laravel and I'm wondering if the "vue-template-compiler" wasn't supposed to create that and something went wrong.

Does "assets ->js-components" get created when you load in the .vue dynamic? Or can I just create that myself and Laravel will know to refer to that when I start creating the .vue files?
0
I'm new to Laravel so forgive me if this question borders on something that should be painfully obvious...

I've downloaded a very impressive Bootstrap template for my Admin Suite.

It has a great number of features that I don't know if I'm going to need, but before I discard them completely, I wanted to make sure I wasn't overlooking something.

While the aesthetics are awesome, the functionality seems to be something that would have to come from a database of some kind. But there's nothing mentioned in the description and, I would think there should be. Even if it was a token statement that instructed developers on how to incorporate a MySQL database or something.

I probably won't use most of what's there. But I still wanted to get some other eyes on it so I wasn't overlooking something.

Bottom line: Is it assumed that there's going to be a database of some kind behind the GUI?

If so, why isn't it stated as such or am I just kind of slow?

Just wanting to make sure I'm not missing something.

Here's the URL: http://www.bootstrapdash.com/demo/star-admin-free/jquery/src/demo_1/index.html
0
I've got a fully functional Wordpress site on my server and I recently decided to add a Laravel site on the same server. Here's what my public_html folder looks like:

server screenshot
Notice the "nomas" directory. That's where all of the Laravel stuff is housed.

Right now, I'm getting a 500 error and I'm wondering if that might be due to the way in which Laravel seemingly assumes that they're the only player on a server.

Can I have both sites on the same server? Is that where the 500 error is coming from or is there something else?
0
I don't know if any of this makes a difference, but I'm still wet behind the ears when it comes to Laravel and I figured I would just go ahead an ask.

I've created a Laravel project and uploaded all the files (by hand) into a separate directory on my server.

Not sure if that makes any difference, but in case it does, I wanted to mention that. I've seen a couple of tutorials that specify the public_html folder and I don't have this app sitting in my root directory.

You can see what I'm looking at by going to http://brucegust.com/nomas.

What am I doing wrong and how do I fix it?
0
Hi All,

I use laravel. I want to update database using

$data = DB::connection('sqlsrv2')->statement('exec [spname] ?, ?',  [$empcode, $pwd])';

The response is ok, but it does not update database.

What is the problem?

Thank you.
0
Hi All,

I have application that created using laravel.
When idle the current screen still appear.
Could we set it back to login form at idle time is reached without user interference?

Thank you.
0
I'm working my way through a Laravel tutorial and it's going well.

I'm creating my migrations and doing my "seeding" and I understand THAT you have to use "composer dump-overload," what I don't understand is WHY.

Why is that a needful part of "seeding?" What's going on under the hood that "composer dump-overload" is necessary?

Thanks!
0
JavaScript Best Practices
LVL 19
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

Hi All,

I use laravel to show the screen format. See the attachment.

The problem is at the gadget. There is no scroll bar for filter part.
There is scroll bar for the chart part.

How to solve this problem?

Thank you.
GADGET-VIEW.jpeg
BROWSER-VIEW.PNG
0
Hi,
I'm using the below code as an example in Laravel 5.0 to retrieve a vehicle's history.
This works, but it seems like I'm not really utilizing laravel at all and doing it using a clunky curl setup.
Laravel 5 has a SoapClient I can include, but no clue how I'd utilize based on below.

the company I'm retrieving data from has a number of operations and a few ways to get the data ie: xml, json and soap1.2 (which is what I'm referencing).
https://partnerhub.pbsdealers.com/metadata

example below is: RepairOrderContactVehicleGet

Do you know of a better/simpler way I can utilize this API in Laravel 5?

I like the idea of the json one, but no idea how I'd use it. Or a better way of the soap approach.


		$username	= "myuser";
		$password	= "mypass";
		$pbs 		= 7111;
		
	$request = '
	<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
    <soap12:Body>
	<RepairOrderContactVehicleGet xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/PBS.PartnerHub.ServiceModel">
	<OpenDateSince>2017-01-01T00:00:00</OpenDateSince>
	<SerialNumber>'.$pbs.'</SerialNumber>
	<VehicleRef>a37cf36b-f756-4d18-bafe-7c90c750e794</VehicleRef>
	</RepairOrderContactVehicleGet>
	
	</soap12:Body>
	</soap12:Envelope>';


$requestURL ="https://partnerhub.dealers.com/soap12";
	$ch = curl_init();
	$header[] = "Content-type: 

Open in new window

0
Hi All,

I use coreUI template and laravel.
Is there any way to change the grid row height. Just  set once using blade. and it could be used for all page?

Thank you.
1
Hi All,

I have below display.
Please have a look at the image.
Is there possible to put the button at the same row with the data filter (drop down) ?

Thank you.
Arrange-Display.PNG
0
Im having trouble iterating through this nested array.

I cant seem to figure out how to reference the groups[] first value for each row. I'm trying to insert it into the GroupID column. For example the '2125a02a-f28e-11e4-ad33-89d58f4ed955' in the first one below would be the first GroupID

Looks like:

groups[2125a02a-f28e-11e4-ad33-89d58f4ed955]
0	4ec28c6a-6294-5329-fe01-57dc3228e4c2
1	a6a1f81f-33f1-79d8-3f61-5c8fb5e27e16

groups[24cd7e3c-f28e-11e4-ad33-89d58f4ed955]
0	4ec28c6a-6294-5329-fe01-57dc3228e4c2
1	364a7c59-da10-567d-268d-57dc323de111

groups[3efd3a5e-f28e-11e4-ad33-89d58f4ed955]
0	4e666186-4c18-eb53-c36a-5cebf8286305
1	4ec28c6a-6294-5329-fe01-57dc3228e4c2
2	a6a1f81f-33f1-79d8-3f61-5c8fb5e27e16

Open in new window


I'm iterating through it like:
foreach($groups as $group)
		{
			foreach($group AS $rep)
			{
				DB::table('connect_teams')->insert([
				'dealer_id'	=> $dealer_id,
				'UserId'	=> $rep,
				'GroupId'	=> how to get the $groups[currentvalue]??
				]);
		
			}
		}

Open in new window

any help would be much appreciated
0
I have a page (http://einsteinsolutions.xyz/chaminuka/public/home) that loads artwork images which are a lot. I am using Lazysizes (https://github.com/aFarkas/lazysizes) to lazyload the images in order to quicken the page load time and only display images that are in focus on the page.

The problem I am facing is that the images are being jumbled up (refer to attachment) together resulting in an undesired result. Please note that, I want to use the "non-responsive" option for this.

Code snippet
<script src="lazysizes.min.js" async=""></script> // include the lazysizes library

<!-- html extract -->
<div class="row">
    <div class="col-md-12">
        <ul class="grid effect" id="grid">
            @foreach($artworks as $artwork)
                @foreach(json_decode($artwork->photos) as $photo)
                <li>
                    <a class="fancybox" data-fancybox-group="gallery" title="{{ $artwork->name }}" href="{{ route('artwork_profile_path', ['artwork' => $artwork->slug]) }}">
                        <img class="lazyload" data-src="{{ asset($photo) }}" alt="" />
                    </a>
                </li>
                @endforeach
            @endforeach
        </ul>
    </div>
</div>

Open in new window

Untitled.jpeg
0
I am having issues installing Laravel, please see the pic, I need a guide on how to install it.

Thank you
Laravel.jpg
1
Hi Experts,

Need help in php laravel with an art gallery application.  We are setting up a private art collection online and taking high res professional images.  We have a laravel backend and can upload art, but content team is entering large images e.g. 24mb for one image.   In our front-end website gallery, we need to compress the uploaded images for web so they do not consume data.  When zoom on art, it is loading the 24mb file but we wish to compress to max 500kb per image regardless of size but dimensions remain the same.  Please help with how we can get this done as new to laravel and have basic php skills not used in a long time.

Thanks
0
Hi,
I'm sure its simply something obvious but I can't seem to figure it out:

I have a query in Laravel that I'm getting to retrieve all my users.

$users = DB::table('users')
      ->join('dealerships', 'users.dealership_id', '=', 'dealerships.id')
      ->join('roles', 'users.role_id', '=', 'roles.id')
      ->select('users.*','roles.*','dealerships.name')

Currently this returns all the users that are assigned to a dealership (records that have a value for users.dealership_id) . Problem is I need all the users regardless if a dealership has been assigned to them. I could skip the join, but I need the dealership name for those records that have a dealership assigned to them

if there someway to join the tables so I get all users and within my results also the dealership name for those that have one?



 Hope that makes sense. Thanks in advance.
0
Learn Ruby Fundamentals
LVL 19
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

I need to deploy AWS server for online test.
On my App I'm using PHP 7.2 , laravel and mysql as database,
The test is made of 10 questions with 5 true or false answers on each question.
The problem is because this online test is for about 4,000 students at the same time.
The test will be taken two times a month.
What's the better deploy and the better configuration for me.
0
I'm new to Laravel and I'm trying to figure this out.

I'm working through the tutorial at https://www.youtube.com/watch?v=v6SZerzfgIg.

My code right now looks like this:

Here's my "home.blade.php:"

<form action="/insert" method="Post">

Open in new window


My web.php page has my routes structured like this:

Route::get('/home', 'HomeController@index')->name('home');

Route::get('/display','InsertController@index');

Route::post('/insert', 'InsertController@add');

Open in new window


My InsertController looks like this:

use Illuminate\Http\Request;

class InsertController extends Controller
{
	
	public function display() {
		
	}
	
    public function add(Request $request) {
		
		add::display(Request::all());

	}
   
}

Open in new window


I'm thinking that "add::display(Request::all())" is targeting my "add" model sitting in my "app" directory. At that point, I've got this:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class add extends Model
{
    protected $fillable = ['question_text', 'keywords', 'required', 'type', 'answer_a', 'answer_b', 'answer_c', 'answer_d', 'answer_e'];
}

Open in new window


I'm wrong, apparently. Because when I submit my form, I get this error:

Class 'App\Http\Controllers\add' not found

What am I doing wrong? And am I right in assuming that this code:

add::display(Request::all());

...is going to submit my data and then grab the "display" method and show that page?

I'm a mess...

Straighten me out, please...
0
What is the cleanist way to make ajax calls on content that is dynamically generated? For example  i have a laravel controller that returns data organized into divs:

$counter = 1;
foreach($data_set as $data){
<div id="$counter" data-content="$id">$data</div>

$counter++
}

endforeach;

Open in new window


So if i return 3 results
<div id="1" data-content="45">$data</div>
<div id="2" data-content="66">$data</div>
<div id="3" data-content="22">$data</div>

Open in new window


Now i want to use an ajax call to drill further down into that data so i need an ajax call to grab the data-content field from id="1" which will then return me another subset of data

<div id="1" data-content="45">$data</div>
                       <div id="1a" data-content="45">$item</div>
                       <div id="1b" data-content="45">$item</div>
                       <div id="1c" data-content="45">$item</div>
<div id="2" data-content="66">$data</div>
<div id="3" data-content="22">$data</div>

Open in new window


What is the easiest way to do this with JAvascript if my ID's are being generated dynamically? Use a loop and a this keyword to get the array key of the element being clicked ?
0
I am having trouble finding out how to do routing with PHP.

I know WordPress and Laravel use it, but I was wondering how to code it.

I realize it would use Apache mod rewrite, but I'm having trouble figuring out how to do routing without a framework in PHP.
1
I'm starting a new web development project and have decided on using PHP with the latest version of the Laravel framework (currently v5.7). I'll likely be deploying to AWS, and will be using Amazon Aurora as the database engine (which is supposed to be MySQL compatible).  As I prepare to dive in, a few questions have come to mind that I'm hoping someone here can answer.  I'm relatively new to the Laravel framework, I must say, so I a apologize in advance for my ignorance.

1) What options are available to me for setting up a local development environment under Windows 10 Home Edition (64-bit)?  So far, I've read about using Vagrant/Homestead, (which sounds complicated and like it might require Windows 10 Professional) -- and also using WAMP, which I already have installed and running on my machine. By any chance, does some kind of pre-configured Virtual Box disk image exist anywhere that I could download and install that would simplify things for me?  

2) Is there anything important that I need to keep in mind (that's not so obvious) regarding the supposed MySQL compatibility of Amazon's Aurora database engine as I'm developing and/or deploying?  Can I safely treat Amazon's Aurora as a normal MySQL database engine, or are there any "gotchas" that I should be aware of such as driver compatibility, etc?

3) What's the most current trend regarding which templating system to use with Laravel? I know that it comes with the Blade templating engine, and I've heard some …
0
We´re providing online exam for ours members. The exam can be done in computer, tablet or smartphone. The exam have from 5 to 10 questions with 5 true or false afirmatives in each question. The exam have especific date, time and duration (20 minutes),  occurs quartely in all country, on centers with supervisors. The System use PHP language with laravel and Mysql. My question is if there´s any way to know if anyone during the exam copy the screen with the question and answer ? (like print scr button, or press three fingers on android screen)
0

Laravel

119

Solutions

137

Contributors

Laravel is a free, open-source PHP web application framework for the development of web applications following the model–view–controller (MVC) architectural pattern. Some of the features of Laravel are a modular packaging system with a dedicated dependency manager, different ways for accessing relational databases, utilities that aid in application deployment and maintenance, and its orientation toward syntactic sugar. Laravel is regarded as one of the most popular PHP frameworks.

Top Experts In
Laravel
<
Monthly
>