samalapsy

Developer at worshipnow.com.ng

Hire Me

Experience

4,370

3 Best Reply Awards

  • Member Since 7 Months Ago
  • 1 Lesson Completed
  • 1 Favorite

18th October, 2017

samalapsy left a reply on Pace.js Never Show Progress Bar • 9 hours ago

@ANONYMOUS194 I was trying to solve the issue I had using pace.js and I think I could help out by providing a solution to your question.

Add this class to the div that wraps all your content pace-done

Thanks

13th October, 2017

samalapsy left a reply on What's The Use Of Route::domain Or Route::group(['domain' => 'xyz.com']) • 5 days ago

@polarcubs

Route::domain (Used in Laravel 5.4)or Route::group(['domain' => 'xyz.com'])? are is used when you have a sub domain which can be either dynamic or statc for example

Route::domain('{account}.myapp.com')->group(function () {
    Route::get('user/{id}', function ($account, $id) {
        //
    });
});

Means that {account} is a variable that can change therefore instead of having a static subdomain for your website.... you can have a container to show any subdomain under your domain using the laravel route domain function.

samalapsy left a reply on Mail Arrive As Plain Text • 5 days ago

@sebastian.bouckaert@sbsoftware.be wuld have been grate if your share your mail vie html

samalapsy left a reply on Make Image Load Last • 5 days ago

@snapey Wow....Does that means that Medium did the same thing?

samalapsy left a reply on Mail Arrive As Plain Text • 5 days ago

@SEBASTIAN.BOUCKAERT@SBSOFTWARE.BE can you pls showyour codes?

12th October, 2017

samalapsy started a new conversation Make Image Load Last • 6 days ago

Good Day

Please How can i make images be the last thing to be loaded last on pages in my web application.

All Comment sincerely appreciated

11th October, 2017

samalapsy left a reply on Css Not WOrking • 1 week ago

It's working now..

This is what i did..

I'm running laravel 5.3 so I'm using gulp...I added all my csss to the assest folder in the resource.. Below is the content of my gulp file. thanks

const elixir = require('laravel-elixir');

require('laravel-elixir-vue-2');

/*
 |--------------------------------------------------------------------------
 | Elixir Asset Management
 |--------------------------------------------------------------------------
 |
 | Elixir provides a clean, fluent API for defining some basic Gulp tasks
 | for your Laravel application. By default, we are compiling the Sass
 | file for our application, as well as publishing vendor resources.
 |
 */

elixir(mix => {
    //mix.sass('app.scss')
       //.webpack('app.js');
       mix.styles([
        "bootstrap.css",
        "app.css"
    ], 'public/css/all.css');


       mix.scripts([
        //"laravel-app.js",
        "vue-app.js",
        "theme-app.js"
    ], 'public/js/all.js');

});

Then I called all.css and all.js in my blade file

samalapsy left a reply on Css Not WOrking • 1 week ago

Please can help with an example @cronix

my .env file is not accessible.

samalapsy left a reply on Css Not WOrking • 1 week ago

@lancecoder Yeah It's working fine but my page is not rendered by the css in the sheet.

samalapsy left a reply on Css Not WOrking • 1 week ago

<link rel="shortcut icon" type="image/ico" href="favicon.ico" />
<link rel="icon" type="image/ico" href="favicon.ico" />

   <!-- =============== VENDOR STYLES ===============-->
   <!-- FONT AWESOME-->
   {{-- <link rel="stylesheet" href="{{ asset('/vendor/fontawesome/css/font-awesome.min.css')}}"> --}}
   <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">

   {{-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/weather-icons/2.0.9/css/weather-icons.min.css">
   <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.4.1/css/simple-line-icons.min.css"> --}}


   <!-- SIMPLE LINE ICONS-->
   <link rel="stylesheet" href="{{ asset('/vendor/simple-line-icons/css/simple-line-icons.css')}}">
   <!-- ANIMATE.CSS-->
   <link rel="stylesheet" href="{{ asset('/vendor/animate.css/animate.min.css')}}">
   <!-- WHIRL (spinners)-->
   <link rel="stylesheet" href="{{ asset('/vendor/whirl/dist/whirl.css')}}">
   <!-- =============== PAGE VENDOR STYLES ===============-->
   <!-- WEATHER ICONS-->
   <link rel="stylesheet" href="{{ asset('/vendor/weather-icons/css/weather-icons.min.css')}}">
   <!-- =============== BOOTSTRAP STYLES ===============-->
   {{-- <link rel="stylesheet" href="{{ asset('css/bootstrap.css') }}" id="bscss"> --}}
   <!-- =============== APP STYLES ===============-->
   <link rel="stylesheet" href="{{ asset('css/all.css') }}" id="maincss">
   <!-- Scripts -->
    <script>
      var APP_URL = "{{ route('index') }}";
      window.Laravel = <?php echo json_encode([
        'csrfToken' => csrf_token(),
      ]); ?>
    </script>
</head>

samalapsy started a new conversation Css Not WOrking • 1 week ago

Good Day Please I installed laravel pusher echo on my laravel project, ran, php artisan make:auth and suddenly my app is not reading the css I had already. Please how can I fix this? Thank you

21st September, 2017

samalapsy left a reply on Upload Multiple Images To Server Using Image Intervention • 3 weeks ago

@johnef_sh You have a duplicated in your controller.. See this

Image::make( $gImg )->resize( 1890, 1358 )->save( 'images/decoration/' . $filename );
                Image::make( $gImg )->fit( 646, 250 )->save( 'images/decoration/thumbs-' . $filename );

The above code would duplicated the images in different size.

9th September, 2017

samalapsy left a reply on Upload Laravel To Plesk Server • 1 month ago

@jlrdw I've tried this process before but it's still the same things....Mind you I can't find any error on the error log....But i keep getting This page isn’t working, domain is currently unable to handle this request.

samalapsy left a reply on Upload Laravel To Plesk Server • 1 month ago

Someone should please help a brother here..!

samalapsy left a reply on Upload Laravel To Plesk Server • 1 month ago

I've uploaded it.. Please can you give an illustration on how bind it.? Thanks

8th September, 2017

samalapsy started a new conversation Upload Laravel To Plesk Server • 1 month ago

Please hoe can I upload my laravel project from my localhost to my plesk dedicated server ..?

15th August, 2017

samalapsy left a reply on Redirect To Dashboard • 2 months ago

I'm using the Laravel defaults

Auth::routes()

14th August, 2017

samalapsy started a new conversation Redirect To Dashboard • 2 months ago

Please how can I redirect to dashboard when logged in and I visit the registration or login url.

Thank you

12th August, 2017

samalapsy left a reply on Select All From Table And Group By Specific Column • 2 months ago

No I don't have it. This is my model

<?php

namespace App;
use App\User;
use App\Hostel;
use Mail;
use App\Mail\NewBooking;
use App\Mail\BookingSucessful;
use App\Mail\BookingFailed;
use App\Mail\Invoice;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Booking extends Model {
    
    use SoftDeletes;

    protected $fillable =['user_id', 'hostel_id', 'transaction_id', 'user_type', 'inspection_date', 'move_in_date', 'cleaning_services', 'information', 'status', 'room', 'price', 'discount_price','referral_income','referral', 'channel', 'reference' ];

    protected $dates = ['deleted_at'];

    public function user() {
        return $this->belongsTo(User::class);
    }

    public function getOwnerPhone($id) {
        $user = User::select('phone')->whereId($id)->first();
        return $user->phone;
    }

    public function getOwnerEmail($id) {
        $user = User::select('email')->whereId($id)->first($id);
        return $user->email;
    }

    public function getBookerPhone($id) {
        $user = User::select('phone')->whereId($id)->first();
        return $user->phone;
    }

    public function getBookerEmail($id) {
        $user = User::select('email')->whereId($id)->first($id);
        return $user->email;
    }

    public function getBookedHostel($id) {
        return $hostel = Hostel::find($id);
    }
    
    public function booker() {
        return  $this->belongsTo(User::class);
    }

    
    public function hostel() {
        return $this->belongsTo(Hostel::class);
    }


    public function referalIncome($refId) {
        return $refIncome= Booking::where('referral', $refId)->sum('referral_income');

    }

    public function hostelDetails($id) {
        return Hostel::find($id);
    }

    public function finalizeBooking($data){
        
    }
    
    public function successfulBookingMail($data) {
        return Mail::to($data['user_email'])->send(new BookingSucessful($data));
    }

    public function successfulBookingToOwner($data) {
        return Mail::to($data['user_email'])->send(new NewBooking($data));
    }
    

    public function failedBookingMail($data) {      
        return Mail::to($data['user_email'])->send(new BookingFailed($data));
    }


    public function successfulInvoiceMail($data) {
        return Mail::to($data['user_email'])->send(new Invoice($data));
    }

    
}

samalapsy left a reply on Select All From Table And Group By Specific Column • 2 months ago

@Snapey I've tried it it still the same error

samalapsy left a reply on Select All From Table And Group By Specific Column • 2 months ago

Someone should kindly help me out with this

Table Structure

id, room_id, user_id, transaction_id, reference, price, discount_price, referral_income, referral, status

samalapsy left a reply on Select All From Table And Group By Email • 2 months ago

@extjac Structure already added

samalapsy started a new conversation Select All From Table And Group By Email • 2 months ago

I want to select all the entries in the referrals table and them group by referral

$referrals = Booking::whereNotNull('referral')->groupBy('bookings.referral')->orderBy('referral_income', 'DESC')->get();

This is the error I got

SQLSTATE[42000]: Syntax error or access violation: 1055 'bookings.id' isn't in GROUP BY (SQL: select * from `bookings` where `referral` is not null and `bookings`.`deleted_at` is null group by `bookings`.`referral` order by `referral_income` desc)

Please note that my Referral column has been made an index on the database.

Thank you

9th August, 2017

samalapsy left a reply on Dynamic Route Prefix • 2 months ago

@modestas Nope I don't, I think an illustration would be clear enough for me

Thanks

8th August, 2017

samalapsy started a new conversation Dynamic Route Prefix • 2 months ago

I have a column that distinguish each user on the DB. Please how can I change my route prefix using a condition (i.e check if User is admin or not) and then change the prefix based on the user role?

for admin I want to have

domian.com/admin/dashboard

for user I want to have

domian.com/user/dashboard

Thanks

6th August, 2017

samalapsy left a reply on How To Write Eloquent OrderBy() To Put Null Columns To The Last • 2 months ago

This is not still sorting the code..

orderByRaw('-images_id', 'DESC')

samalapsy started a new conversation How To Write Eloquent OrderBy() To Put Null Columns To The Last • 2 months ago

Please hoe can I write an eloquent query to sort result by a column making all the null columns item appear last. Here is my code

->orderBy('images_id', 'DESC')  // This should show the ones with value first
->distinct()->Paginate(24);

31st July, 2017

samalapsy left a reply on Search With Array Multiple Parameters • 2 months ago

This is how my route looks like

Route::any('/filter?room={room}&budget={budget}&proximity={$proximity}&amenities={amenities}', '[email protected]')->name('advanced_search');

30th July, 2017

samalapsy left a reply on Search With Array Multiple Parameters • 2 months ago

Thi is how my request query would look like

array:4 [
  "budget" => "5000"
  "room_type" => "Single Rooms"
  "amenities" => array:3 [
    0 => "Beds in room"
    1 => "Running Water"
    2 => "Wardrobe"
  ]
  "proximity" => "Very Close"
]

This is what I have in my url

http://localhost/prj/public/search/advanced?budget=5000&room_type=Single+Rooms&amenities%5B%5D=Beds+in+room&amenities%5B%5D=Running+Water&amenities%5B%5D=Wardrobe&proximity=Very+Close

How can I make this URL a Clean and SEO friendly one

samalapsy started a new conversation Search With Array Parameters • 2 months ago

I have an advanced search implementation on my website, where I have to display the selected or checked items (from a checkbox) on th url, please how can I achieve this and also how can I remove _token from the search parameters.

Thanks You

samalapsy left a reply on Validation • 2 months ago

@kheengz This is what I have now and it's working fine..

phone' => [
    'required',
    'numeric',
    'digits:11',
    \Illuminate\Validation\Rule::unique('users')->ignore($this->id, 'id')
]

Thanks...

samalapsy left a reply on Validation • 2 months ago

@kheengz This is the error it throws

Symfony\Component\Debug\Exception\FatalThrowableError: Class 'Rule' not found

This is what I have

$rules = [
            'name' => 'required|string|min:5',
            //'phone' => 'required|numeric|digits:11|unique:users, phone, '.$this->id
            //'phone' => 'required|numeric|digits:11|exists:users'
'phone' => [
    'required',
    'numeric',
    'digits:11',
    \Rule::unique('users')->ignore($this->id, 'id')
]

28th July, 2017

samalapsy left a reply on Creating Folder From A Subdomain In Laravel Into Main Domain In Laravel • 2 months ago

yes they are on the same physical servers

samalapsy left a reply on Creating Folder From A Subdomain In Laravel Into Main Domain In Laravel • 2 months ago

If I understand what you just said..It means it's not possibles....right....If yes

What about Uploading and Image from the subdomain to the main domain..is that still possible too..?

samalapsy started a new conversation Creating Folder From A Subdomain In Laravel Into Main Domain In Laravel • 2 months ago

I have 2 laravel files on my website, one is on a subdomain {sub.domain.com} and the other on the main domain {domain.com}.

I want to upload an image into the main public_html folder from the subdomain using Image intervention

The code below creates dynamic folder if it's not existing..

    $path = "uploads/listings/house/" . $slug;

    if(!File::exists("http://domain.com/".$path)){
            File::makeDirectory("http://domain.com/". $path, 0777, true);
            \Log::info('Driectory ' .$path. ' was created');
        }else{
            \Log::info('Driectory ' .$path. ' was NOT created');
        }

This code get the Image, add a watermark and save to the location created above

        $fileName = md5(time() .$image->getClientOriginalName()) ."." . strtolower($image->getClientOriginalExtension());
        $img = Image::make($image->getRealPath());
                
        // Main Photo
        $img->fit(1080, 620)->insert(public_path('img/logo.png'), 'center')->save($path . '/' . $fileName); 
        //Create thumbnail
        $img->fit(300, 350)->save($thumbnailPath . '/' . $fileName); 

#The Issue

Trying to Upload, I receive a log message that the folder has been createdAfter having this, I get this error

Intervention\Image\Exception\NotReadableException: Image source not readable in /home2/username/laravel/vendor/intervention/image/src/Intervention/Image/AbstractDecoder.php:339

How can I achieve this

20th July, 2017

samalapsy left a reply on Mass Assignment Using UpdateOrCreate Method • 2 months ago

@cronix THank You. I'll check it out.

samalapsy left a reply on Validation • 2 months ago

@phantanvietpk If the id = 5, it'll return a stack error saying "Column not found: 1054 unknown column phone5 "

'phone' => 'required|numeric|digits:11|exists:users'

This works locally but on server it throws a Duplicate Entry Error

samalapsy left a reply on Mass Assignment Using UpdateOrCreate Method • 2 months ago

@cronix can you please help me out with an Illustration?

Thanks

samalapsy left a reply on Validation • 2 months ago

i have a phone column on my database

19th July, 2017

samalapsy started a new conversation Validation • 2 months ago

I'm trying to force ignore the phone number validation, I tried this it's not working.

The one with comment worked locally but not working on server

$rules = [
        'name' => 'required|string|min:5',
        'phone' => 'required|numeric|digits:11|unique:users, phone, '.$this->id
        //'phone' => 'required|numeric|digits:11|exists:users'
    ];

This is what it returns on server

production.ERROR: PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column ' phone' in 'where clause'

How can I go about this..?

Thanks

samalapsy started a new conversation Mass Assignment Using UpdateOrCreate Method • 2 months ago

The code below creates an existing Room attach to the house_id if not existing on the DB. I noticed that If I change an the price of an existing room, the query below would create a new row with the updated details

for($i = 0; $i < count($data['type']); $i++){           
    Room::updateOrCreate([
        'house_id' => $hostel->id,
        'user_id' => Auth::id(),
        'type' => $data['type'][$i],
        'price' => $data['price'][$i],
        'space' => $data['space'][$i]
    ]);
}

#What I want to achieve I want to always perform an update on existing rows and only Create a new row if the type is not existing in the database..

15th July, 2017

samalapsy started a new conversation Configure Laravel Domain Routing On Shared Hosting • 3 months ago

Please how can I configure subdomain DNS when using Laravel domain route on shared hosting.

     Route::domain('me.domain.com')->group(function () {
        Route::get('/', function(){
           return "Hello, Welcome to my Laravel Domain Routing. Thanks You";
        });
     }]);

Thanks in Anticipation.

13th July, 2017

samalapsy left a reply on Each Row In A Table Has A Drop-down. How To Read The Selected Value Of Each One And Do A Mass Update On Submit? • 3 months ago

Make your select element an array by changing it's name to

statusSelect[] 

Also add value attribute to you element

    <select name="statusSelect" id="statusSelect" class="form-control">
                        <option selected="selected">Approve</option>
                        <option value="Reject">Reject</option>
                    </select>

In your controller

try to dump the statusSelect request variable then you'll see an array of selected values

I Hope it helps

samalapsy started a new conversation Search On A Serilized Content In Mysql • 3 months ago

  1. I have a column of storing an array as a serialized string on my Database. Please how can I make search through my DB using the array contents of this column as a condition.
  1. Please how can I write the query below in Laravel
    SELECT * FROM table WHERE field REGEXP '.*"m9";s:[0-9]+:".Ok Then, Yes It Is.".*'

Thanks in Anticipation

13th June, 2017

samalapsy started a new conversation Show Friendly 500 Error And Also Display Database Errors Friendly • 4 months ago

Please how can I customize the laravel 500 error view and prevent my app from showing the Laravel 500 Error views when there's a database error..

Thanks in Anticipation.

samalapsy started a new conversation Use The Same Login Form For Multiple Account Login • 4 months ago

I have 2 Different Customs guards and Authentication which are

  1. Admin Guard
  2. Schools Guard

Each guard table (admin, schools) Please how can I use the same login form and url for both account types and also redirect each to them to their respective dashboard

11th June, 2017

samalapsy left a reply on Pass Value To Laravel Named Routing From Javascript • 4 months ago

@alex-greaves I'm not using vueJS...Just normal Jquery

samalapsy started a new conversation Pass Value To Laravel Named Routing From Javascript • 4 months ago

I want to add a value to my named routing from javascript

This is my route 

{{ route('admin.edit_school', ['slug' => $variable_here]) }}

This is what I tried but it's not working

var slug = $(this).data('row-abbreviation');
var url = "{{ route('admin.edit_school', ['slug' => \"+  \"]) }}";
window.location.href=url;

Please how can I achieve this..

6th June, 2017

samalapsy left a reply on Image Intervention - Image Source Not Readable • 4 months ago

Already solved it...I had to remove the

public_path()

because it's adding public to my image link.

I say a very big thank you to @fraserk for your time, effort and support.

Thanks man, Thank You Everyone.

samalapsy left a reply on Sub-domain And Main Domain Using Same Laravel Application • 4 months ago

@alexhiggins yes you're right pleae can you help me out with an example..?

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.