Laravel

112

Solutions

133

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

Hi,

I have added a function to enable or disable accounts. I have added a field 'login_enabled' to the user database. During login, I check if login is allowed or not:

// Override to only allow active accounts
    protected function credentials(Request $request)
    {
        return ['email' => $request->{$this->username()}, 'password' => $request->password, 'login_enabled' => 1];
    }

Open in new window


However, there is one loophole. If you do a reset password request, the user is able to do so, and will be logged in once after the reset.
So I need to block password reset for accounts where login_enabled = 0 in the DB. However, I can't find where this is done.
Any suggestions?

Thanks!
0
Starting with Angular 5
LVL 13
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

Hi All,

I have problem with queue laravel at windows server.
It does not run all the time.

How could I solve this problem ?

Thank you.
0
Hi All,

I have below code :

<?php

namespace App\Api\V1\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Mail;

date_default_timezone_set('Asia/Jakarta');

class ForgotPasswordEmailController extends Controller
{

    public function index(Request $request){
       $email = $request->email;
       //check email ke db atau sp
//       $user = User::where('email', $email)->first();
//       if ($user){
//            //jika user ditemukan
//            //kirim email
//           $this->sendEmail();
//           return response("Berhasil", 200);
//       }else{
//            //jika user tidak ditemukan
//           return response($email." tidak terdaftar", 403);
//       }

        //kirim email dengan parameter password yang sudah di ambil dari db/sp
        $this->sendEmail($email);
        return response()->json([
            'code' => "0",
            'message' => "Password sudah dikirim ke email anda. Silahkan buka email anda. Terimakasih"
        ]);
    }

    public function sendEmail($email){

       $this->pwd = str_random(8);

        Mail::send('sample-email', ["content" => $this->pwd], function($message) use ($email) {
            $message->to($email, 'Forgot Password')
                ->subject('Forgot Password');
                $message->from('bachmansabar@gmail.com','Nama Kamu');
        });



    }

    public function updateProfilePassword(Request $request)
    {
        $empcode = $request->input('empcode');
  

Open in new window

0
Hi All,

I am a newbie using API Laravel.

I have created below :
1. api.php at folder D:\SMIMobileESS\routes
     $api->get('email', 'App\\Api\\V1\\Controllers\\ForgotPasswordEmailController@email');

2. ForgotPasswordEmailController.php at folder D:\SMIMobileESS\app\Api\V1\Controllers

What else should I do in order to make it work when get called from anywhere?

Thank you.
1
Can any one tell me how to use stored procedure in Laravel
Step by step because I am not familiar with Laravel
So please help

Thank you
By Mohan Singh
0
Hi,
I have a file I'm retrieving via ftp in laravel from a 3rd party who provides it as pipe-delimited. I can get and store the file fine.. but I need to open it and convert the pipes to a comma-delimited file and save the changes.

Any idea how to accomplish this?

Small sample chunk of the file is:

ADID |CompanyID|CompanyName|Category |StockNumber|Vin |Status |Year |Make | Model |Trim |KMS |Exterior Color |Mfg Exterior Color | Interior Color | FuelType |Drive |Engine Size |Transmission |Doors |Passenger |Cylinder |Body |Price |HidePrice |Options |AdDescription | FinancingIsAvailable | FinancingPayment |FinancingPaymentType | FinancingNumberOfPayment |FinancingDownPayment | FinancingSource |FinancingType | FinancingOdometer |FinancingDescription |ManufactureProgram |Warranty |WarrantyDescription | MainPhoto |OtherPhoto|ModifiedDate|CreatedDate
43686979|20046119910706|Johns Volkswagen|"Sport Utility"|V59201PC...... 

Open in new window

0
Hello experts,

Need help with getting our feed to load the page quicker by loading artwork one at a time..it is a large feed and need better way of loading so it does not use a lot of data... http://www.einsteinsolutions.xyz/chaminuka/public/home. the page is loading art that is being uploaded..we have over 1000 artworks to upload but need a way of having an infinity scroll or lazy load that does not consume too much data on page load, and makes the page load slow.  Is they way to load each item in the array one by one like it is on pexels.com , and saving bandwidth.  Help here would be appreciated.
1
I have some complex queries with many joins i am using in a laravel project.
Currently all queries are in my controller which i want to refactor into a App\Queries namespace.

I am stuck on the app flow, would i call these queries from my model, or my controller directly?

would this be a correct structure?

<?php 
namespace App\Queries;
//App\Queries\GetClient;

class Client {

public function get($cID){

$client = DB::select( DB::raw("

select
client_id,
client_name,
client_phone,
client_address
from clients
where client_id = :cID"
), array("cID" => $cID));

return $client;

}

}

Open in new window


then how would i call this query from my controller/model?

<?PHP

//call from model ??
//call directly from controller??

public function show(Request $cID){

$client = new App\Queries\GetClient->get();

//return to view or what ever

}

Open in new window


does this make sense ? am i way off?
0
Hi,  

I am having a problem with Docker CE  (Docker version 18.09.1, build 4c52b90)

on Centos 7.  The problem is with MACVLAN Bridging I am trying to configure a MACVLAN bridge with a exclusion of 192.168.1.2 using the following code.

docker network create -d macvlan \
  --subnet=192.168.1.0/24 \
  --gateway=192.168.1.1  \
      --aux-address="router=192.168.1.2/24" \
   -o parent=enp0s3 pub_net

I get the error:  1Error response from daemon: Pool overlaps with other one on this address space
or no matching subnet for aux-address

When this is sorted out I would like to run this command:

docker run -p 8000:443/tcp  --rm -itd   --network pub_net   --name my_pub_net-alpine   alpine:latest   ash

does anyone know how to fix this problem or give me a workaround so I can forward ports for Nginx.

Kind regards

Justin
0
A program from laravel is sending Mail via smtp lotus notes, content of the body that includes image doesn't display the image at clients email, anyone had the same issue?
0
Amazon Web Services
LVL 13
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Swift_TransportException in F:\xampp\xampp\htdocs\GitLabTest\connect-export-web-100-industry-type-changes\textile\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\AbstractSmtpTransport.php line 383:
Expected response code 250 but got code "530", with message "530-5.5.1 Authentication Required. Learn more at
530 5.5.1 https://support.google.com/mail/?p=WantAuthError u7-v6sm8508148pfl.34 - gsmtp
"
0
I am using laravel eloquent to retrieve values from mysql database. The example return value below is below is retrieved from my browser:

{"cart":[{"id":1,unit_price":"0.01","total_price":0.01}]}

Open in new window


I notice that the attribute unit_price has a double quote where else the attribute id and total_price on the other hand has no double quote.

In your opinion is this acceptable? What could be the root cause of the result?

Please note that the attribute total price, its value is the result of multiplying two values. Example:

$cart['total_price'] = $variant->list_price * $cart['quantity'];

Open in new window


Your help is kindly appreciated.
0
The following is coded in Laravel framework:

QUERY

$shipping = DB::table('shipping')->where('country',$delivery->country)->first();
$data= json_decode(json_encode($shipping),true);

Open in new window


RESULT

array (
  'id' => 3,
  'carrier' => 'EN',
  'country' => 'AU',
  'rates_json' => '{"rates": [{"international": [{"zone4": [{"to_kg": "2", "total": "1", "from_kg": "1"}, {"to_kg": "4", "total": "2", "from_kg": "3"}]}]}]}',
)  

Open in new window


In MySQL database i stored rates_json in a json datatype column. The attribute from_kg and to_kg is a range.  

I intend to retrieve the total if a value is between the range. For instance, if value 1.5 is between  1 and 2 then the total is 1.

Your help is appreciated.

Thank You.
0
Hi.

I'm currently creating an application that is used for planning certain projects.

I'm running Laravel 5.7, with AdminLTE.

Currently I'm implementing the functionality to create projects and the basic CRUD functions that come along with them. Everything is working, but there's one small detail.

We assign hours per week to a project, but a project can last longer than one week, of course.

-----

What users do is they insert a start week, for example week 40 and an end week, for example week 45.

What I want to do is the following: Have a button / link below the weeks that says "Assign hours".

When that button / link is clicked, there should be a number of inputs that pop up, corresponding to the number of weeks.

For example: Start week = 40, end week = 43, I should get 4 inputs.

----

However, I have no clue how to do this since I am not familiar with JavaScript or jQuery.

The second issue is: how would I store this in a database?

I was thinking about creating a seperate table named 'project_hours' or something like that which contains the week number, project number, user id and the assigned hours for that week. How would I loop through the set of inputs thats always a different number to store them in my db?

Any help is appreciated.

I have this create view:

@extends('adminlte::page')

@section('title', 'AdminLTE')

@section('content_header')
@stop

@section('content')
	@include('inc.messages')
	<div class="box 

Open in new window

0
How to generate CSV file and send an email as an attachment of that csv file in laravel?
1


I have so for been updating the data. Now when some lecturer writes say, completed in the comments section and checks completed radio button. Now next time when the same teacher checks it then it must show that the sub/chap has been completed. So how to do that in angularjs and php? Any help would be appreciated. Please do help me i am stuck.
0
one thing I want you to share your thoughts on how we can go ahead with the rebuilding of a website. What are the things according to you should be implemented on the website?
we would like to rebuilding of this site using  Angular 4 and Laravel 5
0
Hi,

My manager asked me updating a website from codeigniter to  
backend: API using PHP (Symfony) or node (expressjs) or Drupal 8 . or any other framework. can you give me explanations?

And for single page applications Angular 4 or Vue js
0
I have two separate application built mainly using angularjs and  laravel.

1) Front office
2) Back office

The authentication method is Laravel passport.

The problem I am encountering is when I login to both front and back office. Then when I logout from either the front or back office app both application get logout.

This is happening when I'm using  the same browser with multiple tabs.

Are there implementable solutions to the mentioned problem.

Your help is kindly appreciate.
0
Build an E-Commerce Site with Angular 5
LVL 13
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

I have successfully implemented PayPal payment gateway integration into my Laravel e-commerce web application.  However I am still trying to find out if suppose the following scenario happens then how does the recovery take place.

1) The E-commerce app sends details to PayPal
2) The E-Commerce app +/ hosting encounters a problem
3) PayPal send a response to the E-commerce app
     * next course of action is for the E-commerce app to process the response and update the order status. (i.e. Pending to Paid)

However since the app +/ hosting is down then how do we identify which order encountered a problem at that point of time and recover the order status. Is there a PayPal api that help to achieve this?

Your help is kindly appreciated.

Thank You.
0
using laravel 5.6 only( latest version)Creating a webpage with a form that has the following text input fields: Product name, Quantity in stock, Price per item. The submitted data of the form should be saved in an XML / JSON file with valid XML / JSON syntax. Underneath of the form, the web page should display all of the data which has been submitted in rows ordered by date time submitted, the order of the data columns should be: Product name, Quantity in stock, Price per item, Datetime submitted, Total value number. The "Total value number" should be calculated as (Quantity in stock * Price per item). The last row should how a sum total of all of the Total Value numbers. Solution requirements: Use Php / Html / Javascript / Css. Use Twitter Bootstrap. The form should be submitting the data and updating the data being displayed on the page using Ajax. Thanks in advance.
0
can I deploy laravel project without need to install composer into godaddy ?!!
I can't access through SSH , is their another way to work with that .

I start to learn laravel, and in my local machine work fine, I try to deploy at godaddy, most of tutorial need ssh to remotely access and install composer as far as my understanding, and type command line codes to sort things out .

Found a tutorial at youtube allowed me to work laravel without composer, which worked but I couldn't make 404 page work , neither other viewer pages.


working link : http://stchrisapp.com/youtube/
not working 404 page as should be : http://stchrisapp.com/youtube/404   ' it keep show standard godaddy 404 page :( , even if i create other page do same .

I am deploy from windows to Linux server
0
I want to display message with ajax  :
but i have this error in the console :
Cannot use 'in' operator to search for 'length' in L'email ou le mot de passe est incorrect.

Function Ajax
<script type="text/javascript">
   $(document).ready(function() {
        $(".login-btn").click(function(e){
             e.preventDefault();


            var _token = $("input[name='_token']").val();
            var email = $("input[name='email']").val();
            var password = $("input[name='password']").val();


            $.ajax({
                url: "/login",
                type:'POST',
                cache: false,
                data: {_token:_token,email:email, password:password},
                dataType: "json",
                success: function(data) {
                    if($.isEmptyObject(data.error)){
                        window.location = 'home';
                    }else{
                        // $(".print-error-msg").find("ul").html('');
                        // $(".print-error-msg").css('display','block');
                        // $.each( data, function( key, value ) {
                        //     $(".print-error-msg").find("ul").append('<li>'+data.error+'</li>+');
                        // });
                        printErrorMsg (data.error);

                    }
                },
                error: function(response){
                    $(".print-error-msg").find("ul").html('');
                    

Open in new window

0
We are currently running a laravel 5.3 site using php 5.6 and would like to use caffeine for those users who insist on leaving forms open  on their devices for extended periods of time.
Unfortunately, it seems that the only version of caffeine I can find to install requires php 7.0, which we will not be prepared to upgrade to for some time.
Does anyone have a workaround?
Thanks!
0
We need a website for offering jobs and recruitment just like this one https://www.bayt.com
there are different ways to do that. we can develop our own frame work for it or we can use open source for the backend and maybe tamplates for the front end.
I want you to analyse this project requirements .
Please help me to find the requirements for this project.
0

Laravel

112

Solutions

133

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
>