AwadGorg

AwadGorg

Member Since 1 Year Ago

Experience Points
3,620
Total
Experience

1,380 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
0
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 1
3,620 XP
Sep
23
2 days ago
Activity icon

Replied to How Can I Print The Session Key And Value In The Screen

am making filter system with multi select or check box the user can check box1 and search with it and the the user check box2 now it should search with box 1 and box2

the way I've decided to make it is when the user clicks on box1 it send get request with ajax that holds the row name that the user want to search in and the id (value) and use the selector and the id to search in the db table and return result to the user, then when the user check box2 it also save the selector and the id of box2 in a session, I want to use the session key in this case its the table row and the session value the id, to search for both box1 and box2, here is part of my code hope it will make it more clear

$(document).ready(function(){
    $(".genral").click(function(){
        
        $("#overlay").fadeIn(300); 
        var elmId = $(this).attr("id");
            var livesearchVal = $("#livesearch").val();
            var types = $(this).attr("data-type");
            var selector = $(this).attr("data-uniqe");
        console.log(url + 'hey');
        $.ajax({
            
            type: 'GET',
            url: "/ajax/genaral_specializations2.php?id="+elmId+'&term='+livesearchVal+'&types='+types+'&selector='+selector,
            success: function(data){
               $("#paginate_books").html(data);
               $("#overlay").fadeOut(300); 
            }
        });
    });
});

var elmid = the value of the checkbox, var term = it's the search term that user entered in the input text (not important) var types = (not important) var selector = the table row name for example (table cast row name),

below is part of the controller controller

        $gen_spci_no = $_GET['id'];
        $table_uniqe = $_GET['selector'];
        session()->put($table_uniqe, $gen_spci_no);
        $input = collect($filter_sessions)->filter(function($value) {
            return null !== $value;
})->toArray();

like you see above I put the new session box2 alongside box1 I already know all the session names so am gonna loop throw them and get the once that already been set and assign them to the $input array this array should hold the session key and name like this

$input = array($sessionkey => $sessionval);
Sep
22
3 days ago
Activity icon

Started a new Conversation How Can I Print The Session Key And Value In The Screen

Hello, I've set a session key and value and then print to the screen session()->get(keyname); and this only return to me the keyname value and i want both to be returned cuz both of them are dynamic and am using them both to make another action does there anyway that i can get the session key and value,

what i want is to use them in where clause to get data from database

Sep
19
6 days ago
Activity icon

Replied to Illuminate\Database\QueryException SQLSTATE[HY000] [2002] No Such File Or Directory

Sounds interesting, you mean going through every file to see what really caused the problem. Will do and let you know will be fun 🤗

Activity icon

Replied to Illuminate\Database\QueryException SQLSTATE[HY000] [2002] No Such File Or Directory

Nope i didn't setup any models or migration i used DB to retrieve data from database in the new project and tried to copy database.php to the old one and also didn't work hill i even replaced the .env file to but also didn't work, so I've decided to move my files to the new project

Activity icon

Replied to Illuminate\Database\QueryException SQLSTATE[HY000] [2002] No Such File Or Directory

I've download a fresh laravel app and used one of the controllers at the one that didn't work the same controller and it worked fine?

Activity icon

Replied to Illuminate\Database\QueryException SQLSTATE[HY000] [2002] No Such File Or Directory

no there only cache folder and app.php file

everthing looks fine to me to the but nothing works I've had this problem since yesterday and I've been googling yet since then didn't find anything to help me fix the issue.

am using xampp running it through sudo /opt/lampp/lampp start and before running this code i run sudod /etc/init.p/apache2 stop to stop the apache2 to and then doing lampp start and it give me success mysql server opended and apache opend and tried to open phpmyadmin it opened fine and when i route to a file that doesn't get data from the db also works fine the db name in .env file is correct checked that like million time, am out of ideas

Activity icon

Replied to Illuminate\Database\QueryException SQLSTATE[HY000] [2002] No Such File Or Directory

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=ovongames
DB_USERNAME=root
DB_PASSWORD=
Activity icon

Replied to Illuminate\Database\QueryException SQLSTATE[HY000] [2002] No Such File Or Directory

did so and cleared the cache till the same problem

Activity icon

Replied to Illuminate\Database\QueryException SQLSTATE[HY000] [2002] No Such File Or Directory

<?php

use Illuminate\Support\Str;

return [

    /*
    |--------------------------------------------------------------------------
    | Default Database Connection Name
    |--------------------------------------------------------------------------
    |
    | Here you may specify which of the database connections below you wish
    | to use as your default connection for all database work. Of course
    | you may use many connections at once using the Database library.
    |
    */

    'default' => env('DB_CONNECTION', 'mysql'),

    /*
    |--------------------------------------------------------------------------
    | Database Connections
    |--------------------------------------------------------------------------
    |
    | Here are each of the database connections setup for your application.
    | Of course, examples of configuring each database platform that is
    | supported by Laravel is shown below to make development simple.
    |
    |
    | All database work in Laravel is done through the PHP PDO facilities
    | so make sure you have the driver for your particular database of
    | choice installed on your machine before you begin development.
    |
    */

    'connections' => [

        'sqlite' => [
            'driver' => 'sqlite',
            'url' => env('DATABASE_URL'),
            'database' => env('DB_DATABASE', database_path('database.sqlite')),
            'prefix' => '',
            'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
        ],

        'mysql' => [
            'driver' => 'mysql',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'prefix_indexes' => true,
            'strict' => false,
            'engine' => null,
            'options' => extension_loaded('pdo_mysql') ? array_filter([
                PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
            ]) : [],
        ],

        'pgsql' => [
            'driver' => 'pgsql',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '5432'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'charset' => 'utf8',
            'prefix' => '',
            'prefix_indexes' => true,
            'schema' => 'public',
            'sslmode' => 'prefer',
        ],

        'sqlsrv' => [
            'driver' => 'sqlsrv',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST', 'localhost'),
            'port' => env('DB_PORT', '1433'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'charset' => 'utf8',
            'prefix' => '',
            'prefix_indexes' => true,
        ],

    ],

    /*
    |--------------------------------------------------------------------------
    | Migration Repository Table
    |--------------------------------------------------------------------------
    |
    | This table keeps track of all the migrations that have already run for
    | your application. Using this information, we can determine which of
    | the migrations on disk haven't actually been run in the database.
    |
    */

    'migrations' => 'migrations',

    /*
    |--------------------------------------------------------------------------
    | Redis Databases
    |--------------------------------------------------------------------------
    |
    | Redis is an open source, fast, and advanced key-value store that also
    | provides a richer body of commands than a typical key-value system
    | such as APC or Memcached. Laravel makes it easy to dig right in.
    |
    */

    'redis' => [

        'client' => env('REDIS_CLIENT', 'phpredis'),

        'options' => [
            'cluster' => env('REDIS_CLUSTER', 'redis'),
            'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
        ],

        'default' => [
            'url' => env('REDIS_URL'),
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', 6379),
            'database' => env('REDIS_DB', 0),
        ],

        'cache' => [
            'url' => env('REDIS_URL'),
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', 6379),
            'database' => env('REDIS_CACHE_DB', 1),
        ],

    ],

];

Activity icon

Started a new Conversation Illuminate\Database\QueryException SQLSTATE[HY000] [2002] No Such File Or Directory

Hello, am having this error

Illuminate\Database\QueryException
SQLSTATE[HY000] [2002] No such file or directory

evertime i try to run my project I recently moved from windows to linux everything was working fine on my windows machine but now it shows the error above

things I've tried to do

run composer update | didn't solve the problem
run composer require doctrine/dbal | also didn't work
run apt install php-mysql | also didn't work
and run php -m  | and it listed pdo 

am running php v 7.4.3

Aug
09
1 month ago
Activity icon

Started a new Conversation Is Currently Unable To Handle This Request. On Form Post Submit

Hello, I have this login system that works with no issues on my localhost but when uploaded to the server it returns an error collage-clinic.epizy.com is currently unable to handle this request. could it be cuz of hosting cuz am using infinityfree anyway that's the code

<?php
/*
 * Tutorial: PHP Login Registration system
 *
 * Page index.php
 * */

// Start Session
session_start();
include '../db.php';
// Application library ( with DemoLib class )
require __DIR__ . '/../functions/register.php';
$app = new DemoLib();

$login_error_message = '';
$register_error_message = '';

// check Login request
if (!empty($_POST['btnLogin'])) {

    $log_email = trim($_POST['log_email']);
    $log_password = trim($_POST['log_password']);

    if ($log_email == "") {
        $login_error_message = 'البريد الالكتروني ضروري';
    } else if ($log_password == "") {
        $login_error_message = 'كلمة السر ضرورية';
    } else {
      $app->init();
        $user_id = $app->Login($log_email, $log_password, 'students'); // check user login
        die($user_id);
        if($user_id > 0)
        {
            $_SESSION['id'] = $user_id; // Set Session
            header("Location: ../profile/user.php"); // Redirect user to the profile.php
        }
        else
        {
            $login_error_message = 'Invalid login details!';
        }
    }
}

and this

public function Login($email ,$password, $table)
    {
        try {
            die('dxvm,d');
            $db = DB();
            if ($table == 'students') {
              $role = 1;
              die($db);
              $query = $db->prepare("SELECT id FROM users WHERE
                email=:email AND password=:password AND role = :role");
            }elseif ($table == 'doctors') {
              $role = 2;
              $query = $db->prepare("SELECT id FROM users WHERE
                email=:email AND password=:password AND role = :role");
            }

            $query->bindParam(":email", $email);
            $query->bindParam(":role", $role, PDO::PARAM_INT);
            $enc_password = hash('sha256', $password);
            $query->bindParam(":password", $enc_password);

            $query->execute();
            if ($query->rowCount() > 0) {
                $result = $query->fetch(PDO::FETCH_OBJ);
                return $result->id;
            } else {
                return false;
            }
        } catch (PDOException $e) {
            exit($e->getMessage());
        }
    }
Aug
08
1 month ago
Activity icon

Started a new Conversation How To Code Date Time Booking System In Pure Php

Hello, I started to build a booking system just for the purpose of learning and all of the tutorials that I found online only shows you how to make one using only dates booking using date only there is no time like I want to book for an appointment at Sunday 9 pm not just Sunday how can I do that, and thanks

Aug
07
1 month ago
Activity icon

Started a new Conversation Problem With Booking System

Hello, I am creating a booking system and I get stuck on this issue when the user book for an appointment on a doctor he/she can cancel there appointment and am using this code for that

private function bookedCell($date)
    {
      $db = DB();
      $user_id = $_SESSION['id'];
      // check if this user made the booking
      $query = $db->prepare('SELECT id FROM bookings WHERE student_id = :id');
      $query->bindParam('id', $user_id, PDO::PARAM_INT);
      $query->execute();
      if ($query->rowCount() > 0) {
        $res = $query->fetchAll();
        return '<div class="booked">' . $this->deleteForm($this->bookingId($date)) . '</div>';
      }
    }

I want to show the cancel button to the users who made the booking but now the delete button is shown for everyone

Jul
17
2 months ago
Activity icon

Replied to Play Video On Hover Using Javascript

I've been trying using jquery but the video not starting when I hove over the container here is the code I've tried

<div class="img-wh m-center" id="parent-{{ $game->g_page_link }}">
					<a href="/browser-game/{{ $game->g_page_link }}" title="Play {{$game->g_name}}">
						<picture id="img-{{ $game->g_page_link }}">
						  <source media="(max-width: 990px)" data-srcset="{{ asset('storage/browsergames-images/'.$game->g_page_link.'/sm_'. $game->g_main_img) }}" class="w-100 h-100 m-center lazy">
						  <source media="(min-width: 991px)" data-srcset="{{ asset('storage/browsergames-images/'.$game->g_page_link.'/'. $game->g_main_img) }}" class="w-100 h-100 m-center lazy">
                          <img data-src="{{ asset('storage/browsergames-images/'.
                          $game->g_page_link.'/backup_'. $imgName.'.jpg') }}"
                           class="w-100 h-100 m-center lazy rounded"
                            alt="{{ $game->g_name }} Browser Game" title="Play {{ $game->g_name }} Now">
						</picture>
						<video loop preload="none" muted id="vid-{{ $game->g_page_link }}">

						</video>
						<script>
							$(document).ready(function(){
								videoFile = "{{asset('a.mp4')}}";
								$("#parent-{{ $game->g_page_link }}").on('mouseenter', function(){
									$("#vid-{{ $game->g_page_link }}").attr('src', videoFile);
									$("#img-{{ $game->g_page_link }}").addClass('d-none');
									
								});
							});
						</script>
					</a>
				</div>
Activity icon

Started a new Conversation Play Video On Hover Using Javascript

Hello, I want to do hover effect on the image when the user hovers on the image it hide the image and play a small video in the same place of the image and there is an example below before the hover on the image

<div class="col-12">
<a href="somewhere.help">
<img data-src="some-img.png"
                           class="w-100 h-100 m-center lazy rounded">
<video src=""></video>
</a>
</div>

and after the hover

<div class="col-12">
<a href="somewhere.help">
<img data-src="some-img.png"
                           class="d-none">
<video src="somevideo.mp4" class="w-100 h-100 m-center lazy rounded"></video>
</a>
</div>

and the video should autoplay on mouseenter and on mouseleave the video goes to display none and the original image get shown back

how can I do this using pure javascript and thanks a lot for your help

May
19
4 months ago
Activity icon

Replied to Sending Mails Using Laravel Mailable In Roundcube Mails

it was just mistyping from my end already update the question with the currect value

Activity icon

Started a new Conversation Sending Mails Using Laravel Mailable In Roundcube Mails

hello, am building this contact us system and my hosting has provided me with Roundcube as my mail client and they provided me with this info

Username:	[email protected]
Password:	Use the email account's password.
Incoming Server:	mail.mnstalryadh.com
IMAP Port: 993 POP3 Port: 995
Outgoing Server:	mail.mnstalryadh.com
SMTP Port: 587 
IMAP, POP3, and SMTP require authentication.

and this is the .env file

MAIL_DRIVER=smtp
MAIL_HOST=mail.mnstalryadh.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=*************
MAIL_ENCRYPTION=null

and this is the error am getting from the browser

Swift_TransportException
Connection to mail.mnstalryadh.com:587 Timed Out
May
17
4 months ago
Activity icon

Replied to Limit User Activate Peer Day

thanks mate this fixed my issue thanks a lot

$store = auth('admin')->user()->vendor;
if ($store->type == 1) {
      if (Product::where('vendor_id', $store->id)->whereDate('created_at', $current_date)->count() >= 3) {
      	return $this->responseRedirectBack('لقد وصلت الى الحد المسموح بة للمنتجات ليوم واحد ارجا الانتظار الى يوم غد او تحديث الاشتراكك الى النسخة الذهبية حيث عدد المنتجات المسموح بها يوما اكثر او يمكنك التحديث الى الحزمة
        البلاتينية حيث عدد المنتجات لليوم غير محدود ةالعديد من الميزات الاخرى للمزيد الرجاء الاتصال بنا عبر البريد او رقم الهاتف', 'error', true, true);
      }
    }elseif($store->type == 2){
      if (Product::where('vendor_id', $store->id)->whereDate('created_at', $current_date)->count() >= 20) {
      	return $this->responseRedirectBack('لقد وصلت الى الحد المسموح بة للمنتجات ليوم واحد ارجا الانتظار الى يوم غد او تحديث الاشتراكك الى النسخة الذهبية حيث عدد المنتجات المسموح بها يوما اكثر او يمكنك التحديث الى الحزمة
        البلاتينية حيث عدد المنتجات لليوم غير محدود ةالعديد من الميزات الاخرى للمزيد الرجاء الاتصال بنا عبر البريد او رقم الهاتف', 'error', true, true);
      }
    }
May
15
4 months ago
Activity icon

Started a new Conversation Limit User Activate Peer Day

Hello, I want to make this limitation system for a multi-vendor store I want to allow free vendor account to be able to upload 3 products per day let's say that today is 15/05/2020 and the user already uploaded 3 products to the site and tried to upload the fourth product it should return an error that you already reach your range, now all of my products are linked to a specific vendor with vendor_id, and also all product has created_at row I want to count all products that been uploaded today by this vendor using vendor_id of course and if the result of the count is 3 return an error else upload the product.

now how can I change the above logic to code and thanks a lot for the help

May
06
4 months ago
Activity icon

Replied to Set Data Return From Foreach Loop To An Array

cuz I want the user to be able to filter data using more than one category but changed my mind now i just made it filter with only one category

May
05
4 months ago
Activity icon

Started a new Conversation Set Data Return From Foreach Loop To An Array

Hello, I want to build this filtering system and I have a problem, this is the code am, using

foreach ($request as $key => $cat_id) {
        $getProducts = Product::leftjoin('product_categories','product_categories.product_id', 'products.id')
        ->where('product_categories.category_id', $cat_id)->select('products.*')->paginate(20);
        $filteredProducts[] = $getProducts;
      }
      return $filteredProducts;

right now the becouse am using laravel elqouent it return an error

Undefined property: Illuminate\Pagination\LengthAwarePaginator::$images 

like with the code above laravel elqouent not working, so I've changed it to this

foreach ($request as $key => $cat_id) {
        $getProducts = Product::leftjoin('product_categories','product_categories.product_id', 'products.id')
        ->where('product_categories.category_id', $cat_id)->select('products.*')->paginate(20);
      }
      return $getProducts;

with the code right above the Undefined property error is fixed but now it only returns only one element from the foreach, how can i fix this if i choose to use joins i will have to make so many joins to replace elqouent is there anyway that I can do this without returning to joining tables cuz there are many tables, and thanks for the help.

Apr
30
4 months ago
Activity icon

Replied to How To Make A Bank Transfer System In Laravel

am using stripe I want to build multi vendors store and want the money to go to the store owner when a customer buys from his store

Apr
28
4 months ago
Activity icon

Started a new Conversation How To Make A Bank Transfer System In Laravel

Hello, I want to ask if there any laravel library or extension that's all making banking transfer cuz am working on eCommerce website and i want to make bank transfer as a way of paying. and thanks

Apr
22
5 months ago
Activity icon

Started a new Conversation Get Data From A Database Table If This Data Doesn't Have A Value On Other Table

Hello, I have 2 tables vendors table and admins table the vendor table is linked with the admin table with every vendor have an admin I want to show admins that haven't been assigned to a vendor yet, get all admins that don't have a row on the vendor's table there is a row on the vendor table called admin_id that links the vendor to an admin, hope I made it clear and thanks for your help

Apr
21
5 months ago
Activity icon

Replied to Can't Get The Id Of The User Logged In From The Admin Table Using Auth

thanks, mate now everything is working perfectly

Apr
20
5 months ago
Activity icon

Started a new Conversation Can't Get The Id Of The User Logged In From The Admin Table Using Auth

Hello I have admin table other than the user's table and to avoid any conflict I edited the auth.php file like this

'guards' => [
        'web' => [
            'driver' => 'session',
            'provider' => 'users',
        ],

        'api' => [
            'driver' => 'token',
            'provider' => 'users',
            'hash' => false,
        ],
        'admin' => [
            'driver' => 'session',
            'provider' => 'admins',
        ],

        'admin-api' => [
            'driver' => 'token',
            'provider' => 'admins',
            'hash' => false,
        ],
    ]

and

'providers' => [
        'users' => [
            'driver' => 'eloquent',
            'model' => App\Models\User::class,
        ],
        'admins' => [
            'driver' => 'eloquent',
            'model' => App\Models\Admin::class,
        ],

        // 'users' => [
        //     'driver' => 'database',
        //     'table' => 'users',
        // ],
    ],

and

'passwords' => [
        'users' => [
            'provider' => 'users',
            'table' => 'password_resets',
            'expire' => 60,
            'throttle' => 60,
        ],
        'admins' => [
            'provider' => 'users',
            'table' => 'password_resets',
            'expire' => 60,
            'throttle' => 60,
        ],
    ],

now i need the admin user id to asign it to one of my other tables but i couldn't get the id when i used

 $vendor_admin_id = Auth::user()->id;

nor

 $vendor_admin_id = Auth::admin()->id;

nor

 $vendor_admin_id = Auth::id();

all of the above didn't work this is my login controller

<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Auth;
class LoginController extends Controller
{
    use AuthenticatesUsers;

    /**
     * Where to redirect admins after login.
     *
     * @var string
     */
    protected $redirectTo = '/admin';

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest:admin')->except('logout');
    }

    /**
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function showLoginForm()
    {
        return view('admin.auth.login');
    }
    /**
     * @param Request $request
     * @return \Illuminate\Http\RedirectResponse
     * @throws \Illuminate\Validation\ValidationException
    */
    public function login(Request $request)
    {
        $this->validate($request, [
            'email'   => 'required|email',
            'password' => 'required|min:6'
        ]);
        if (Auth::guard('admin')->attempt([
            'email' => $request->email,
            'password' => $request->password
        ], $request->get('remember'))) {
            return redirect()->intended(route('admin.dashboard'));
        }
        return back()->withInput($request->only('email', 'remember'));
    }
    /**
     * @param Request $request
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function logout(Request $request)
    {
        Auth::guard('admin')->logout();
        $request->session()->invalidate();
        return redirect()->route('admin.login');
    }
}

please help :)

Apr
19
5 months ago
Activity icon

Replied to Can't Reach The Components File To Print Changes On Screen

didn't get what you're trying to say as I said am learning can you explain more well be more than great and helpful for me to know where is my error and thanks for replying to my Question :)

Activity icon

Replied to Can't Reach The Components File To Print Changes On Screen

now it's given me this error after I deleted everything and wrote the code again from the begging

app.js:20698 [Vue warn]: Error compiling template:

Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <script>, as they will not be parsed.

71 |              </div>
72 |          </div>
73 |      </div>
   |             
74 |  <script src="http://localhost:8000/backend/js/app.js"></script></main>
   |  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

(found in <Root>)
warn @ app.js:20698
(anonymous) @ app.js:31766
compileToFunctions @ app.js:31765
./node_modules/vue/dist/vue.common.dev.js.Vue.$mount @ app.js:31989
Vue._init @ app.js:25076
Vue @ app.js:25142
./resources/js/app.js @ app.js:32171
__webpack_require__ @ app.js:20
0 @ app.js:32254
__webpack_require__ @ app.js:20
(anonymous) @ app.js:84
(anonymous) @ app.js:87
app.js:20698 [Vue warn]: Unknown custom element: <attribute-values> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

(found in <Root>)
Activity icon

Replied to Can't Reach The Components File To Print Changes On Screen

Yes

@extends('admin.app')
@section('title') {{ $pageTitle }} @endsection
@section('content')
    <div class="app-title">
        <div>
            <h1><i class="fa fa-cogs"></i> {{ $pageTitle }}</h1>
        </div>
    </div>
    @include('admin.partials.flash')
    <div class="row user">
        <div class="col-md-3">
            <div class="tile p-0">
                <ul class="nav flex-column nav-tabs user-tabs">
                    <li class="nav-item"><a class="nav-link active" href="#general" data-toggle="tab">General</a></li>
                    <li class="nav-item"><a class="nav-link" href="#values" data-toggle="tab">Attribute Values</a></li>
                </ul>
            </div>
        </div>
        <div class="col-md-9">
            <div class="tab-content">
                <div class="tab-pane active" id="general">
                    <div class="tile">
                        <form action="{{ route('admin.attributes.update') }}" method="POST" role="form">
                            @csrf
                            <h3 class="tile-title">Attribute Information</h3>
                            <hr>
                            <div class="tile-body">
                                <div class="form-group">
                                    <label class="control-label" for="code">Code</label>
                                    <input
                                        class="form-control"
                                        type="text"
                                        placeholder="Enter attribute code"
                                        id="code"
                                        name="code"
                                        value="{{ old('code', $attribute->code) }}"
                                    />
                                </div>
                                <input type="hidden" name="id" value="{{ $attribute->id }}">
                                <div class="form-group">
                                    <label class="control-label" for="name">Name</label>
                                    <input
                                        class="form-control"
                                        type="text"
                                        placeholder="Enter attribute name"
                                        id="name"
                                        name="name"
                                        value="{{ old('name', $attribute->name) }}"
                                    />
                                </div>
                                <div class="form-group">
                                    <label class="control-label" for="frontend_type">Frontend Type</label>
                                    @php $types = ['select' => 'Select Box', 'radio' => 'Radio Button', 'text' => 'Text Field', 'text_area' => 'Text Area']; @endphp
                                    <select name="frontend_type" id="frontend_type" class="form-control">
                                        @foreach($types as $key => $label)
                                            @if ($attribute->frontend_type == $key)
                                                <option value="{{ $key }}" selected>{{ $label }}</option>
                                            @else
                                                <option value="{{ $key }}">{{ $label }}</option>
                                            @endif
                                        @endforeach
                                    </select>
                                </div>
                                <div class="form-group">
                                    <div class="form-check">
                                        <label class="form-check-label">
                                            <input class="form-check-input"
                                                   type="checkbox"
                                                   id="is_filterable"
                                                   name="is_filterable"
                                                {{ $attribute->is_filterable == 1 ? 'checked' : '' }}/>Filterable
                                        </label>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="form-check">
                                        <label class="form-check-label">
                                            <input class="form-check-input"
                                                   type="checkbox"
                                                   id="is_required"
                                                   name="is_required"
                                                {{ $attribute->is_required == 1 ? 'checked' : '' }}/>Required
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="tile-footer">
                                <div class="row d-print-none mt-2">
                                    <div class="col-12 text-right">
                                        <button class="btn btn-success" type="submit"><i class="fa fa-fw fa-lg fa-check-circle"></i>Update Attribute</button>
                                        <a class="btn btn-danger" href="{{ route('admin.attributes.index') }}"><i class="fa fa-fw fa-lg fa-arrow-left"></i>Go Back</a>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="tab-pane" id="values">
                    <attribute-values :attributeid="{{ $attribute->id }}"></attribute-values>
                </div>
            </div>
        </div>
    </div>
<script src="{{ asset('backend/js/app.js') }}"></script>
@endsection
Activity icon

Started a new Conversation Can't Reach The Components File To Print Changes On Screen

Hello i have this code

<div class="tab-pane" id="values">
                    <attribute-values :attributeid="{{ $attribute->id }}"></attribute-values>
   </div>

and this is my app.js file code

Vue.component('attribute-values', require('./components/AttributeValues.vue').default);

and this is my attributeValues.js file

<template>
<h3>hello</h3>
</template>

<script>
  export default {
        name: "attribute-values",
        props: ['attributeid'],
    }
    console.log('hello');
</script>

every change I made to this file doesn't take any effect on the screen I even print hello to the console log as you see above but not showing to, why is that what am I doing wrong here and new to Vue js can you please help me understand this and I will be more than grateful and thanks

Apr
11
5 months ago
Activity icon

Started a new Conversation How To Expand Laravel Bagisto To Have Multi Vendors Capabilities

Hello I want to build a store that enables users to sell there own products and has there own dashboard to do so and I found bagisto but it only enables the admin to sell product and I want another user with a level of vendor to be able to sell stuff to and another regular user that buys the products I found a paid ext that can do so but I want to do it myself and I don't have the money to pay for it heh, so is there any good tutorials to do so or even logic to do so that can make my life easier and thanks so much.

note if there is any other laravel extension that can do the multi vendors will be great to know about!

Mar
24
6 months ago
Activity icon

Awarded Best Reply on Page Return 419 Page Expired

for some reason when I update the PHP version from PHP v7.1 to PHP v7.3 it fixed my problem

Activity icon

Replied to Page Return 419 Page Expired

for some reason when I update the PHP version from PHP v7.1 to PHP v7.3 it fixed my problem

Activity icon

Started a new Conversation Change The Input Type Date From MM/DD/YYYY To YYYY/MM/DD

Hello i have an input type date and it shows to the user like this MM/DD/YYYY and i want it to be like this YYYY/MM/DD

Mar
21
6 months ago
Activity icon

Replied to Page Return 419 Page Expired

my cache drive is the same I just uploaded the same files from the server and test them at my localhost and the login process completed successfully on the localhost but it returns 419 when trying to do the same at the server.

Activity icon

Replied to Page Return 419 Page Expired

sorry my bad I was trying many things at once and copied the last edit and paste it here the csrf was not on the last try sorry again

Activity icon

Replied to Page Return 419 Page Expired

the code is working on my localhost fine but on the server it shows the error 419

Activity icon

Replied to Page Return 419 Page Expired

I did that but still the problem exists

Activity icon

Replied to Page Return 419 Page Expired

this is my login controller

<?php

namespace Bitfumes\Multiauth\Http\Controllers;

use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Auth;

class LoginController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Login Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles authenticating users for the application and
    | redirecting them to your home screen. The controller uses a trait
    | to conveniently provide its functionality to your applications.
    |
     */

    use AuthenticatesUsers;

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('admin:admin', ['only' => 'showLoginForm']);
        $this->middleware('guest:admin', ['except' => 'logout']);
    }

    protected function sendLoginResponse(Request $request)
    {
        $request->session()->regenerate();

        $this->clearLoginAttempts($request);

        return redirect($this->redirectPath());
    }

    /**
     * Show the application's login form.
     *
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function showLoginForm()
    {
        return view('multiauth::admin.login');
    }

    /**
     * Get the needed authorization credentials from the request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    protected function credentials(Request $request)
    {
        $request['active'] = 1;
        return $request->only($this->username(), 'password', 'active');
    }

    /**
     * @param Request $request
     *
     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
     */
    public function logout(Request $request)
    {
        $this->guard()->logout();

        $request->session()->invalidate();

        return redirect(route('admin.login'));
    }

    /**
     * Get the guard to be used during authentication.
     *
     * @return \Illuminate\Contracts\Auth\StatefulGuard
     */
    protected function guard()
    {
        return Auth::guard('admin');
    }

    /**
     * Validate the user login request.
     *
     * @param \Illuminate\Http\Request $request
     *
     * @return void
     */
    protected function validateLogin(Request $request)
    {
        $request->validate([
            'email'    => 'required|string',
            'password' => 'required|string',
        ]);
    }

    protected function redirectPath()
    {
        return config('multiauth.redirect_after_login');
    }
}

and this is the login view

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <title>Makondi</title>

    <!-- Bootstrap -->
    <link href="{{ asset('backend/vendors/bootstrap/dist/css/bootstrap.min.css')}}" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="{{ asset('backendvendors/font-awesome/css/font-awesome.min.css')}}" rel="stylesheet">
    <!-- NProgress -->
    <link href="{{ asset('backend/vendors/nprogress/nprogress.css')}}" rel="stylesheet">
    <!-- Animate.css -->
    <link href="{{ asset('backend/vendors/animate.css/animate.min.css')}}" rel="stylesheet">

    <!-- Custom Theme Style -->
    <link href="{{ asset('backend/build/css/custom.min.css')}}" rel="stylesheet">
  </head>

  <body class="login" style="background-color: black">
    <div>
      <a class="hiddenanchor" id="signup"></a>
      <a class="hiddenanchor" id="signin"></a>

      <div class="login_wrapper">
        <div class="animate form login_form">
          <section class="login_content">
            <form  method="POST" action="{{ route('admin.login') }}">
              <h1 style="color:white"> Login Form</h1>
              <div >
                    <input id="email" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" value="{{ old('email') }}"
                    required autofocus  placeholder="Username"> @if ($errors->has('email'))
                        <span class="invalid-feedback" role="alert">
                            <strong>{{ $errors->first('email') }}</strong>
                        </span> @endif
               </div>
              {{-- <div>
                <input type="text" class="form-control" placeholder="Username" required="" />
              </div> --}}

              <div >
                    <input id="password" type="password" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" name="password"
                    required placeholder="Password"> @if ($errors->has('password'))
                        <span class="invalid-feedback" role="alert">
                            <strong>{{ $errors->first('password') }}</strong>
                        </span> @endif
                </div>
              {{-- <div>
                <input type="password" class="form-control" placeholder="Password" required="" />
              </div> --}}
              <div>
                 <button type="submit" class="btn " style="background-color:orangered">
                                    {{ __('Login') }}
                 </button>
                <a class="btn btn-link" href="{{ route('admin.password.request') }}" style="color:white">
                                    {{ __('Forgot Your Password?') }}
                </a>
              </div>

              <div class="clearfix"></div>

              <div class="separator">
               

                <div class="clearfix"></div>
                <br />

                <div>
                  <h1 style="color:white"><img src="{{ URL('backend/docs/images/IMG-20190507-WA0001~2.jpg') }}" width="70px" height="60px"> Company Makondi</h1>
                  <p style="color:white">©2019 All Rights Reserved. Company Makondi. Privacy and Terms</p>
                </div>
              </div>
            </form>
          </section>
        </div>

      </div>
    </div>
  </body>
</html>
Mar
20
6 months ago
Activity icon

Started a new Conversation Page Return 419 Page Expired

Hello, I have a login form that returns a 419-page expired error first I thought that I might forget using the @csrf but it exists and I also tried the csrf_filed() but still not working the same error message am using Laravel multi auth do you have any idea why this error appears? and thanks for the help I really do appreciate it.